From: James Moger Date: Fri, 4 Apr 2014 12:00:24 +0000 (-0400) Subject: Simplify changes per review X-Git-Tag: release-0.7.0~5^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F4%2Fhead;p=pf4j.git Simplify changes per review --- diff --git a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java index 1e33d2f..7254206 100644 --- a/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java +++ b/pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java @@ -16,7 +16,6 @@ import java.io.File; import java.io.FileFilter; import java.io.IOException; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.Iterator; @@ -273,18 +272,17 @@ public class DefaultPluginManager implements PluginManager { filterList.add(new NotFileFilter(createHiddenPluginFilter())); FileFilter pluginsFilter = new AndFileFilter(filterList); File[] directories = pluginsDirectory.listFiles(pluginsFilter); - List dirArray = new ArrayList(); - if (directories != null) { - dirArray.addAll(Arrays.asList(directories)); + if (directories == null) { + directories = new File[0]; } - log.debug("Found possible {} plugins: {}", dirArray.size(), dirArray); - if (dirArray.size() == 0) { + log.debug("Found possible {} plugins: {}", directories.length, directories); + if (directories.length == 0) { log.info("No plugins"); return; } // load any plugin from plugins directory - for (File directory : dirArray) { + for (File directory : directories) { try { loadPlugin(directory); } catch (PluginException e) { @@ -348,12 +346,12 @@ public class DefaultPluginManager implements PluginManager { PluginState state = stopPlugin(pluginId); if (PluginState.STOPPED != state) { - log.error(String.format("Failed to stop plugin %s on delete", pluginId)); + log.error("Failed to stop plugin {} on delete", pluginId); return false; } if (!unloadPlugin(pluginId)) { - log.error(String.format("Failed to unload plugin %s on delete", pluginId)); + log.error("Failed to unload plugin {} on delete", pluginId); return false; }