Changeset 11335 in josm for trunk/src/org


Ignore:
Timestamp:
2016-11-28T19:26:16+01:00 (3 years ago)
Author:
simon04
Message:

fix #13948 fix #14040 - UnsupportedOperationException in ValidatorTreePanel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/validator/ValidatorTreePanel.java

    r11321 r11335  
    437437        // Remove purged primitives (fix #8639)
    438438        if (errors != null) {
    439             for (TestError err : errors) {
    440                 try {
    441                     err.getPrimitives().removeAll(event.getPrimitives());
    442                 } catch (UnsupportedOperationException e) {
    443                     if (event.getPrimitives().containsAll(err.getPrimitives())) {
    444                         err.getPrimitives().clear();
    445                     } else {
    446                         Main.warn(e, "Unable to remove primitives from "+err+'.');
    447                     }
    448                 }
    449             }
     439            final Set<? extends OsmPrimitive> deletedPrimitives = new HashSet<>(event.getPrimitives());
     440            errors.removeIf(error -> error.getPrimitives().stream().anyMatch(deletedPrimitives::contains));
    450441        }
    451442    }
Note: See TracChangeset for help on using the changeset viewer.