[mkgmap-dev] variable filters: substring filter fails with java.lang.StringIndexOutOfBoundsException: String index out of range
From Gerd Petermann gpetermann_muenchen at hotmail.com on Wed Oct 16 07:53:13 BST 2013
Hi Gert, I think the intended behaviour was to return the complete string when substring fails. Attached is a patch that implements this. Gerd > From: aleuche at web.de > To: mkgmap-dev at lists.mkgmap.org.uk > Date: Wed, 16 Oct 2013 08:00:39 +0200 > Subject: [mkgmap-dev] variable filters: substring filter fails with java.lang.StringIndexOutOfBoundsException: String index out of range > > Hello, > > i used rev.2748. > if i use the substring variable filter and the variable is shorter than the substring command end-index, i always got an exception. > > java.lang.StringIndexOutOfBoundsException: String index out of range: 7 > at java.lang.String.substring(Unknown Source) > at uk.me.parabola.mkgmap.osmstyle.actions.SubstringFilter.doFilter(SubstringFilter.java:64) > at uk.me.parabola.mkgmap.osmstyle.actions.ValueFilter.filter(ValueFilter.java:34) > at uk.me.parabola.mkgmap.osmstyle.actions.ValueItem.getValue(ValueItem.java:48) > at uk.me.parabola.mkgmap.osmstyle.actions.ValueBuilder.build(ValueBuilder.java:63) > at uk.me.parabola.mkgmap.osmstyle.actions.NameAction.perform(NameAction.java:51) > at uk.me.parabola.mkgmap.osmstyle.ActionRule.resolveType(ActionRule.java:72) > at uk.me.parabola.mkgmap.osmstyle.RuleSet.resolveType(RuleSet.java:68) > at uk.me.parabola.mkgmap.osmstyle.StyledConverter.convertWay(StyledConverter.java:228) > at uk.me.parabola.mkgmap.reader.osm.ElementSaver.convert(ElementSaver.java:232) > at uk.me.parabola.mkgmap.reader.osm.xml.Osm5MapDataSource.load(Osm5MapDataSource.java:71) > at uk.me.parabola.mkgmap.reader.osm.OsmMapDataSource.load(OsmMapDataSource.java:127) > at uk.me.parabola.mkgmap.main.MapMaker.loadFromFile(MapMaker.java:167) > at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:63) > at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:243) > at uk.me.parabola.mkgmap.main.Main$1.call(Main.java:239) > at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source) > 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) > > For example: > lref contains "ABC" > > lcn_from_relation=yes {name '${lref|substring:0:7|highway-symbol:oval:9} ${lname}' | '${lref|highway-symbol:oval:9} (${lname|not-equal:lref})' | '${lref|highway-symbol:oval:9}' | '${name}'; add mkgmap:display_name = '${name} (${ref})' } > fails with exception as in "substring:0:7" the end-point exceeds the "ABC" length. > > Is this intended behaviour or simply missing an exception handling for this case? > > regards > Gert > P.D > _______________________________________________ > mkgmap-dev mailing list > mkgmap-dev at lists.mkgmap.org.uk > http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20131016/5688d999/attachment-0001.html -------------- next part -------------- A non-text attachment was scrubbed... Name: SubstringFilter_v1.patch Type: application/octet-stream Size: 759 bytes Desc: not available Url : http://lists.mkgmap.org.uk/pipermail/mkgmap-dev/attachments/20131016/5688d999/attachment-0001.obj
- Previous message: [mkgmap-dev] variable filters: substring filter fails with java.lang.StringIndexOutOfBoundsException: String index out of range
- Next message: [mkgmap-dev] variable filters: substring filter fails with java.lang.StringIndexOutOfBoundsException: String index out of range
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the mkgmap-dev mailing list