java.lang.ArrayIndexOutOfBoundsException: 0

Hi , looking at the code it seems that the style assigns a string containing a single semicolon : ";" as a ref. The code doesn't handle this special case. I've commited a small change with r2649 to fix this, binary is here: http://files.mkgmap.org.uk/download/136/mkgmap.jar If that doesn't help, please provide the input file that causes the problem and the commit point of the files in https://github.com/berndw1960/aiostyles You can upload it here: http://files.mkgmap.org.uk/ Ciao, Gerd From: thesurveyor@wolke7.net To: mkgmap-dev@lists.mkgmap.org.uk Date: Mon, 17 Jun 2013 19:46:38 +0200 Subject: [mkgmap-dev] java.lang.ArrayIndexOutOfBoundsException: 0 Hello, I'm just starting with creating Garmin maps from OSM Data. Many thanks to all who have implemented all such tools. That's really great work. Last days I was working on a problem which I couldn't solve till now. Now I hope that somebody can help me. I'm creating a "small" map in the area of the Black Sea. When I use splitter with my parameters I get 7 tiles. And one of these I cannot render with mkgmap. I'm using the Geofabrik Europe extract and as styles I'm using the style available at https://github.com/berndw1960/aiostyles My polygon-file for splitter looks like: Europe / Western Europe / Test 1 36.2 45.5 44.4 45.5 44.4 43.0 36.2 43.0 36.2 45.5 END END My commands are the following: java -Xmx1400M -ea -jar ..\splitter-r304\splitter.jar --polygon-file=..\Test.poly --precomp-sea=..\sea_20130531.zip --max-nodes="1300000" --keep-complete=true --max-areas=200 --description=OSM_Test --mapid=70010001 --no-trim ..\europe-latest.osm.pbf java -Xmx1400M -jar ..\mkgmap-r2638\mkgmap.jar --bounds=..\bounds_20130531.zip --precomp-sea=..\sea_20130531.zip --generate-sea --read-config=..\basemap_style\options --style-file=..\basemap_style --description=OSM_Test --family-id=7001 --product-id=1 --series-name='OSM' --family-name=OSM --mapname=70010001 --draw-priority=10 *.osm.pbf ..\basemap_typ.txt I have tried to change the splitter options, so that I get much more tiles. But it didn't help. I always get the same error when running mkgmap: Time started: Sat Jun 15 00:22:51 CEST 2013 java.lang.ArrayIndexOutOfBoundsException: 0 at uk.me.parabola.imgfmt.app.trergn.Subdivision.createLine(Subdivision.java:310) at uk.me.parabola.mkgmap.build.MapBuilder$LineAddFilter.doFilter(MapBuilder.java:1217) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.LinePreparerFilter.doFilter(LinePreparerFilter.java:85) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.RemoveEmpty.doFilter(RemoveEmpty.java:61) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.LineSplitterFilter.doFilter(LineSplitterFilter.java:69) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.DouglasPeuckerFilter.doFilter(DouglasPeuckerFilter.java:100) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.SizeFilter.doFilter(SizeFilter.java:55) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.RoundCoordsFilter.doFilter(RoundCoordsFilter.java:80) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.PreserveHorizontalAndVerticalLinesFilter.doFilter(PreserveHorizontalAndVerticalLinesFilter.java:60) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.build.LayerFilterChain.startFilter(LayerFilterChain.java:68) at uk.me.parabola.mkgmap.build.MapBuilder.processLines(MapBuilder.java:1046) at uk.me.parabola.mkgmap.build.MapBuilder.makeSubdivision(MapBuilder.java:737) at uk.me.parabola.mkgmap.build.MapBuilder.makeMapAreas(MapBuilder.java:672) at uk.me.parabola.mkgmap.build.MapBuilder.makeMap(MapBuilder.java:214) at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:120) at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:82) 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) Time finished: Sat Jun 15 00:23:23 CEST 2013 Total time taken: 31871ms But if I use the mkgmap default style then I can create the img's. I hope that you can help me or direct me somewhere else. Many thanks TheSurveyor / Gerd PS: I've asked my question here: http://forum.openstreetmap.org/viewtopic.php?id=21543 and they directed me to the mailing list _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Oops, sorry, I've uploaded the wrong binary. r2649 is here: http://files.mkgmap.org.uk/download/137/mkgmap.jar Gerd -- View this message in context: http://gis.19327.n5.nabble.com/java-lang-ArrayIndexOutOfBoundsException-0-tp... Sent from the Mkgmap Development mailing list archive at Nabble.com.

