Changeset 18819 in josm for trunk/test/unit


Ignore:
Timestamp:
2023-08-23T13:53:32+02:00 (15 months ago)
Author:
taylor.smock
Message:

See #22652, r18817: Stop parsing gpx files when point elements have invalid coordinates

This adds back the wpt check that was temporarily removed in r18818 to get back
to the previous "known good" state and additionally adds checks for rtept and
trkpt elements.

This also removes a change to build.xml that was accidentally committed in r18818.
The specific change (adding Automatic-Module-Name to the JOSM manifest) will
probably be done in a separate commit in the future.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java

    r18818 r18819  
    104104
    105105    @ParameterizedTest
    106     @ValueSource(strings = "<gpx><wpt></wpt></gpx>")
     106    @ValueSource(strings = {
     107            "<gpx><wpt></wpt></gpx>",
     108            "<gpx><trk><trkseg><trkpt></trkpt></trkseg></trk></gpx>",
     109            "<gpx><rte><rtept></rtept></rte></gpx>"
     110    })
    107111    void testIncompleteLocations(String gpx) {
    108112        SAXException saxException = assertThrows(SAXException.class,
     
    111115        if ("<wpt>".regionMatches(0, gpx, 5, 4)) {
    112116            type = "wpt";
     117        } else if ("<trkpt>".regionMatches(0, gpx, 18, 7)) {
     118            type = "trkpt";
     119        } else if ("<rtept>".regionMatches(0, gpx, 10, 7)) {
     120            type = "rtept";
    113121        } else {
    114122            fail("You need to add code to tell us what the exception for \"" + gpx + "\" should be");
Note: See TracChangeset for help on using the changeset viewer.