Changeset 12925 in josm


Ignore:
Timestamp:
2017-10-04T23:39:08+02:00 (7 years ago)
Author:
bastiK
Message:

add safeguard for circular references leading to infinite loop (ref [12924])

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r12924 r12925  
    14211421        PluginProxy err = null;
    14221422        List<StackTraceElement> stack = new ArrayList<>();
     1423        Set<Throwable> seen = new HashSet<>();
    14231424        Throwable current = ex;
    14241425        while (current != null) {
     1426            seen.add(current);
    14251427            stack.addAll(Arrays.asList(current.getStackTrace()));
    1426             current = current.getCause();
     1428            Throwable cause = current.getCause();
     1429            if (cause != null && seen.contains(cause)) {
     1430                break; // circular refernce
     1431            }
     1432            current = cause;
    14271433        }
    14281434
Note: See TracChangeset for help on using the changeset viewer.