diff options
author | Decebal Suiu <decebal.suiu@gmail.com> | 2019-03-29 19:55:17 +0200 |
---|---|---|
committer | Decebal Suiu <decebal.suiu@gmail.com> | 2019-03-29 19:55:29 +0200 |
commit | 6f2f72195943ae2bd5dfcdc7cd6e1a54235257f0 (patch) | |
tree | 38885946a17dae45b43956b5b2cfa0d841afa5fd | |
parent | b808c2da4d1378b2adeb64320745752378ff21ac (diff) | |
download | pf4j-6f2f72195943ae2bd5dfcdc7cd6e1a54235257f0.tar.gz pf4j-6f2f72195943ae2bd5dfcdc7cd6e1a54235257f0.zip |
Resolve #292
-rw-r--r-- | pf4j/src/main/java/org/pf4j/AbstractPluginManager.java | 16 | ||||
-rw-r--r-- | pf4j/src/main/java/org/pf4j/PluginManager.java | 5 |
2 files changed, 8 insertions, 13 deletions
diff --git a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java index c17fdab..ba12eef 100644 --- a/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java +++ b/pf4j/src/main/java/org/pf4j/AbstractPluginManager.java @@ -173,25 +173,19 @@ public abstract class AbstractPluginManager implements PluginManager { } @Override - public String loadPlugin(Path pluginPath) { + public String loadPlugin(Path pluginPath) throws PluginException { if ((pluginPath == null) || Files.notExists(pluginPath)) { throw new IllegalArgumentException(String.format("Specified plugin %s does not exist!", pluginPath)); } log.debug("Loading plugin from '{}'", pluginPath); - try { - PluginWrapper pluginWrapper = loadPluginFromPath(pluginPath); + PluginWrapper pluginWrapper = loadPluginFromPath(pluginPath); - // try to resolve the loaded plugin together with other possible plugins that depend on this plugin - resolvePlugins(); + // try to resolve the loaded plugin together with other possible plugins that depend on this plugin + resolvePlugins(); - return pluginWrapper.getDescriptor().getPluginId(); - } catch (PluginException e) { - log.error(e.getMessage(), e); - } - - return null; + return pluginWrapper.getDescriptor().getPluginId(); } /** diff --git a/pf4j/src/main/java/org/pf4j/PluginManager.java b/pf4j/src/main/java/org/pf4j/PluginManager.java index 6bb6085..c2cbacc 100644 --- a/pf4j/src/main/java/org/pf4j/PluginManager.java +++ b/pf4j/src/main/java/org/pf4j/PluginManager.java @@ -70,9 +70,10 @@ public interface PluginManager { * * @param pluginPath the plugin location * @return the pluginId of the installed plugin as specified in - * its {@linkplain PluginDescriptor metadata}; or {@code null} + * its {@linkplain PluginDescriptor metadata} + * @throws PluginException if load of plugin fails */ - String loadPlugin(Path pluginPath); + String loadPlugin(Path pluginPath) throws PluginException; /** * Start all active plugins. |