Changeset 5987 in josm for trunk/src


Ignore:
Timestamp:
2013-06-05T00:21:02+02:00 (11 years ago)
Author:
Don-vip
Message:

Better error messages when loading plugins

Location:
trunk/src/org/openstreetmap/josm/plugins
Files:
2 edited

Legend:

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

    r5957 r5987  
    113113            out = new FileOutputStream(new File(pluginDirName, to));
    114114            in = getClass().getResourceAsStream(from);
     115            if (in == null) {
     116                throw new IOException("Resource not found: "+from);
     117            }
    115118            byte[] buffer = new byte[8192];
    116119            for(int len = in.read(buffer); len > 0; len = in.read(buffer)) {
  • trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java

    r5978 r5987  
    424424            return false;
    425425        }
    426 
    427         return checkRequiredPluginsPreconditions(parent, plugins, plugin, true);
     426       
     427        // Add all plugins already loaded (to include early plugins when checking late ones)
     428        Collection<PluginInformation> allPlugins = new HashSet<PluginInformation>(plugins);
     429        for (PluginProxy proxy : pluginList) {
     430            allPlugins.add(proxy.getPluginInformation());
     431        }
     432
     433        return checkRequiredPluginsPreconditions(parent, allPlugins, plugin, true);
    428434    }
    429435
     
    513519            msg = null;
    514520        } catch (PluginException e) {
    515             System.err.print(e.getMessage());
     521            System.err.println(e.getMessage());
    516522            Throwable cause = e.getCause();
    517523            if (cause != null) {
    518                 System.err.print(". " + cause.getClass().getName() + ": " + cause.getLocalizedMessage());
    519             }
    520             System.err.println();
     524                msg = cause.getLocalizedMessage();
     525                if (msg != null) {
     526                    System.err.println("Cause: " + cause.getClass().getName()+": " + msg);
     527                } else {
     528                    cause.printStackTrace();
     529                }
     530            }
    521531            if (e.getCause() instanceof ClassNotFoundException) {
    522532                msg = tr("<html>Could not load plugin {0} because the plugin<br>main class ''{1}'' was not found.<br>"
Note: See TracChangeset for help on using the changeset viewer.