Ticket #22266: 22266.patch

File 22266.patch, 2.4 KB (added by taylor.smock, 3 years ago)
  • src/org/openstreetmap/josm/plugins/PluginHandler.java

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    diff --git a/src/org/openstreetmap/josm/plugins/PluginHandler.java b/src/org/openstreetmap/josm/plugins/PluginHandler.java
    a b  
    8080import org.openstreetmap.josm.tools.ResourceProvider;
    8181import org.openstreetmap.josm.tools.SubclassFilteredCollection;
    8282import org.openstreetmap.josm.tools.Utils;
     83import org.openstreetmap.josm.tools.bugreport.BugReport;
     84import org.openstreetmap.josm.tools.bugreport.ReportedException;
    8385
    8486/**
    8587 * PluginHandler is basically a collection of static utility functions used to bootstrap
     
    806808     */
    807809    private static void loadPlugin(Component parent, PluginInformation plugin, PluginClassLoader pluginClassLoader) {
    808810        String msg = tr("Could not load plugin {0}. Delete from preferences?", "'"+plugin.name+"'");
     811        Exception exception = null;
    809812        try {
    810813            Class<?> klass = plugin.loadClass(pluginClassLoader);
    811814            if (klass != null) {
     
    822825                msg = tr("<html>Could not load plugin {0} because the plugin<br>main class ''{1}'' was not found.<br>"
    823826                        + "Delete from preferences?</html>", "'"+Utils.escapeReservedCharactersHTML(plugin.name)+"'", plugin.className);
    824827            }
     828            exception = e;
    825829        } catch (RuntimeException e) { // NOPMD
    826830            pluginLoadingExceptions.put(plugin.name, e);
    827831            Logging.error(e);
     832            exception = e;
    828833        }
    829834        if (msg != null && confirmDisablePlugin(parent, msg, plugin.name)) {
    830835            PreferencesUtils.removeFromList(Config.getPref(), "plugins", plugin.name);
    831836        }
     837        if (exception != null) {
     838            ReportedException reportedException = BugReport.intercept(exception);
     839            reportedException.startSection("Failing plugin");
     840            reportedException.put("name", plugin.name);
     841            reportedException.put("localVersion", plugin.localversion);
     842            reportedException.put("version", plugin.version);
     843            reportedException.put("downloadlink", plugin.downloadlink);
     844            reportedException.warn();
     845        }
    832846    }
    833847
    834848    /**