mkgmap crashes if nodes are missing

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

mkgmap crashes if nodes are missing

NopMap
I have been debugging a crash of mkgamp where it fails with the exception

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.RangeCheck(Unknown Source)
        at java.util.ArrayList.get(Unknown Source)
        at uk.me.parabola.mkgmap.reader.osm.MultiPolygonRelation$JoinedWay.<init
>(MultiPolygonRelation.java:2199)
        at uk.me.parabola.mkgmap.reader.osm.MultiPolygonRelation.joinWays(MultiP
olygonRelation.java:245)
        at uk.me.parabola.mkgmap.reader.osm.MultiPolygonRelation.processElements
(MultiPolygonRelation.java:763)
        at uk.me.parabola.mkgmap.reader.osm.ElementSaver.addRelation(ElementSave
r.java:166)
        at uk.me.parabola.mkgmap.reader.osm.xml.Osm5XmlHandler$SaxHandler.endEle
ment(Osm5XmlHandler.java:182)

The reason seems to be inconsistent data: a way without the nodes it references. As mkgmap siletntly drops missing ways, but crashes on missing nodes I assume this is a bug.

This can be fixed by changing Osm5XmlHandler, line 263 to

                        if ("way".equals(type)){
                                el = saver.getWay(id);
                                // remove ways without points
                                if( el != null && ((Way)el).getPoints().isEmpty() )
                                        el = null;
                         }

Maybe someone would like to apply this fix to make mkgmap more robust.

bye
                Nop
Reply | Threaded
Open this post in threaded view
|

Re: mkgmap crashes if nodes are missing

NopMap

Did anybody put this one-line fix into mkgmap?

bye
            Nop
Reply | Threaded
Open this post in threaded view
|

[PATCH v1] mkgmap crashes if nodes are missing

WanMil
In reply to this post by NopMap
Hi Nop,

can you please test attatched patch?
Ways without any nodes should be handled by the multipolygon handling so
I moved the fix in the multipolygon code.

How did you create such a file that contains ways without any nodes?

WanMil

> I have been debugging a crash of mkgamp where it fails with the exception
>
> java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
>          at java.util.ArrayList.RangeCheck(Unknown Source)
>          at java.util.ArrayList.get(Unknown Source)
>          at
> uk.me.parabola.mkgmap.reader.osm.MultiPolygonRelation$JoinedWay.<init
>> (MultiPolygonRelation.java:2199)
>          at
> uk.me.parabola.mkgmap.reader.osm.MultiPolygonRelation.joinWays(MultiP
> olygonRelation.java:245)
>          at
> uk.me.parabola.mkgmap.reader.osm.MultiPolygonRelation.processElements
> (MultiPolygonRelation.java:763)
>          at
> uk.me.parabola.mkgmap.reader.osm.ElementSaver.addRelation(ElementSave
> r.java:166)
>          at
> uk.me.parabola.mkgmap.reader.osm.xml.Osm5XmlHandler$SaxHandler.endEle
> ment(Osm5XmlHandler.java:182)
>
> The reason seems to be inconsistent data: a way without the nodes it
> references. As mkgmap siletntly drops missing ways, but crashes on missing
> nodes I assume this is a bug.
>
> This can be fixed by changing Osm5XmlHandler, line 263 to
>
> if ("way".equals(type)){
> el = saver.getWay(id);
> // remove ways without points
> if( el != null && ((Way)el).getPoints().isEmpty() )
> el = null;
>                           }
>
> Maybe someone would like to apply this fix to make mkgmap more robust.
>
> bye
>                  Nop
>
>
> --
> View this message in context: http://gis.19327.n5.nabble.com/mkgmap-crashes-if-nodes-are-missing-tp5711811.html
> Sent from the Mkgmap Development mailing list archive at Nabble.com.
> _______________________________________________
> mkgmap-dev mailing list
> [hidden email]
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>


_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

mp_emptyway_v1.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v1] mkgmap crashes if nodes are missing

NopMap
WanMil wrote
can you please test attatched patch?

How did you create such a file that contains ways without any nodes?
Hard to say as it occurred after over 400 correct tiles. Maybe a fault in osm or contour data, but more likely a splitting artefact.

I'm trying to recreate the situation, but so far no success with small areas. It'll most likely take a full Europe run to do so.

bye
             Nop
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v1] mkgmap crashes if nodes are missing

NopMap

The patch works fine. Tested it on a map with 680 tiles. The original mkgmap crashes, the patched version processes the data without a problem.

When you have checked in the patch, please let me know which revision that is.

bye
            Nop
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH v1] mkgmap crashes if nodes are missing

WanMil
Hi Nop,

thanks for testing. I have commited the patch. So since mkgmap r2311
empty ways should be ok for mkgmap.

WanMil

>
> The patch works fine. Tested it on a map with 680 tiles. The original mkgmap
> crashes, the patched version processes the data without a problem.
>
> When you have checked in the patch, please let me know which revision that
> is.
>
> bye
>              Nop
>
>
> --
> View this message in context: http://gis.19327.n5.nabble.com/mkgmap-crashes-if-nodes-are-missing-tp5711811p5716891.html
> Sent from the Mkgmap Development mailing list archive at Nabble.com.
> _______________________________________________
> mkgmap-dev mailing list
> [hidden email]
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev