Ticket #17837: 17837.patch
File 17837.patch, 1.8 KB (added by , 5 years ago) |
---|
-
src/org/openstreetmap/josm/data/validation/OsmValidator.java
267 267 List<String> toRemove = new ArrayList<>(); 268 268 269 269 Iterator<Entry<String, String>> iter = ignoredErrors.entrySet().iterator(); 270 Entry<String, String> last = iter.next();270 String lastKey = iter.next().getKey(); 271 271 while (iter.hasNext()) { 272 Entry<String, String> entry = iter.next();273 if ( entry.getKey().startsWith(last.getKey())) {274 toRemove.add( entry.getKey());272 String currKey = iter.next().getKey(); 273 if (currKey.startsWith(lastKey) && sameCode(currKey, lastKey)) { 274 toRemove.add(currKey); 275 275 } else { 276 last = entry;276 lastKey = currKey; 277 277 } 278 278 } 279 279 toRemove.forEach(ignoredErrors::remove); … … 286 286 } 287 287 } 288 288 289 private static boolean sameCode(String key1, String key2) { 290 return extractCodeFromIgnoreKey(key1).equals(extractCodeFromIgnoreKey(key2)); 291 } 292 293 private static String extractCodeFromIgnoreKey(String key) { 294 int lenCode = 0; 295 296 for (int i = 0; i < key.length(); i++) { 297 if (key.charAt(i) >= '0' && key.charAt(i) <= '9') { 298 lenCode++; 299 } else { 300 break; 301 } 302 } 303 return key.substring(0, lenCode); 304 } 305 289 306 /** 290 307 * Check if a error should be ignored 291 308 * @param s The ignore group / sub group name