--index crashes on an otherwise successfully rendered image

Mkgmap sometimes crashes with when trying to build a gmapsupp including index using an existing (prerenderd) image. Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 32803, Size: 488 at java.util.ArrayList.rangeCheck(ArrayList.java:571) at java.util.ArrayList.get(ArrayList.java:349) at uk.me.parabola.imgfmt.app.lbl.LBLFileReader.readPoiInfo(LBLFileReader.java:354) at uk.me.parabola.imgfmt.app.lbl.LBLFileReader.<init>(LBLFileReader.java:71) at uk.me.parabola.imgfmt.app.map.MapReader.<init>(MapReader.java:80) at uk.me.parabola.mkgmap.combiners.MdrBuilder.onMapEnd(MdrBuilder.java:108) at uk.me.parabola.mkgmap.main.Main.endOptions(Main.java:369) at uk.me.parabola.mkgmap.CommandArgsReader.readArgs(CommandArgsReader.java:124) at uk.me.parabola.mkgmap.main.Main.main(Main.java:122) zip warning: name not matched: gmapsupp.img This happens when trying to make a gmapsupp with the following Garmin image: http://planetosm.oxilion.nl/~lambertus/garmin/routable/18-11-2009/63240210.i... It's reproducible with at least r1404 and r1387: java -Xmx2048M -jar mkgmap.jar --index --overview-mapname=63240000 --series-name='OSM World Routable' --latin1 --description='OSM World Routable' --product-id=3 --family-id=2000 --tdbfile --nsis --gmapsupp *324*.img If you remove the --index from the command then the IndexOutOfBoundsException exception does not occur. I don't know the Mkgmap verion used to render the source image, but it's pretty recent. If this version is needed then I'll look it up this evening. I hope someone can have a look at this. Thanks in advance.

On Nov 27, 2009, at 11:09, Lambertus wrote:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 32803, Size: 488 at java.util.ArrayList.rangeCheck(ArrayList.java:571) at java.util.ArrayList.get(ArrayList.java:349) at uk.me.parabola.imgfmt.app.lbl.LBLFileReader.readPoiInfo(LBLFileReader.java:354)
Hm... I reported this error on Nov. 1. I had not encountered it again, so I had hoped it was fixed. Regarding the img file which causes the error, what area does it cover? Cheers

Clinton Gladstone wrote:
On Nov 27, 2009, at 11:09, Lambertus wrote:
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 32803, Size: 488 at java.util.ArrayList.rangeCheck(ArrayList.java:571) at java.util.ArrayList.get(ArrayList.java:349) at uk.me.parabola.imgfmt.app.lbl.LBLFileReader.readPoiInfo(LBLFileReader.java:354)
Hm... I reported this error on Nov. 1. I had not encountered it again, so I had hoped it was fixed.
Regarding the img file which causes the error, what area does it cover?
Cheers _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Central Netherlands.

On Nov 27, 2009, at 11:09, Lambertus wrote:
Mkgmap sometimes crashes with when trying to build a gmapsupp including index using an existing (prerenderd) image.
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 32803, Size: 488 at java.util.ArrayList.rangeCheck(ArrayList.java:571) at java.util.ArrayList.get(ArrayList.java:349) at uk.me.parabola.imgfmt.app.lbl.LBLFileReader.readPoiInfo(LBLFileReader.java:354)
I played around with this for a while, but could not find anything definite. I did find that the first POI which caused the problem was the following: P+R DOKTOR HOOLBOOMWEG (There were others which followed, which also caused this error.) It looked to me like the city value for the POI was incorrectly coded when the img file was originally generated. The best I can offer you as a temporary would be a few lines of code which would catch the error and not generate the city information. This would allow the map to compile, but the map would be potentially broken. Cheers.

Clinton Gladstone wrote:
On Nov 27, 2009, at 11:09, Lambertus wrote:
Mkgmap sometimes crashes with when trying to build a gmapsupp including index using an existing (prerenderd) image.
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 32803, Size: 488 at java.util.ArrayList.rangeCheck(ArrayList.java:571) at java.util.ArrayList.get(ArrayList.java:349) at uk.me.parabola.imgfmt.app.lbl.LBLFileReader.readPoiInfo(LBLFileReader.java:354)
I played around with this for a while, but could not find anything definite. I did find that the first POI which caused the problem was the following:
P+R DOKTOR HOOLBOOMWEG
(There were others which followed, which also caused this error.)
It looked to me like the city value for the POI was incorrectly coded when the img file was originally generated.
The best I can offer you as a temporary would be a few lines of code which would catch the error and not generate the city information. This would allow the map to compile, but the map would be potentially broken.
Cheers. Thanks for looking at the problem. I looked at the POI in Potlatch: seems perfectly alright to me.
If you catch the error can you print an warning/error? I don't understand why the map would potentially be broken? Is it possibile to leave the POI out entirely and would that prevent a broken map? During my tests with a new transliterator for the Garmin maps I found out that there was a corruption of the XML source file. I'm not sure if this file was also used for generating that problem map, I'm almost sure it wasn't but I can't rule it out either. Anyway, I'm running a complete new update now, perhaps the problem will be gone this time.

On Nov 28, 2009, at 18:15, Lambertus wrote:
If you catch the error can you print an warning/error? I don't understand why the map would potentially be broken? Is it possibile to leave the POI out entirely and would that prevent a broken map?
Try the attached patch. It catches the index out of bounds error, and prints an error message: the (incorrect) index which was encoded in the POI, the last index of the array, and the POI label, if it has one. The city information will then not be written. This will at least prevent the crash. Cheers.

Tried to get the JDK working on ubuntu this weekend, but there are some stubborn configuration problems. I'll report back asap. Clinton Gladstone wrote:
On Nov 28, 2009, at 18:15, Lambertus wrote:
If you catch the error can you print an warning/error? I don't understand why the map would potentially be broken? Is it possibile to leave the POI out entirely and would that prevent a broken map?
Try the attached patch. It catches the index out of bounds error, and prints an error message: the (incorrect) index which was encoded in the POI, the last index of the array, and the POI label, if it has one. The city information will then not be written.
This will at least prevent the crash.
Cheers.
------------------------------------------------------------------------
_______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Clinton Gladstone wrote:
Try the attached patch. It catches the index out of bounds error, and prints an error message: the (incorrect) index which was encoded in the POI, the last index of the array, and the POI label, if it has one. The city information will then not be written. This will at least prevent the crash.
Well, compiler problems fixed finally, so this is the result of your patch on my test file. I hope this tells you anything:
java -Xmx2048M -jar mkgmap/dist/mkgmap.jar --index --overview-mapname=63240000 --series-name='OSM World Routable' --latin1 --description='OSM World Routable' --product-id=3 --family-id=2000 --tdbfile --nsis --gmapsupp 63240212.img Bad index: 32803 java.lang.IndexOutOfBoundsException: Index: 32803, Size: 488 [9237]P+R DOKTOR HOOLBOOMWEG Bad index: 36735 java.lang.IndexOutOfBoundsException: Index: 36735, Size: 488 [0] Bad index: 4096 java.lang.IndexOutOfBoundsException: Index: 4096, Size: 488 [9330]P+R STATIONSWEG Bad index: 36494 java.lang.IndexOutOfBoundsException: Index: 36494, Size: 488 [0] Bad index: 63630 java.lang.IndexOutOfBoundsException: Index: 63630, Size: 488 [9515]ROGGESTRAAT Bad index: 6400 java.lang.IndexOutOfBoundsException: Index: 6400, Size: 488 [0] Bad index: 45454 java.lang.IndexOutOfBoundsException: Index: 45454, Size: 488 [9683]HANDELSKADE Bad index: 32803 java.lang.IndexOutOfBoundsException: Index: 32803, Size: 488 [0] Bad index: 9893 java.lang.IndexOutOfBoundsException: Index: 9893, Size: 488 [0] Bad index: 32895 java.lang.IndexOutOfBoundsException: Index: 32895, Size: 488 [0] Bad index: 51839 java.lang.IndexOutOfBoundsException: Index: 51839, Size: 488 [0] Bad index: 51839 java.lang.IndexOutOfBoundsException: Index: 51839, Size: 488 [0] Bad index: 51839 java.lang.IndexOutOfBoundsException: Index: 51839, Size: 488 [0] Bad index: 32787 java.lang.IndexOutOfBoundsException: Index: 32787, Size: 488 [0] Bad index: 51839 java.lang.IndexOutOfBoundsException: Index: 51839, Size: 488 [0] Bad index: 9925 java.lang.IndexOutOfBoundsException: Index: 9925, Size: 488 [0] Bad index: 32805 java.lang.IndexOutOfBoundsException: Index: 32805, Size: 488 [0] Bad index: 50815 java.lang.IndexOutOfBoundsException: Index: 50815, Size: 488 [0] Bad index: 9925 java.lang.IndexOutOfBoundsException: Index: 9925, Size: 488 [0] Bad index: 32805 java.lang.IndexOutOfBoundsException: Index: 32805, Size: 488 [0] Bad index: 51839 java.lang.IndexOutOfBoundsException: Index: 51839, Size: 488 [0] Bad index: 9956 java.lang.IndexOutOfBoundsException: Index: 9956, Size: 488 [0] Bad index: 58751 java.lang.IndexOutOfBoundsException: Index: 58751, Size: 488 [0] Bad index: 5321 java.lang.IndexOutOfBoundsException: Index: 5321, Size: 488 [0] Bad index: 58751 java.lang.IndexOutOfBoundsException: Index: 58751, Size: 488 [0] Bad index: 9956 java.lang.IndexOutOfBoundsException: Index: 9956, Size: 488 [0] Bad index: 58751 java.lang.IndexOutOfBoundsException: Index: 58751, Size: 488 [0] Bad index: 9956 java.lang.IndexOutOfBoundsException: Index: 9956, Size: 488 [0] Bad index: 58751 java.lang.IndexOutOfBoundsException: Index: 58751, Size: 488 [0] Bad index: 9973 java.lang.IndexOutOfBoundsException: Index: 9973, Size: 488 [0] Bad index: 58751 java.lang.IndexOutOfBoundsException: Index: 58751, Size: 488 [0] Bad index: 2175 java.lang.IndexOutOfBoundsException: Index: 2175, Size: 488 [0] Bad index: 2175 java.lang.IndexOutOfBoundsException: Index: 2175, Size: 488 [0] Bad index: 2175 java.lang.IndexOutOfBoundsException: Index: 2175, Size: 488 [0] Bad index: 2175 java.lang.IndexOutOfBoundsException: Index: 2175, Size: 488 [0] Bad index: 2175 java.lang.IndexOutOfBoundsException: Index: 2175, Size: 488 [0] Bad index: 2175 java.lang.IndexOutOfBoundsException: Index: 2175, Size: 488 [0] Bad index: 32895 java.lang.IndexOutOfBoundsException: Index: 32895, Size: 488 [0] Bad index: 23555 java.lang.IndexOutOfBoundsException: Index: 23555, Size: 488 [0] Bad index: -1 java.lang.ArrayIndexOutOfBoundsException: -1 [0] Bad index: 46975 java.lang.IndexOutOfBoundsException: Index: 46975, Size: 488 [0] Bad index: 10234 java.lang.IndexOutOfBoundsException: Index: 10234, Size: 488 [0] Bad index: 11135 java.lang.IndexOutOfBoundsException: Index: 11135, Size: 488 [0] Bad index: 10309 java.lang.IndexOutOfBoundsException: Index: 10309, Size: 488 [0] Bad index: 8752 java.lang.IndexOutOfBoundsException: Index: 8752, Size: 488 [0] Bad index: 30591 java.lang.IndexOutOfBoundsException: Index: 30591, Size: 488 [0] Bad index: 10410 java.lang.IndexOutOfBoundsException: Index: 10410, Size: 488 [0]

