Ignore:
Timestamp:
2015-10-11T15:28:33+02:00 (9 years ago)
Author:
Don-vip
Message:

fix #11957 - partial revert of r8851 - do not replace Stack by ArrayDeque because of different iteration behaviour + add unit test

Location:
trunk/src/org/openstreetmap/josm/io
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/io/GpxReader.java

    r8851 r8856  
    77import java.io.InputStream;
    88import java.io.Reader;
    9 import java.util.ArrayDeque;
    109import java.util.ArrayList;
    1110import java.util.Collection;
    12 import java.util.Deque;
    1311import java.util.HashMap;
    1412import java.util.LinkedList;
    1513import java.util.List;
    1614import java.util.Map;
     15import java.util.Stack;
    1716
    1817import javax.xml.parsers.ParserConfigurationException;
     
    6564        private GpxLink currentLink;
    6665        private Extensions currentExtensions;
    67         private Deque<State> states;
    68         private final Deque<String> elements = new ArrayDeque<>();
     66        private Stack<State> states;
     67        private final Stack<String> elements = new Stack<>();
    6968
    7069        private StringBuilder accumulator = new StringBuilder();
     
    7574        public void startDocument() {
    7675            accumulator = new StringBuilder();
    77             states = new ArrayDeque<>();
     76            states = new Stack<>();
    7877            data = new GpxData();
    7978        }
     
    477476        @Override
    478477        public void endDocument() throws SAXException  {
    479             if (!states.isEmpty())
     478            if (!states.empty())
    480479                throw new SAXException(tr("Parse error: invalid document structure for GPX document."));
    481480            Extensions metaExt = (Extensions) data.get(META_EXTENSIONS);
  • trunk/src/org/openstreetmap/josm/io/imagery/ImageryReader.java

    r8851 r8856  
    44import java.io.IOException;
    55import java.io.InputStream;
    6 import java.util.ArrayDeque;
    76import java.util.ArrayList;
    87import java.util.Arrays;
    9 import java.util.Deque;
    108import java.util.HashMap;
    119import java.util.List;
    1210import java.util.Map;
    1311import java.util.Objects;
     12import java.util.Stack;
    1413
    1514import javax.xml.parsers.ParserConfigurationException;
     
    7372        private StringBuilder accumulator = new StringBuilder();
    7473
    75         private Deque<State> states;
     74        private Stack<State> states;
    7675
    7776        private List<ImageryInfo> entries;
     
    9695            accumulator = new StringBuilder();
    9796            skipEntry = false;
    98             states = new ArrayDeque<>();
     97            states = new Stack<>();
    9998            states.push(State.INIT);
    10099            entries = new ArrayList<>();
Note: See TracChangeset for help on using the changeset viewer.