Hi, the problem is similar. I guess we have more places were a string is converted to an array with split() and there is no check if the result has a length of 0. I have to analyze all places were split() is used. This might take a while... Gerd thesurveyor wrote
Many Thanks - that fixed the problem with the tile in Black Sea area, but I found another tile which cannot be rendered.
I have uploaded the PBF to http://files.mkgmap.org.uk/download/140/70010283.osm.pbf
mkgmap - the one you proposed to use http://files.mkgmap.org.uk/download/136/mkgmap.jar
The commit point of the style files at https://github.com/berndw1960/aiostyles is
commit 8e5b68ceb56b5758e8f45a59e18fbdb4b6e11bf1 (it is the version from June, 9th, the current version)
I have stripped down my command to
java -Xmx1000M -jar mkgmap.jar --style-file=..\basemap_style ..\tiles\*.osm.pbf ..\basemap_typ.txt
I get the following error message
Time started: Tue Jun 18 17:32:50 CEST 2013 java.lang.ArrayIndexOutOfBoundsException: 0 at uk.me.parabola.mkgmap.osmstyle.StyledConverter.elementSetup(StyledConverter.java:626) at uk.me.parabola.mkgmap.osmstyle.StyledConverter.addLine(StyledConverter.java:497) at uk.me.parabola.mkgmap.osmstyle.StyledConverter.addLine(StyledConverter.java:492) at uk.me.parabola.mkgmap.osmstyle.StyledConverter.end(StyledConverter.java:362) at uk.me.parabola.mkgmap.reader.osm.ElementSaver.convert(ElementSaver.java:244) at uk.me.parabola.mkgmap.reader.osm.bin.OsmBinMapDataSource.load(OsmBinMapDataSource.java:67) 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) Time finished: Tue Jun 18 17:33:45 CEST 2013 Total time taken: 55231ms
The error message looks very similar to the first one, but it's different.
Many thanks for helping
TheSurveyor / Gerd
Gesendet: Montag, 17. Juni 2013 um 20:37 Uhr Von: "Gerd Petermann" <
gpetermann_muenchen@
> An: "
mkgmap-dev@.org
" <
mkgmap-dev@.org
> Betreff: Re: [mkgmap-dev] java.lang.ArrayIndexOutOfBoundsException: 0
Hi ,
looking at the code it seems that the style assigns a string containing a single semicolon : ";" as a ref. The code doesn't handle this special case. I've commited a small change with r2649 to fix this, binary is here: http://files.mkgmap.org.uk/download/136/mkgmap.jar
If that doesn't help, please provide the input file that causes the problem and the commit point of the files in https://github.com/berndw1960/aiostyles
You can upload it here: http://files.mkgmap.org.uk/
Ciao, Gerd
From:
thesurveyor@
To:
mkgmap-dev@.org
Date: Mon, 17 Jun 2013 19:46:38 +0200 Subject: [mkgmap-dev] java.lang.ArrayIndexOutOfBoundsException: 0
Hello,
I'm just starting with creating Garmin maps from OSM Data. Many thanks to all who have implemented all such tools. That's really great work.
Last days I was working on a problem which I couldn't solve till now. Now I hope that somebody can help me.
I'm creating a "small" map in the area of the Black Sea. When I use splitter with my parameters I get 7 tiles. And one of these I cannot render with mkgmap.
I'm using the Geofabrik Europe extract and as styles I'm using the style available at https://github.com/berndw1960/aiostyles
My polygon-file for splitter looks like: Europe / Western Europe / Test 1 36.2 45.5 44.4 45.5 44.4 43.0 36.2 43.0 36.2 45.5 END END
My commands are the following: java -Xmx1400M -ea -jar ..\splitter-r304\splitter.jar --polygon-file=..\Test.poly --precomp-sea=..\sea_20130531.zip --max-nodes="1300000" --keep-complete=true --max-areas=200 --description=OSM_Test --mapid=70010001 --no-trim ..\europe-latest.osm.pbf
java -Xmx1400M -jar ..\mkgmap-r2638\mkgmap.jar --bounds=..\bounds_20130531.zip --precomp-sea=..\sea_20130531.zip --generate-sea --read-config=..\basemap_style\options --style-file=..\basemap_style --description=OSM_Test --family-id=7001 --product-id=1 --series-name='OSM' --family-name=OSM --mapname=70010001 --draw-priority=10 *.osm.pbf ..\basemap_typ.txt
I have tried to change the splitter options, so that I get much more tiles. But it didn't help. I always get the same error when running mkgmap:
Time started: Sat Jun 15 00:22:51 CEST 2013 java.lang.ArrayIndexOutOfBoundsException: 0 at uk.me.parabola.imgfmt.app.trergn.Subdivision.createLine(Subdivision.java:310) at uk.me.parabola.mkgmap.build.MapBuilder$LineAddFilter.doFilter(MapBuilder.java:1217) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.LinePreparerFilter.doFilter(LinePreparerFilter.java:85) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.RemoveEmpty.doFilter(RemoveEmpty.java:61) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.LineSplitterFilter.doFilter(LineSplitterFilter.java:69) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.DouglasPeuckerFilter.doFilter(DouglasPeuckerFilter.java:100) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.SizeFilter.doFilter(SizeFilter.java:55) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.RoundCoordsFilter.doFilter(RoundCoordsFilter.java:80) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.filters.PreserveHorizontalAndVerticalLinesFilter.doFilter(PreserveHorizontalAndVerticalLinesFilter.java:60) at uk.me.parabola.mkgmap.build.LayerFilterChain.doFilter(LayerFilterChain.java:57) at uk.me.parabola.mkgmap.build.LayerFilterChain.startFilter(LayerFilterChain.java:68) at uk.me.parabola.mkgmap.build.MapBuilder.processLines(MapBuilder.java:1046) at uk.me.parabola.mkgmap.build.MapBuilder.makeSubdivision(MapBuilder.java:737) at uk.me.parabola.mkgmap.build.MapBuilder.makeMapAreas(MapBuilder.java:672) at uk.me.parabola.mkgmap.build.MapBuilder.makeMap(MapBuilder.java:214) at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:120) at uk.me.parabola.mkgmap.main.MapMaker.makeMap(MapMaker.java:82) 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) Time finished: Sat Jun 15 00:23:23 CEST 2013 Total time taken: 31871ms
But if I use the mkgmap default style then I can create the img's. I hope that you can help me or direct me somewhere else.
Many thanks TheSurveyor / Gerd
PS: I've asked my question here: http://forum.openstreetmap.org/viewtopic.php?id=21543
and they directed me to the mailing list
_______________________________________________ mkgmap-dev mailing list
mkgmap-dev@.org
http://lists.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
_______________________________________________ mkgmap-dev mailing list
mkgmap-dev@.org
-- View this message in context: http://gis.19327.n5.nabble.com/java-lang-ArrayIndexOutOfBoundsException-0-tp... Sent from the Mkgmap Development mailing list archive at Nabble.com.

Hi Gerd, thesurveyor wrote
As I understand there is a rule within the style and there is at least an OSM object in the map which must come together that mkgmap will fail.
So from my point it is not clear where it must be fixed. You can fix it in the code of mkgmap, of course that is the best solution, but is it the only one?
Yes, with your data it was easy to identify: the problem is caused by an emty ref tag as in http://www.openstreetmap.org/browse/way/46197501 I've committed r2650 to handle this case, the binary is here: http://files.mkgmap.org.uk/download/141/mkgmap.jar I still have to analyse if the result of split() is used without checks elsewhere. Gerd -- View this message in context: http://gis.19327.n5.nabble.com/java-lang-ArrayIndexOutOfBoundsException-0-tp... Sent from the Mkgmap Development mailing list archive at Nabble.com.
participants (3)
-
Gerd Petermann
-
GerdP
-
thesurveyor@wolke7.net