Do not log disabled plugins as loaded

The PluginLoader scans regularly for new plugins. If a plugin is found
and it wasn't active before it logs an info message saying that the
plugin was loaded. This info message was also logged if a disabled
plugin is found, although it didn't get active. This was confusing in
case of a disabled plugin.

Change-Id: Ifbd7df151abcdefa5001797b4f42a5368966058d
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2012-07-19 09:14:43 +02:00
parent 05d942c324
commit 2ec0dd34dd

View File

@@ -288,8 +288,8 @@ public class PluginLoader implements LifecycleListener {
}
try {
runPlugin(name, jar, active);
if (active == null) {
Plugin loadedPlugin = runPlugin(name, jar, active);
if (active == null && !loadedPlugin.isDisabled()) {
log.info(String.format("Loaded plugin %s", name));
}
} catch (PluginInstallException e) {
@@ -300,7 +300,7 @@ public class PluginLoader implements LifecycleListener {
cleanInBackground();
}
private void runPlugin(String name, File jar, Plugin oldPlugin)
private Plugin runPlugin(String name, File jar, Plugin oldPlugin)
throws PluginInstallException {
FileSnapshot snapshot = FileSnapshot.save(jar);
try {
@@ -327,6 +327,7 @@ public class PluginLoader implements LifecycleListener {
disabled.put(name, newPlugin);
}
broken.remove(name);
return newPlugin;
} catch (Throwable err) {
broken.put(name, snapshot);
throw new PluginInstallException(err);