Changeset 19671 in josm for trunk/src


Ignore:
Timestamp:
2026-11-01T20:49:00+01:00 (6 days ago)
Author:
gaben
Message:

fix #22878 - ConcurrentModificationException in MapCSSTagChecker when the rules are reloaded during validation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/validation/tests/MapCSSTagChecker.java

    r19629 r19671  
    405405     */
    406406    void visit(Collection<OsmPrimitive> selection, Predicate<String> urlPredicate) {
     407        // the rules may be reloaded by another thread (preferences, file watcher) while the validation is running, see #22878
     408        final List<Entry<String, Set<MapCSSTagCheckerRule>>> checksToRun;
     409        synchronized (this) {
     410            checksToRun = new ArrayList<>(checks.entrySet());
     411        }
    407412        if (urlPredicate == null && progressMonitor != null) {
    408             progressMonitor.setTicksCount(selection.size() * checks.size());
     413            progressMonitor.setTicksCount(selection.size() * checksToRun.size());
    409414        }
    410415
    … …  
    414419
    415420        Set<OsmPrimitive> surrounding = new HashSet<>();
    416         for (Entry<String, Set<MapCSSTagCheckerRule>> entry : checks.entrySet()) {
     421        for (Entry<String, Set<MapCSSTagCheckerRule>> entry : checksToRun) {
    417422            if (isCanceled()) {
    418423                break;
Note: See TracChangeset for help on using the changeset viewer.