diff options
author | James Moger <james.moger@gitblit.com> | 2014-04-04 08:00:24 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2014-04-04 08:00:24 -0400 |
commit | c2fe1da41260a4a1b4390eb9591995d2069a7f00 (patch) | |
tree | 1b627c225e6b9c8af28d13faebcd83651995a87a /pf4j | |
parent | c867d45898a99a843cb955563638b5fac18bc4f5 (diff) | |
download | pf4j-c2fe1da41260a4a1b4390eb9591995d2069a7f00.tar.gz pf4j-c2fe1da41260a4a1b4390eb9591995d2069a7f00.zip |
Simplify changes per review
Diffstat (limited to 'pf4j')
-rw-r--r-- | pf4j/src/main/java/ro/fortsoft/pf4j/DefaultPluginManager.java | 16 |
1 files changed, 7 insertions, 9 deletions
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<File> dirArray = new ArrayList<File>();
- 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;
}
|