Changeset 12924 in josm for trunk


Ignore:
Timestamp:
2017-10-04T19:04:14+02:00 (7 years ago)
Author:
bastiK
Message:

Bug handling: search the stack trace of nested exceptions when determining if a plugin is involved in the error

File:
1 edited

Legend:

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

    r12910 r12924  
    14201420    private static PluginProxy getPluginCausingException(Throwable ex) {
    14211421        PluginProxy err = null;
    1422         StackTraceElement[] stack = ex.getStackTrace();
     1422        List<StackTraceElement> stack = new ArrayList<>();
     1423        Throwable current = ex;
     1424        while (current != null) {
     1425            stack.addAll(Arrays.asList(current.getStackTrace()));
     1426            current = current.getCause();
     1427        }
     1428
    14231429        // remember the error position, as multiple plugins may be involved, we search the topmost one
    1424         int pos = stack.length;
     1430        int pos = stack.size();
    14251431        for (PluginProxy p : pluginList) {
    14261432            String baseClass = p.getPluginInformation().className;
    14271433            baseClass = baseClass.substring(0, baseClass.lastIndexOf('.'));
    14281434            for (int elpos = 0; elpos < pos; ++elpos) {
    1429                 if (stack[elpos].getClassName().startsWith(baseClass)) {
     1435                if (stack.get(elpos).getClassName().startsWith(baseClass)) {
    14301436                    pos = elpos;
    14311437                    err = p;
Note: See TracChangeset for help on using the changeset viewer.