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
ExpressionReader.patch
Description: Binary data
_______________________________________________ mkgmap-dev mailing list [email protected] http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
