Changeset 16296 in josm for trunk/src/org
- Timestamp:
- 2020-04-14T07:14:38+02:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/data/preferences/sources/ValidatorPrefHelper.java
r15211 r16296 47 47 /** The preferences key for the ignorelist */ 48 48 public static final String PREF_IGNORELIST = PREFIX + ".ignorelist"; 49 50 /** The preferences key for the ignorelist format */ 51 public static final String PREF_IGNORELIST_FORMAT = PREF_IGNORELIST + ".version"; 49 52 50 53 /** -
trunk/src/org/openstreetmap/josm/data/validation/OsmValidator.java
r16295 r16296 19 19 import java.util.Enumeration; 20 20 import java.util.HashMap; 21 import java.util.HashSet; 21 22 import java.util.Iterator; 22 23 import java.util.List; 23 24 import java.util.Map; 24 25 import java.util.Map.Entry; 26 import java.util.Set; 25 27 import java.util.SortedMap; 26 28 import java.util.TreeMap; … … 224 226 treeSet.addAll(Files.readAllLines(path, StandardCharsets.UTF_8)); 225 227 treeSet.forEach(ignore -> ignoredErrors.putIfAbsent(ignore, "")); 228 removeLegacyEntries(true); 226 229 227 230 saveIgnoredErrors(); … … 237 240 Logging.log(Logging.LEVEL_ERROR, "Unable to load ignored errors", e); 238 241 } 239 // see #19053: remove invalid entry 240 ignoredErrors.remove("3000"); 242 removeLegacyEntries(Config.getPref().get(ValidatorPrefHelper.PREF_IGNORELIST_FORMAT).isEmpty()); 243 } 244 } 245 246 private static void removeLegacyEntries(boolean force) { 247 // see #19053: 248 boolean wasChanged = false; 249 if (force) { 250 Iterator<Entry<String, String>> iter = ignoredErrors.entrySet().iterator(); 251 while (iter.hasNext()) { 252 Entry<String, String> entry = iter.next(); 253 if (entry.getKey().startsWith("3000_")) { 254 Logging.warn(tr("Cannot handle ignore list entry {0}", entry)); 255 iter.remove(); 256 wasChanged = true; 257 } 258 } 259 } 260 String legacyEntry = ignoredErrors.remove("3000"); 261 if (legacyEntry != null) { 262 if (!legacyEntry.isEmpty()) { 263 addIgnoredError("3000_" + legacyEntry, legacyEntry); 264 } 265 wasChanged = true; 266 } 267 if (wasChanged) { 268 saveIgnoredErrors(); 241 269 } 242 270 } … … 268 296 */ 269 297 static void cleanupIgnoredErrors() { 298 cleanup3000(); 270 299 if (ignoredErrors.size() > 1) { 271 300 List<String> toRemove = new ArrayList<>(); … … 289 318 ignoredErrors.putAll(tmap); 290 319 } 320 } 321 322 private static void cleanup3000() { 323 // see #19053 324 Set<String> toRemove = new HashSet<>(); 325 for (Entry<String, String> entry : ignoredErrors.entrySet()) { 326 if (entry.getKey().equals("3000_" + entry.getValue())) 327 toRemove.add(entry.getValue()); 328 } 329 ignoredErrors.entrySet() 330 .removeIf(e -> toRemove.contains(e.getValue()) && !e.getKey().equals("3000_" + e.getValue())); 331 291 332 } 292 333 … … 485 526 if (list.isEmpty()) list = null; 486 527 Config.getPref().putListOfMaps(ValidatorPrefHelper.PREF_IGNORELIST, list); 528 Config.getPref().put(ValidatorPrefHelper.PREF_IGNORELIST_FORMAT, "2"); 487 529 } 488 530 -
trunk/src/org/openstreetmap/josm/data/validation/TestError.java
r16178 r16296 339 339 */ 340 340 public String getIgnoreSubGroup() { 341 if (code == 3000) { 342 // see #19053 343 return "3000_" + (description == null ? message : description); 344 } 341 345 String ignorestring = getIgnoreGroup(); 342 346 if (descriptionEn != null) { … … 352 356 */ 353 357 public String getIgnoreGroup() { 358 if (code == 3000) { 359 // see #19053 360 return "3000_" + getMessage(); 361 } 354 362 return Integer.toString(code); 355 363 } … … 525 533 return "TestError [tester=" + tester + ", code=" + code + ", message=" + message + ']'; 526 534 } 535 527 536 } -
trunk/src/org/openstreetmap/josm/gui/dialogs/ValidatorDialog.java
r16247 r16296 411 411 lastSelectedNode = node; 412 412 if (node != null) { 413 final Set<String> codes = new HashSet<>();414 413 ValidatorTreePanel.visitTestErrors(node, error -> { 415 codes.add(error.getIgnoreSubGroup()); // see #19053416 414 error.setSelected(true); 417 415 … … 425 423 selectAction.setEnabled(true); 426 424 if (ignoreAction != null) { 427 ignoreAction.setEnabled(!(node.getUserObject() instanceof Severity) && codes.size() <= 1);425 ignoreAction.setEnabled(!(node.getUserObject() instanceof Severity)); 428 426 } 429 427 }
Note:
See TracChangeset
for help on using the changeset viewer.