- Timestamp:
- 2023-08-23T00:10:21+02:00 (15 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 = new ArrayDeque<>();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 {
Note:
See TracChangeset
for help on using the changeset viewer.