Commit 9d7f619e authored by Gaston Dombiak's avatar Gaston Dombiak Committed by gato

Delete plugin folders of jar files that no longer exist.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8772 b35dd754-fafc-0310-a699-88a17e54d16e
parent f9f9abaa
...@@ -524,45 +524,44 @@ public class PluginManager { ...@@ -524,45 +524,44 @@ public class PluginManager {
Log.debug("Unloading plugin " + pluginName); Log.debug("Unloading plugin " + pluginName);
Plugin plugin = plugins.get(pluginName); Plugin plugin = plugins.get(pluginName);
if (plugin == null) { if (plugin != null) {
return; // Remove from dev mode if it exists.
} pluginDevelopment.remove(plugin);
// Remove from dev mode if it exists. // See if any child plugins are defined.
pluginDevelopment.remove(plugin); if (parentPluginMap.containsKey(plugin)) {
for (String childPlugin : parentPluginMap.get(plugin)) {
Log.debug("Unloading child plugin: " + childPlugin);
unloadPlugin(childPlugin);
}
parentPluginMap.remove(plugin);
}
// See if any child plugins are defined. File webXML = new File(pluginDirectory, pluginName + File.separator + "web" + File.separator + "WEB-INF" +
if (parentPluginMap.containsKey(plugin)) { File.separator + "web.xml");
for (String childPlugin : parentPluginMap.get(plugin)) { if (webXML.exists()) {
Log.debug("Unloading child plugin: " + childPlugin); AdminConsole.removeModel(pluginName);
unloadPlugin(childPlugin); PluginServlet.unregisterServlets(webXML);
}
File customWebXML = new File(pluginDirectory, pluginName + File.separator + "web" + File.separator + "WEB-INF" +
File.separator + "web-custom.xml");
if (customWebXML.exists()) {
PluginServlet.unregisterServlets(customWebXML);
} }
parentPluginMap.remove(plugin);
}
File webXML = new File(pluginDirectory, pluginName + File.separator + "web" + File.separator + "WEB-INF" + // Wrap destroying the plugin in a try/catch block. Otherwise, an exception raised
File.separator + "web.xml"); // in the destroy plugin process will disrupt the whole unloading process. It's still
if (webXML.exists()) { // possible that classloader destruction won't work in the case that destroying the plugin
AdminConsole.removeModel(pluginName); // fails. In that case, Openfire may need to be restarted to fully cleanup the plugin
PluginServlet.unregisterServlets(webXML); // resources.
} try {
File customWebXML = new File(pluginDirectory, pluginName + File.separator + "web" + File.separator + "WEB-INF" + plugin.destroyPlugin();
File.separator + "web-custom.xml"); }
if (customWebXML.exists()) { catch (Exception e) {
PluginServlet.unregisterServlets(customWebXML); Log.error(e);
}
} }
// Wrap destroying the plugin in a try/catch block. Otherwise, an exception raised
// in the destroy plugin process will disrupt the whole unloading process. It's still
// possible that classloader destruction won't work in the case that destroying the plugin
// fails. In that case, Openfire may need to be restarted to fully cleanup the plugin
// resources.
try {
plugin.destroyPlugin();
}
catch (Exception e) {
Log.error(e);
}
// Try to remove the folder where the plugin was exploded. If this works then // Try to remove the folder where the plugin was exploded. If this works then
// the plugin was successfully removed. Otherwise, some objects created by the // the plugin was successfully removed. Otherwise, some objects created by the
// plugin are still in memory. // plugin are still in memory.
...@@ -584,7 +583,7 @@ public class PluginManager { ...@@ -584,7 +583,7 @@ public class PluginManager {
Log.error(e); Log.error(e);
} }
if (!dir.exists()) { if (plugin != null && !dir.exists()) {
plugins.remove(pluginName); plugins.remove(pluginName);
pluginDirs.remove(plugin); pluginDirs.remove(plugin);
classloaders.remove(plugin); classloaders.remove(plugin);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment