logo separator

[mkgmap-dev] variable filters: substring filter fails with java.lang.StringIndexOutOfBoundsException: String index out of range

From Anna Leuchter aleuche at web.de on Wed Oct 16 07:00:39 BST 2013

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


More information about the mkgmap-dev mailing list