Commit fe5a56b0 authored by Derek DeMoro's avatar Derek DeMoro Committed by derek

Child plugins were not using the same plugin classloader, but were only...

Child plugins were not using the same plugin classloader, but were only initializing the classpath from the parent plugin, but not in the same instance.

git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/branches/jive_messenger_2_2_branch@2871 b35dd754-fafc-0310-a699-88a17e54d16e
parent 9a37d08b
......@@ -43,7 +43,7 @@ class PluginClassLoader {
* Constructs a plugin loader for the given plugin directory.
*
* @param pluginDir the plugin directory.
* @throws java.lang.SecurityException if the created class loader violates
* @throws SecurityException if the created class loader violates
* existing security constraints.
*/
public PluginClassLoader(File pluginDir) throws SecurityException {
......@@ -95,14 +95,22 @@ class PluginClassLoader {
* Initializes the class loader with all configured classpath URLs. This method
* can be called multiple times if the list of URLs changes.
*/
public void initialize(){
public void initialize() {
Iterator urls = list.iterator();
URL[] urlArray = new URL[list.size()];
for (int i = 0; urls.hasNext(); i++) {
urlArray[i] = (URL)urls.next();
}
// If the classloader is to be used by a child plugin, we should
// never use the ContextClassLoader, but only reuse the plugin classloader itself.
if (classLoader != null) {
classLoader = new URLClassLoader(urlArray, classLoader);
}
else {
classLoader = new URLClassLoader(urlArray, findParentClassLoader());
}
}
/**
* Load a class using this plugin class loader.
......
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