logo separator

[mkgmap-dev] patch for style file reader crash

From Mike Baggaley mike at tvage.co.uk on Sun Feb 5 22:08:30 GMT 2017

Hi Gerd, please find attached a small patch for preventing a crash when two
regular expressions are used but the 'and' or 'or' separating them is
missing, for example:

landuse=meadow & (name~'[Mm]eadow'  name~'[Ff]ield') {delete name;}

The existing code crashes with the following trace:

java.lang.AssertionError
  at uk.me.parabola.mkgmap.osmstyle.eval.RegexOp.setSecond(RegexOp.java:49)
  at
uk.me.parabola.mkgmap.osmstyle.eval.ExpressionReader.runOp(ExpressionReader.
java:180)
  at
uk.me.parabola.mkgmap.osmstyle.eval.ExpressionReader.saveOp(ExpressionReader
.java:143)
  at
uk.me.parabola.mkgmap.osmstyle.eval.ExpressionReader.readConditions(Expressi
onReader.java:62)
  at
uk.me.parabola.mkgmap.osmstyle.RuleFileReader.loadFile(RuleFileReader.java:1
15)
  at
uk.me.parabola.mkgmap.osmstyle.RuleFileReader.load(RuleFileReader.java:86)
  at uk.me.parabola.mkgmap.osmstyle.StyleImpl.readRules(StyleImpl.java:302)
  at uk.me.parabola.mkgmap.osmstyle.StyleImpl.<init>(StyleImpl.java:160)
  at uk.me.parabola.mkgmap.osmstyle.StyleImpl.readStyle(StyleImpl.java:554)
  at
uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.createConverter(OsmMapData
Source.java:289)
  at
uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.setupHandler(OsmMapDataSou
rce.java:187)
  at
uk.me.parabola.mkgmap.reader.osm.o5m.O5mBinMapDataSource.load(O5mBinMapDataS
ource.java:43)
  at
uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.load(OsmMapDataSource.java
:138)
  at uk.me.parabola.mkgmap.main.MapMaker.loadFromFile(MapMaker.java:154)
  at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:52)
  at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:265)
  at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:261)
  at java.util.concurrent.FutureTask.run(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
  at java.lang.Thread.run(Unknown Source)

With the patch, I get an error message as follows:

Error in style: Error: (points:76): Invalid arguments to REGEX: FUNCTION
($[Mm]eadow) and REGEX (($name~'[Ff]ield'))

(Actually I get the message 4 times, but that is a minor issue.)

I have moved 3 lines of code from before various syntax checks to after the
checks.
Please try the patch and commit if happy.

Thanks,
Mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ExpressionReader.patch
Type: application/octet-stream
Size: 1028 bytes
Desc: not available
URL: <http://www.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20170205/ea19082b/attachment.obj>


More information about the mkgmap-dev mailing list