### Eclipse Workspace Patch 1.0
#P josm-2
Index: src/org/openstreetmap/josm/data/gpx/GpxExtensionCollection.java
===================================================================
--- src/org/openstreetmap/josm/data/gpx/GpxExtensionCollection.java	(revision 17921)
+++ src/org/openstreetmap/josm/data/gpx/GpxExtensionCollection.java	(working copy)
@@ -9,8 +9,8 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import org.apache.commons.jcs3.access.exception.InvalidArgumentException;
 import org.openstreetmap.josm.io.GpxReader;
+import org.openstreetmap.josm.tools.Logging;
 import org.xml.sax.Attributes;
 
 /**
@@ -60,20 +60,21 @@
 
     /**
      * Sets the value for the last child and pops it from the stack, so the next one will be added to its parent.
-     * The qualified name is verified.
+     * A warning is issued if the qualified name does not equal the currently opened child.
      * @param qName the qualified name
      * @param value the value
      */
     public void closeChild(String qName, String value) {
-        if (childStack == null || childStack.isEmpty())
-            throw new InvalidArgumentException("Can't close child " + qName + ", no element in stack.");
+        if (childStack == null || childStack.isEmpty()) {
+            Logging.warn("Can't close child \"" + qName + "\", no element in stack.");
+            return;
+		}
 
         GpxExtension child = childStack.pop();
-
         String childQN = child.getQualifiedName();
 
         if (!childQN.equals(qName))
-            throw new InvalidArgumentException("Can't close child " + qName + ", must close " + childQN + " first.");
+            Logging.warn("Couldn't close child \"" + qName + "\", closed \"" + childQN + "\" instead.");
 
         child.setValue(value);
     }
Index: src/org/openstreetmap/josm/io/GpxReader.java
===================================================================
--- src/org/openstreetmap/josm/io/GpxReader.java	(revision 17921)
+++ src/org/openstreetmap/josm/io/GpxReader.java	(working copy)
@@ -83,7 +83,7 @@
         private GpxExtensionCollection currentExtensionCollection;
         private GpxExtensionCollection currentTrackExtensionCollection;
         private Stack<State> states;
-        private final Stack<String> elements = new Stack<>();
+        private final Stack<String[]> elements = new Stack<>();
 
         private StringBuilder accumulator = new StringBuilder();
 
@@ -132,7 +132,7 @@
 
         @Override
         public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
-            elements.push(localName);
+            elements.push(new String[] { namespaceURI, localName, qName });
             switch(currentState) {
             case INIT:
                 states.push(currentState);
@@ -609,9 +609,10 @@
         }
 
         void tryToFinish() throws SAXException {
-            List<String> remainingElements = new ArrayList<>(elements);
+            List<String[]> remainingElements = new ArrayList<>(elements);
             for (int i = remainingElements.size() - 1; i >= 0; i--) {
-                endElement(null, remainingElements.get(i), remainingElements.get(i));
+                String[] e = remainingElements.get(i);
+                endElement(e[0], e[1], e[2]);
             }
             endDocument();
         }
