Changeset 9569 in josm


Ignore:
Timestamp:
2016-01-22T22:31:36+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #12393 - Fix parsing note hiding events (patch by ToeBee) + add non-regression unit test

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/notes/NoteComment.java

    r9067 r9569  
    2828        closed,
    2929        reopened,
    30         commented
     30        commented,
     31        hidden
    3132    }
    3233
  • trunk/src/org/openstreetmap/josm/io/NoteReader.java

    r9078 r9569  
    130130        @Override
    131131        public void endElement(String namespaceURI, String localName, String qName) {
    132             if ("note".equals(qName)) {
     132            if (notes != null && "note".equals(qName)) {
    133133                notes.add(thisNote);
    134134            }
  • trunk/test/unit/org/openstreetmap/josm/io/NoteReaderTest.java

    r8858 r9569  
    8383        assertEquals("", c2.getText());
    8484    }
     85
     86    /**
     87     * Non-regression test for bug #12393.
     88     * @throws Exception if an error occurs
     89     */
     90    @Test
     91    public void testTicket12393() throws Exception {
     92        // CHECKSTYLE.OFF: LineLength
     93        new NoteReader(
     94            "<note id=\"233775\" lat=\"48.2411985\" lon=\"-122.3744820\" created_at=\"2014-08-31T17:13:29Z\" closed_at=\"2015-09-06T23:35:14Z\">"+
     95            "<comment action=\"opened\" timestamp=\"2014-08-31T17:13:29Z\" uid=\"7247\" user=\"goldfndr\">Jump Start Espresso | 26930</comment>"+
     96            "<comment action=\"hidden\" timestamp=\"2015-09-06T23:34:26Z\" uid=\"355617\" user=\"pnorman\"></comment>"+
     97            "<comment action=\"reopened\" timestamp=\"2015-09-06T23:34:38Z\" uid=\"355617\" user=\"pnorman\"></comment>"+
     98            "<comment action=\"closed\" timestamp=\"2015-09-06T23:35:14Z\" uid=\"355617\" user=\"pnorman\">mapped, but inadvertently hid the note</comment>"+
     99            "</note>").parse();
     100        // CHECKSTYLE.ON: LineLength
     101    }
    85102}
Note: See TracChangeset for help on using the changeset viewer.