IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/data/validation/OsmValidator.java b/src/org/openstreetmap/josm/data/validation/OsmValidator.java
|
a
|
b
|
|
| 246 | 246 | |
| 247 | 247 | private static void removeLegacyEntries(boolean force) { |
| 248 | 248 | // see #19053: |
| | 249 | boolean wasChanged = removeLegacyEntry(force, true, "3000"); |
| | 250 | // see #18230 (pt_assistant, RightAngleBuildingTest) |
| | 251 | wasChanged |= removeLegacyEntry(force, false, "3701"); |
| | 252 | |
| | 253 | if (wasChanged) { |
| | 254 | saveIgnoredErrors(); |
| | 255 | } |
| | 256 | } |
| | 257 | |
| | 258 | private static boolean removeLegacyEntry(boolean force, boolean keep, String prefix) { |
| 249 | 259 | boolean wasChanged = false; |
| 250 | 260 | if (force) { |
| 251 | 261 | Iterator<Entry<String, String>> iter = ignoredErrors.entrySet().iterator(); |
| 252 | 262 | while (iter.hasNext()) { |
| 253 | 263 | Entry<String, String> entry = iter.next(); |
| 254 | | if (entry.getKey().startsWith("3000_")) { |
| | 264 | if (entry.getKey().startsWith(prefix + "_")) { |
| 255 | 265 | Logging.warn(tr("Cannot handle ignore list entry {0}", entry)); |
| 256 | 266 | iter.remove(); |
| 257 | 267 | wasChanged = true; |
| 258 | 268 | } |
| 259 | 269 | } |
| 260 | 270 | } |
| 261 | | String legacyEntry = ignoredErrors.remove("3000"); |
| 262 | | if (legacyEntry != null) { |
| | 271 | String legacyEntry = ignoredErrors.remove(prefix); |
| | 272 | if (keep && legacyEntry != null) { |
| 263 | 273 | if (!legacyEntry.isEmpty()) { |
| 264 | | addIgnoredError("3000_" + legacyEntry, legacyEntry); |
| | 274 | addIgnoredError(prefix + "_" + legacyEntry, legacyEntry); |
| 265 | 275 | } |
| 266 | 276 | wasChanged = true; |
| 267 | 277 | } |
| 268 | | if (wasChanged) { |
| 269 | | saveIgnoredErrors(); |
| 270 | | } |
| | 278 | return wasChanged; |
| 271 | 279 | } |
| 272 | 280 | |
| 273 | 281 | /** |
| … |
… |
|
| 502 | 510 | List<Map<String, String>> list = new ArrayList<>(); |
| 503 | 511 | cleanupIgnoredErrors(); |
| 504 | 512 | ignoredErrors.remove("3000"); // see #19053 |
| | 513 | ignoredErrors.remove("3701"); // see #18230 |
| 505 | 514 | list.add(ignoredErrors); |
| 506 | 515 | int i = 0; |
| 507 | 516 | while (i < list.size()) { |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/data/validation/TestError.java b/src/org/openstreetmap/josm/data/validation/TestError.java
|
a
|
b
|
|
| 4 | 4 | import java.awt.geom.Area; |
| 5 | 5 | import java.awt.geom.PathIterator; |
| 6 | 6 | import java.text.MessageFormat; |
| | 7 | import java.time.Instant; |
| 7 | 8 | import java.util.ArrayList; |
| 8 | 9 | import java.util.Arrays; |
| 9 | 10 | import java.util.Collection; |
| 10 | 11 | import java.util.Collections; |
| 11 | 12 | import java.util.List; |
| 12 | 13 | import java.util.Locale; |
| | 14 | import java.util.Map; |
| 13 | 15 | import java.util.TreeSet; |
| 14 | 16 | import java.util.function.Supplier; |
| 15 | 17 | import java.util.stream.Collectors; |
| … |
… |
|
| 33 | 35 | * @since 3669 |
| 34 | 36 | */ |
| 35 | 37 | public class TestError implements Comparable<TestError> { |
| | 38 | /** |
| | 39 | * Used to switch users over to new ignore system, UNIQUE_CODE_MESSAGE_STATE |
| | 40 | * 1_704_067_200L -> 2024-01-01 |
| | 41 | * We can probably remove this and the supporting code in 2025. |
| | 42 | */ |
| | 43 | private static final boolean SWITCH_OVER = Instant.now().isAfter(Instant.ofEpochMilli(1_704_067_200L)); |
| 36 | 44 | /** is this error on the ignore list */ |
| 37 | 45 | private boolean ignored; |
| 38 | 46 | /** Severity */ |
| … |
… |
|
| 50 | 58 | private final Test tester; |
| 51 | 59 | /** Internal code used by testers to classify errors */ |
| 52 | 60 | private final int code; |
| | 61 | /** Internal code used by testers to classify errors. Used for moving between JOSM versions. */ |
| | 62 | private final int uniqueCode; |
| 53 | 63 | /** If this error is selected */ |
| 54 | 64 | private boolean selected; |
| 55 | 65 | /** Supplying a command to fix the error */ |
| … |
… |
|
| 63 | 73 | private final Test tester; |
| 64 | 74 | private final Severity severity; |
| 65 | 75 | private final int code; |
| | 76 | private final int uniqueCode; |
| 66 | 77 | private String message; |
| 67 | 78 | private String description; |
| 68 | 79 | private String descriptionEn; |
| … |
… |
|
| 74 | 85 | this.tester = tester; |
| 75 | 86 | this.severity = severity; |
| 76 | 87 | this.code = code; |
| | 88 | this.uniqueCode = this.tester.getClass().getName().hashCode(); |
| 77 | 89 | } |
| 78 | 90 | |
| 79 | 91 | /** |
| … |
… |
|
| 254 | 266 | this.primitives = builder.primitives; |
| 255 | 267 | this.highlighted = builder.highlighted; |
| 256 | 268 | this.code = builder.code; |
| | 269 | this.uniqueCode = builder.uniqueCode; |
| 257 | 270 | this.fixingCommand = builder.fixingCommand; |
| 258 | 271 | } |
| 259 | 272 | |
| … |
… |
|
| 306 | 319 | * @return the ignore state for this error or null if any primitive is new |
| 307 | 320 | */ |
| 308 | 321 | public String getIgnoreState() { |
| | 322 | return getIgnoreState(false); |
| | 323 | } |
| | 324 | private String getIgnoreState(boolean useOriginal) { |
| 309 | 325 | Collection<String> strings = new TreeSet<>(); |
| 310 | 326 | for (OsmPrimitive o : primitives) { |
| 311 | 327 | // ignore data not yet uploaded |
| … |
… |
|
| 321 | 337 | } |
| 322 | 338 | strings.add(type + '_' + o.getId()); |
| 323 | 339 | } |
| 324 | | return strings.stream().map(o -> ':' + o).collect(Collectors.joining("", getIgnoreSubGroup(), "")); |
| | 340 | return strings.stream().map(o -> ':' + o).collect(Collectors.joining("", getIgnoreSubGroup(useOriginal), "")); |
| 325 | 341 | } |
| 326 | 342 | |
| 327 | 343 | /** |
| … |
… |
|
| 335 | 351 | } |
| 336 | 352 | |
| 337 | 353 | private boolean calcIgnored() { |
| | 354 | // Begin code removal section (backwards compatibility) |
| | 355 | if (OsmValidator.hasIgnoredError(getIgnoreGroup(true))) { |
| | 356 | updateIgnoreList(getIgnoreGroup(true), getIgnoreGroup(false)); |
| | 357 | return true; |
| | 358 | } |
| | 359 | if (OsmValidator.hasIgnoredError(getIgnoreSubGroup(true))) { |
| | 360 | updateIgnoreList(getIgnoreSubGroup(true), getIgnoreSubGroup(false)); |
| | 361 | return true; |
| | 362 | } |
| | 363 | String oldState = getIgnoreState(true); |
| | 364 | String state = getIgnoreState(false); |
| | 365 | if (oldState != null && OsmValidator.hasIgnoredError(oldState)) { |
| | 366 | updateIgnoreList(oldState, state); |
| | 367 | return true; |
| | 368 | } |
| | 369 | // End code removal section |
| 338 | 370 | if (OsmValidator.hasIgnoredError(getIgnoreGroup())) |
| 339 | 371 | return true; |
| 340 | 372 | if (OsmValidator.hasIgnoredError(getIgnoreSubGroup())) |
| 341 | 373 | return true; |
| 342 | | String state = getIgnoreState(); |
| 343 | 374 | return state != null && OsmValidator.hasIgnoredError(state); |
| 344 | 375 | } |
| 345 | 376 | |
| | 377 | /** |
| | 378 | * Convert old keys to new keys. Only takes effect when {@link #SWITCH_OVER} is true |
| | 379 | * @param oldKey The key to replace |
| | 380 | * @param newKey The new key |
| | 381 | */ |
| | 382 | private static void updateIgnoreList(String oldKey, String newKey) { |
| | 383 | if (SWITCH_OVER) { |
| | 384 | Map<String, String> errors = OsmValidator.getIgnoredErrors(); |
| | 385 | if (errors.containsKey(oldKey)) { |
| | 386 | String value = errors.remove(oldKey); |
| | 387 | errors.put(newKey, value); |
| | 388 | } |
| | 389 | } |
| | 390 | } |
| | 391 | |
| 346 | 392 | /** |
| 347 | 393 | * Gets the ignores subgroup that is more specialized than {@link #getIgnoreGroup()} |
| 348 | 394 | * @return The ignore sub group |
| 349 | 395 | */ |
| 350 | 396 | public String getIgnoreSubGroup() { |
| | 397 | return getIgnoreSubGroup(false); |
| | 398 | } |
| | 399 | |
| | 400 | private String getIgnoreSubGroup(boolean useOriginal) { |
| 351 | 401 | if (code == 3000) { |
| 352 | 402 | // see #19053 |
| 353 | 403 | return "3000_" + (description == null ? message : description); |
| 354 | 404 | } |
| 355 | | String ignorestring = getIgnoreGroup(); |
| | 405 | String ignorestring = getIgnoreGroup(useOriginal); |
| 356 | 406 | if (descriptionEn != null) { |
| 357 | 407 | ignorestring += '_' + descriptionEn; |
| 358 | 408 | } |
| … |
… |
|
| 365 | 415 | * @see TestError#getIgnoreSubGroup() |
| 366 | 416 | */ |
| 367 | 417 | public String getIgnoreGroup() { |
| | 418 | return getIgnoreGroup(false); |
| | 419 | } |
| | 420 | |
| | 421 | private String getIgnoreGroup(boolean useOriginal) { |
| 368 | 422 | if (code == 3000) { |
| 369 | 423 | // see #19053 |
| 370 | 424 | return "3000_" + getMessage(); |
| 371 | 425 | } |
| 372 | | return Integer.toString(code); |
| | 426 | if (useOriginal) { |
| | 427 | return Integer.toString(this.code); |
| | 428 | } |
| | 429 | return this.uniqueCode + "_" + this.code; |
| 373 | 430 | } |
| 374 | 431 | |
| 375 | 432 | /** |
| … |
… |
|
| 404 | 461 | return code; |
| 405 | 462 | } |
| 406 | 463 | |
| | 464 | /** |
| | 465 | * Get the unique code for this test. Used for ignore lists. |
| | 466 | * @return The unique code (generated with {@code tester.getClass().getName().hashCode() + code}). |
| | 467 | * @since xxx |
| | 468 | */ |
| | 469 | public int getUniqueCode() { |
| | 470 | return this.uniqueCode; |
| | 471 | } |
| | 472 | |
| 407 | 473 | /** |
| 408 | 474 | * Returns true if the error can be fixed automatically |
| 409 | 475 | * |
| … |
… |
|
| 546 | 612 | * @return true if two errors are similar |
| 547 | 613 | */ |
| 548 | 614 | public boolean isSimilar(TestError other) { |
| 549 | | return getCode() == other.getCode() |
| | 615 | return getUniqueCode() == other.getUniqueCode() |
| | 616 | && getCode() == other.getCode() |
| 550 | 617 | && getMessage().equals(other.getMessage()) |
| 551 | 618 | && getPrimitives().size() == other.getPrimitives().size() |
| 552 | 619 | && getPrimitives().containsAll(other.getPrimitives()) |
| … |
… |
|
| 570 | 637 | |
| 571 | 638 | @Override |
| 572 | 639 | public String toString() { |
| 573 | | return "TestError [tester=" + tester + ", code=" + code + ", message=" + message + ']'; |
| | 640 | return "TestError [tester=" + tester + ", unique code=" + this.uniqueCode + |
| | 641 | ", code=" + code + ", message=" + message + ']'; |
| 574 | 642 | } |
| 575 | 643 | |
| 576 | 644 | } |
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
diff --git a/src/org/openstreetmap/josm/io/GeoJSONMapRouletteWriter.java b/src/org/openstreetmap/josm/io/GeoJSONMapRouletteWriter.java
|
a
|
b
|
|
| 45 | 45 | final JsonObjectBuilder propertiesBuilder = Json.createObjectBuilder(); |
| 46 | 46 | propertiesBuilder.add("message", testError.getMessage()); |
| 47 | 47 | Optional.ofNullable(testError.getDescription()).ifPresent(description -> propertiesBuilder.add("description", description)); |
| 48 | | propertiesBuilder.add("code", testError.getCode()); |
| | 48 | propertiesBuilder.add("code", testError.getUniqueCode()); |
| 49 | 49 | propertiesBuilder.add("fixable", testError.isFixable()); |
| 50 | 50 | propertiesBuilder.add("severity", testError.getSeverity().toString()); |
| 51 | 51 | propertiesBuilder.add("severityInteger", testError.getSeverity().getLevel()); |