Possible BUG: Array index out of bounds in RestrictionRelation.java

Hi. I have generated a Garmin map from an OSM file of europe. At first, I split the map using splitter --mapid=19051979 --max-nodes=500000 ../geofabrik/europe.osm.gz (max-nodes is small as I got heap problems before with my 2GB system) Then I did: mkgmap --style-file=~/navi/maps/mkgmap.style/ --net --route --code-page=1252 --country-abbr="EU" --tdbfile --overview-mapname=22051979 --family-name="EU" --family-id=21 --series-name="EU" --tdb-v4 ../1905*.osm.gz However, in my first try mkgmap complained about "Array Index Out Of Bound" (I forgot to copy the exact error message). The problem was in RestrictionRelation.java. I did some modifications (patch attached) and mkgmap successfully generated images. Note, I am not a java programmer and I have not really an idea about the "impact" of my patch. It is more or less a workaround. However, I hope someone knows why this happens (empty way?) and can properly fix it. Btw: In a third run I generated gmapsupp.img which works on my Oregon and I can successfully route from Germany to Italy :) -- Thorsten

Hi Thorsten, Many thanks for the report + patch. I don't know how the way's can have no points but we should handle that situation gracefully. Please try the attached patch with your data. Cheers, Mark

Hi, Mark Burton wrote:
Many thanks for the report + patch. I don't know how the way's can have no points but we should handle that situation gracefully.
I am trying to parse the splitted osm files if there are ways which have no node references.
Please try the attached patch with your data.
This could take some time - I will start mkgmap again tonight. Maybe one thing. You have not altered the following lines which previously failed: if(toWay != null) { log.warn(messagePrefix + "has multiple 'to' members - first 'to' member starts at " + toWay.getPoints().get(0).toDegreeString()); } What happens if toWay.getPoints() is empty? toWay.getPoints().get(0) will fail anyway, doesn't it? Same with: if(fromWay != null) { log.warn(messagePrefix + "has multiple 'from' members - first 'from' member starts at " + fromWay.getPoints().get(0).toDegreeString()); } -- Thorsten

Hi,
Mark Burton wrote:
Many thanks for the report + patch. I don't know how the way's can have no points but we should handle that situation gracefully.
I am trying to parse the splitted osm files if there are ways which have no node references.
Please try the attached patch with your data.
This could take some time - I will start mkgmap again tonight.
OK.
Maybe one thing. You have not altered the following lines which previously failed:
if(toWay != null) { log.warn(messagePrefix + "has multiple 'to' members - first 'to' member starts at " + toWay.getPoints().get(0).toDegreeString()); }
What happens if toWay.getPoints() is empty? toWay.getPoints().get(0) will fail anyway, doesn't it?
Same with:
if(fromWay != null) { log.warn(messagePrefix + "has multiple 'from' members - first 'from' member starts at " + fromWay.getPoints().get(0).toDegreeString()); }
My version of the fix doesn't assign the empty ways to either toWay or fromWay so those variables will be null and the warnings not printed. Cheers, Mark

Mark Burton wrote:
Mark Burton wrote:
Many thanks for the report + patch. I don't know how the way's can have no points but we should handle that situation gracefully.
Please try the attached patch with your data. This could take some time - I will start mkgmap again tonight.
Hi. Patch successfully passed. Thx, Thorsten
participants (3)
-
Mark Burton
-
Thorsten
-
Thorsten Zitterell