Changeset 14266 in josm


Ignore:
Timestamp:
2018-09-21T21:53:17+02:00 (6 years ago)
Author:
Don-vip
Message:

fix #16762 - support multiple notes in .osc files created by OsmAnd

Location:
trunk
Files:
3 edited

Legend:

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

    r14101 r14266  
    113113                case "comment":
    114114                    text = parser.getAttributeValue(null, "text");
     115                    jumpToEnd();
    115116                    break;
    116117                default:
  • trunk/src/org/openstreetmap/josm/io/OsmReader.java

    r14219 r14266  
    366366     * @throws XMLStreamException if there is an error processing the underlying XML source
    367367     */
    368     private void jumpToEnd(boolean printWarning) throws XMLStreamException {
     368    protected final void jumpToEnd(boolean printWarning) throws XMLStreamException {
    369369        while (true) {
    370370            int event = parser.next();
     
    376376    }
    377377
    378     private void jumpToEnd() throws XMLStreamException {
     378    protected final void jumpToEnd() throws XMLStreamException {
    379379        jumpToEnd(true);
    380380    }
  • trunk/test/unit/org/openstreetmap/josm/io/OsmChangeReaderTest.java

    r14101 r14266  
    88import java.nio.charset.StandardCharsets;
    99import java.util.Collection;
     10import java.util.Iterator;
    1011
    1112import org.junit.Rule;
     
    5960                "      <comment text=\"something\" />\r\n" +
    6061                "    </note>\r\n" +
     62                "    <note lat=\"50.5\" lon=\"13.5\" id=\"-3\">\r\n" +
     63                "      <comment text=\"something else\" />\r\n" +
     64                "    </note>\r\n" +
    6165                "  </create>\r\n" +
    6266                "  <modify />\r\n" +
    6367                "  <delete />").b;
    64         Collection<Note> notes = nd.getNotes();
    65         assertEquals(1, notes.size());
    66         Note n = notes.iterator().next();
     68        Collection<Note> notes = nd.getSortedNotes();
     69        assertEquals(2, notes.size());
     70        Iterator<Note> iterator = notes.iterator();
     71        Note n = iterator.next();
    6772        assertEquals(new LatLon(50.23887555404037, 13.358299552342795), n.getLatLon());
    6873        assertEquals("something", n.getFirstComment().getText());
     74        n = iterator.next();
     75        assertEquals(new LatLon(50.5, 13.5), n.getLatLon());
     76        assertEquals("something else", n.getFirstComment().getText());
    6977    }
    7078}
Note: See TracChangeset for help on using the changeset viewer.