Changeset 18818 in josm
- Timestamp:
- 2023-08-23T00:10:21+02:00 (19 months ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/build.xml
r18727 r18818 188 188 <!-- Indicate that this jar may have version specific classes. Only used in Java9+. --> 189 189 <attribute name="Multi-Release" value="true"/> 190 <attribute name="Automatic-Module-Name" value="org.openstreetmap.josm"/> 190 191 </manifest> 191 192 </jar> -
trunk/src/org/openstreetmap/josm/io/GpxParser.java
r18817 r18818 18 18 19 19 import java.time.DateTimeException; 20 import java.util.ArrayDeque;21 20 import java.util.ArrayList; 22 21 import java.util.Collection; 23 import java.util.Deque;24 22 import java.util.HashMap; 25 23 import java.util.LinkedList; … … 27 25 import java.util.Map; 28 26 import java.util.Optional; 27 import java.util.Stack; 29 28 30 29 import org.openstreetmap.josm.data.Bounds; … … 77 76 private GpxExtensionCollection currentExtensionCollection; 78 77 private GpxExtensionCollection currentTrackExtensionCollection; 79 private Deque<State> states;80 private final Deque<String[]> elements = newArrayDeque<>();78 private final Stack<State> states = new Stack<>(); 79 private final Stack<String[]> elements = new Stack<>(); 81 80 82 81 private StringBuilder accumulator = new StringBuilder(); … … 87 86 public void startDocument() { 88 87 accumulator = new StringBuilder(); 89 states = new ArrayDeque<>();90 88 data = new GpxData(true); 91 89 currentExtensionCollection = new GpxExtensionCollection(); … … 402 400 */ 403 401 private void startElementExt(String namespaceURI, String qName, Attributes attributes) { 404 if (states. peekLast() == State.TRK) {402 if (states.lastElement() == State.TRK) { 405 403 currentTrackExtensionCollection.openChild(namespaceURI, qName, attributes); 406 404 } else { … … 651 649 convertUrlToLink(currentWayPoint.attr); 652 650 currentWayPoint.getExtensions().addAll(currentExtensionCollection); 653 if (!currentWayPoint.isLatLonKnown()) {654 currentExtensionCollection.clear();655 throw new SAXException(tr("{0} element does not have valid latitude and/or longitude.", "wpt"));656 }657 651 data.waypoints.add(currentWayPoint); 658 652 currentExtensionCollection.clear(); … … 723 717 } else if (currentExtensionCollection != null) { 724 718 String acc = accumulator.toString().trim(); 725 if (states. peekLast() == State.TRK) {719 if (states.lastElement() == State.TRK) { 726 720 currentTrackExtensionCollection.closeChild(qName, acc); //a segment inside the track can have an extension too 727 721 } else { -
trunk/test/unit/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelperTest.java
r17275 r18818 12 12 import java.util.stream.Collectors; 13 13 14 import org.junit.jupiter.api.extension.RegisterExtension;15 14 import org.junit.jupiter.api.Test; 16 15 import org.openstreetmap.josm.TestUtils; … … 19 18 import org.openstreetmap.josm.gui.layer.gpx.GpxDrawHelper.ColorMode; 20 19 import org.openstreetmap.josm.io.GpxReaderTest; 21 import org.openstreetmap.josm.testutils. JOSMTestRules;20 import org.openstreetmap.josm.testutils.annotations.BasicPreferences; 22 21 import org.openstreetmap.josm.tools.ColorHelper; 23 22 import org.xml.sax.SAXException; 24 25 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;26 23 27 24 /** 28 25 * Unit tests of {@link GpxDrawHelper} class. 29 26 */ 27 @BasicPreferences 30 28 class GpxDrawHelperTest { 31 32 /**33 * Setup test.34 */35 @RegisterExtension36 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")37 public JOSMTestRules test = new JOSMTestRules();38 29 39 30 /** -
trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java
r18817 r18818 104 104 105 105 @ParameterizedTest 106 @ValueSource(strings = { 107 "<gpx><wpt></wpt></gpx>", 108 }) 106 @ValueSource(strings = "<gpx><wpt></wpt></gpx>") 109 107 void testIncompleteLocations(String gpx) { 110 108 SAXException saxException = assertThrows(SAXException.class,
Note:
See TracChangeset
for help on using the changeset viewer.