Ticket #24368: 24368.patch
| File 24368.patch, 3.0 KB (added by , 11 months ago) |
|---|
-
src/org/openstreetmap/josm/data/validation/tests/ConnectivityRelations.java
169 169 break; 170 170 } 171 171 } 172 172 173 // Lane count from member tags 173 174 for (RelationMember rM : relation.getMembers()) { 174 175 // Check lanes … … 179 180 List<Long> laneCounts = new ArrayList<>(); 180 181 long maxLaneCount; 181 182 if (prim.hasTag("lanes")) { 182 laneCounts.add(Long.parseLong(prim.get("lanes"))); 183 try { 184 laneCounts.add(Long.parseLong(prim.get("lanes"))); 185 } catch (NumberFormatException e) { 186 return Collections.emptyMap(); 187 } 183 188 } 184 189 for (Entry<String, String> entry : primKeys.entrySet()) { 185 190 String thisKey = entry.getKey(); -
test/unit/org/openstreetmap/josm/data/validation/tests/ConnectivityRelationsTest.java
2 2 package org.openstreetmap.josm.data.validation.tests; 3 3 4 4 import static org.junit.jupiter.api.Assertions.assertEquals; 5 import static org.junit.jupiter.api.Assertions.assertTrue; 5 6 6 7 import org.junit.jupiter.api.BeforeEach; 7 8 import org.junit.jupiter.api.Test; … … 8 9 import org.openstreetmap.josm.TestUtils; 9 10 import org.openstreetmap.josm.data.coor.LatLon; 10 11 import org.openstreetmap.josm.data.osm.Node; 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; 11 13 import org.openstreetmap.josm.data.osm.Relation; 12 14 import org.openstreetmap.josm.data.osm.RelationMember; 13 15 … … 99 101 check.visit(relation); 100 102 assertEquals(++expectedFailures, check.getErrors().size()); 101 103 } 104 105 /** 106 * Non-regression test for <a href="https://josm.openstreetmap.de/ticket/201821">Bug #20182</a>. 107 */ 108 @Test 109 void testTicket24368() { 110 Relation relation = createDefaultTestRelation(); 111 check.visit(relation); 112 113 assertEquals(0, check.getErrors().size()); 114 115 // change lanes for one way to an invalid value as reported in the ticket 116 boolean changed = false; 117 for (OsmPrimitive m : relation.getChildren()) { 118 if ("4".equals(m.get("lanes"))) { 119 m.put("lanes", "25 mph"); 120 changed = true; 121 break; 122 } 123 } 124 assertTrue(changed); 125 check.visit(relation); 126 assertEquals(0, check.getErrors().size()); 127 128 } 102 129 }
