Changeset 17984 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2021-07-10T22:04:32+02:00 (3 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/gpx/GpxExtensionCollection.java
r17846 r17984 10 10 import java.util.stream.Stream; 11 11 12 import org.apache.commons.jcs3.access.exception.InvalidArgumentException;13 12 import org.openstreetmap.josm.io.GpxReader; 13 import org.openstreetmap.josm.tools.Logging; 14 14 import org.xml.sax.Attributes; 15 15 … … 61 61 /** 62 62 * Sets the value for the last child and pops it from the stack, so the next one will be added to its parent. 63 * The qualified name is verified.63 * A warning is issued if the qualified name does not equal the currently opened child. 64 64 * @param qName the qualified name 65 65 * @param value the value 66 66 */ 67 67 public void closeChild(String qName, String value) { 68 if (childStack == null || childStack.isEmpty()) 69 throw new InvalidArgumentException("Can't close child " + qName + ", no element in stack."); 68 if (childStack == null || childStack.isEmpty()) { 69 Logging.warn("Can''t close child ''{0}'', no element in stack.", qName); 70 return; 71 } 70 72 71 73 GpxExtension child = childStack.pop(); 72 73 74 String childQN = child.getQualifiedName(); 74 75 75 76 if (!childQN.equals(qName)) 76 throw new InvalidArgumentException("Can't close child " + qName + ", must close " + childQN + " first.");77 Logging.warn("Couldn''t close child ''{0}'', closed ''{1}'' instead.", qName, childQN); 77 78 78 79 child.setValue(value); -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r17846 r17984 84 84 private GpxExtensionCollection currentTrackExtensionCollection; 85 85 private Stack<State> states; 86 private final Stack<String > elements = new Stack<>();86 private final Stack<String[]> elements = new Stack<>(); 87 87 88 88 private StringBuilder accumulator = new StringBuilder(); … … 133 133 @Override 134 134 public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { 135 elements.push( localName);135 elements.push(new String[] { namespaceURI, localName, qName }); 136 136 switch(currentState) { 137 137 case INIT: … … 610 610 611 611 void tryToFinish() throws SAXException { 612 List<String > remainingElements = new ArrayList<>(elements);612 List<String[]> remainingElements = new ArrayList<>(elements); 613 613 for (int i = remainingElements.size() - 1; i >= 0; i--) { 614 endElement(null, remainingElements.get(i), remainingElements.get(i)); 614 String[] e = remainingElements.get(i); 615 endElement(e[0], e[1], e[2]); 615 616 } 616 617 endDocument();
Note:
See TracChangeset
for help on using the changeset viewer.