Changeset 35586 in osm


Ignore:
Timestamp:
2020-10-15T21:28:47+02:00 (6 days ago)
Author:
simon04
Message:

fix #19458 - Level0LParser: fix parsing of Unicode characters

Location:
applications/editors/josm/plugins/comfort0
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/comfort0/src/net/simon04/comfort0/level0l/Level0LParser.jj

    r35291 r35586  
    3333
    3434<COMMENT>
    35 SKIP: { < ~["\n", "\r"] > }
     35SKIP: { < ["\u0020"-"\uffff"] > }
    3636
    3737<COMMENT>
     
    4343TOKEN: {
    4444    <V_EOL: ("\n" | "\r" | "\r\n") > : DEFAULT
    45     | <TEXT: (~["\n", "\r"])+ >
     45    | <TEXT: (["\u0020"-"\uffff"])+ >
    4646}
    4747
  • applications/editors/josm/plugins/comfort0/test/data/example.osm

    r35282 r35586  
    2525    <!--...-->
    2626    <member type="node" ref="249673494" role=""/>
    27     <tag k="name" v="Küstenbus Linie 123"/>
     27    <tag k="name" v="Küstenbus Linie 123–124"/>
    2828    <tag k="network" v="VVW"/>
    2929    <tag k="operator" v="Regionalverkehr Küste"/>
  • applications/editors/josm/plugins/comfort0/test/unit/net/simon04/comfort0/OsmToLevel0LTest.java

    r35584 r35586  
    6161                    "  nd 261728686 #261728686 (54.0906309, 12.2441924)\n" +
    6262                    "\n" +
    63                     "relation 56688 #route (\"Küstenbus Linie 123\", 4 members, incomplete)\n" +
    64                     "  name = Küstenbus Linie 123\n" +
     63                    "relation 56688 #route (\"Küstenbus Linie 123–124\", 4 members, incomplete)\n" +
     64                    "  name = Küstenbus Linie 123–124\n" +
    6565                    "  network = VVW\n" +
    6666                    "  operator = Regionalverkehr Küste\n" +
  • applications/editors/josm/plugins/comfort0/test/unit/net/simon04/comfort0/level0l/parsergen/Level0LParserTest.java

    r35291 r35586  
    88import java.util.List;
    99
     10import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
     11import org.junit.Rule;
    1012import org.junit.Test;
    1113import org.openstreetmap.josm.data.osm.NodeData;
     
    1416import org.openstreetmap.josm.data.osm.RelationData;
    1517import org.openstreetmap.josm.data.osm.WayData;
     18import org.openstreetmap.josm.testutils.JOSMTestRules;
    1619
    1720public class Level0LParserTest {
     21
     22    /**
     23     * Setup rule
     24     */
     25    @Rule
     26    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     27    public JOSMTestRules test = new JOSMTestRules().preferences();
     28
    1829    @Test
    1930    public void testNode() throws Exception {
     
    5970                "  wy 4579143 forward\n" +
    6071                "  nd 249673494 stop # the end\n" +
    61                 "  name = Küstenbus Linie 123\n" +
     72                "  name = Küstenbus Linie 123–124\n" +
    6273                "  network = VVW\n" +
    6374                "  operator = Regionalverkehr Küste\n" +
     
    6778        final RelationData relation = new Level0LParser(new StringReader(level0l)).relation();
    6879        assertThat(relation.getId(), is(56688L));
     80        assertThat(relation.getName(), is("Küstenbus Linie 123–124"));
    6981        assertThat(relation.getMembersCount(), is(4));
    7082        assertThat(relation.getMembers().get(0).getMemberId(), is(294942404L));
Note: See TracChangeset for help on using the changeset viewer.