Hi Lambertus
Mkgmap sometimes crashes with when trying to build a gmapsupp including index using an existing (prerenderd) image.
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 32803, Size: 488 at java.util.ArrayList.rangeCheck(ArrayList.java:571) at java.util.ArrayList.get(ArrayList.java:349)
This happens when trying to make a gmapsupp with the following Garmin image: http://planetosm.oxilion.nl/~lambertus/garmin/routable/18-11-2009/63240210.i...
I don't know the Mkgmap verion used to render the source image, but it's pretty recent. If this version is needed then I'll look it up this evening.
It was created with 1387. I believe that the problem is one that was fixed in 1391. It is creating the map that needs to be redone. Although we should stop the --index failing when encountering a bad file, it has been quite useful to fix all the bugs in writing the POI information. ..Steve

Hi Steve, The image I linked to on the server was created with an r1387 of Mkgmap, but I tested with r1404 as well. Same result. The patch from Clinton's email from 2009-11-28 20:59 works, but Mkgmap now reports a lot of 'bad index' warnings which I reported back on 2009-12-02 21:36. Maybe the report got lost in the noise, as I sent a few mails that day (about my Java JDK environment problems). Steve Ratcliffe wrote:
Hi Lambertus
Mkgmap sometimes crashes with when trying to build a gmapsupp including index using an existing (prerenderd) image.
Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 32803, Size: 488 at java.util.ArrayList.rangeCheck(ArrayList.java:571) at java.util.ArrayList.get(ArrayList.java:349)
This happens when trying to make a gmapsupp with the following Garmin image: http://planetosm.oxilion.nl/~lambertus/garmin/routable/18-11-2009/63240210.i...
I don't know the Mkgmap verion used to render the source image, but it's pretty recent. If this version is needed then I'll look it up this evening.
It was created with 1387. I believe that the problem is one that was fixed in 1391. It is creating the map that needs to be redone.
Although we should stop the --index failing when encountering a bad file, it has been quite useful to fix all the bugs in writing the POI information.
..Steve _______________________________________________ mkgmap-dev mailing list mkgmap-dev@lists.mkgmap.org.uk http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
participants (3)
-
Clinton Gladstone
-
Lambertus
-
Steve Ratcliffe