Skip to content

Commit

Permalink
Resolve #292
Browse files Browse the repository at this point in the history
  • Loading branch information
decebals committed Mar 29, 2019
1 parent b808c2d commit 6f2f721
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
16 changes: 5 additions & 11 deletions pf4j/src/main/java/org/pf4j/AbstractPluginManager.java
Expand Up @@ -173,25 +173,19 @@ public PluginWrapper getPlugin(String pluginId) {
}

@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();
}

/**
Expand Down
5 changes: 3 additions & 2 deletions pf4j/src/main/java/org/pf4j/PluginManager.java
Expand Up @@ -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.
Expand Down

0 comments on commit 6f2f721

Please sign in to comment.