Changeset 2270 in josm for trunk


Ignore:
Timestamp:
2009-10-10T21:52:00+02:00 (15 years ago)
Author:
stoecker
Message:

better check if errors are caused by plugins

File:
1 edited

Legend:

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

    r2267 r2270  
    256256             * Analyze the stack of the argument and find a name of a plugin, if
    257257             * some known problem pattern has been found.
    258              *
    259              * Note: This heuristic is not meant as discrimination against specific
    260              * plugins, but only to stop the flood of similar bug reports about plugins.
    261              * Of course, plugin writers are free to install their own version of
    262              * an exception handler with their email address listed to receive
    263              * bug reports ;-).
    264258             */
    265             for (StackTraceElement element : e.getStackTrace()) {
    266                 String c = element.getClassName();
    267 
    268                 if (c.contains("wmsplugin.") || c.contains(".WMSLayer")) {
    269                     name = "wmsplugin";
    270                 }
    271                 if (c.contains("livegps.")) {
    272                     name = "livegps";
    273                 }
    274                 if (c.startsWith("UtilsPlugin.")) {
    275                     name = "UtilsPlugin";
    276                 }
    277 
    278                 if (c.startsWith("org.openstreetmap.josm.plugins.")) {
    279                     String p = c.substring("org.openstreetmap.josm.plugins.".length());
    280                     if (p.indexOf('.') != -1 && p.matches("[a-z].*")) {
    281                         name = p.substring(0,p.indexOf('.'));
    282                     }
    283                 }
    284                 if(name != null) {
    285                     break;
    286                 }
    287             }
    288259            for (PluginProxy p : pluginList)
    289260            {
    290                 if (p.info.name.equals(name))
     261                String baseClass = p.info.className;
     262                int i = baseClass.lastIndexOf(".");
     263                baseClass = baseClass.substring(0, i);
     264                for (StackTraceElement element : e.getStackTrace())
    291265                {
    292                     plugin = p;
     266                    String c = element.getClassName();
     267                    if(c.startsWith(baseClass))
     268                    {
     269                        plugin = p;
     270                        break;
     271                    }
     272                }
     273                if(plugin != null)
    293274                    break;
    294                 }
    295275            }
    296276        }
Note: See TracChangeset for help on using the changeset viewer.