Skip to content

Commit

Permalink
[JENKINS-19976] Touch-ups to PR #1054.
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Mar 24, 2014
1 parent df8df45 commit 56b360d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 19 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -63,6 +63,9 @@
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-22262">issue 22262</a>)
<li class=bug>
<code>identity.key</code>, used to secure some communications with Jenkins, now stored encrypted with the master key.
<li class=bug>
When dynamically loading a plugin which another loaded plugin already had an optional dependency on, class loading errors could result before restart.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19976">issue 19976</a>)
<li class=bug>
Memory leaks in the old data monitor.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-19544">issue 19544</a>)
Expand Down
9 changes: 0 additions & 9 deletions core/src/main/java/hudson/ClassicPluginStrategy.java
Expand Up @@ -377,15 +377,6 @@ public void startPlugin(PluginWrapper plugin) throws Exception {
plugin.getPlugin().start();
}

/**
* Called when a plugin is deployed, and there is a plugin optionally depending on that plugin.
* The class loader of the existing depending plugin should be updated
* to load classes from the newly deployed plugin.
*
* @param depender the plugin to update its class loader
* @param dependee
* @see hudson.PluginStrategy#updateDependency(hudson.PluginWrapper, hudson.PluginWrapper)
*/
@Override
public void updateDependency(PluginWrapper depender, PluginWrapper dependee) {
DependencyClassLoader classLoader = findAncestorDependencyClassLoader(depender.classLoader);
Expand Down
6 changes: 5 additions & 1 deletion core/src/main/java/hudson/PluginManager.java
Expand Up @@ -464,7 +464,11 @@ protected boolean filter(Method e) {
if (d.shortName.equals(p.getShortName())) {
// this plugin depends on the newly loaded one!
// recalculate dependencies!
getPluginStrategy().updateDependency(depender, p);
try {
getPluginStrategy().updateDependency(depender, p);
} catch (AbstractMethodError x) {
LOGGER.log(WARNING, "{0} does not yet implement updateDependency", getPluginStrategy().getClass());
}
break;
}
}
Expand Down
6 changes: 4 additions & 2 deletions core/src/main/java/hudson/PluginStrategy.java
Expand Up @@ -79,10 +79,12 @@ PluginWrapper createPluginWrapper(File archive)
<T> List<ExtensionComponent<T>> findComponents(Class<T> type, Hudson hudson);

/**
* Called when a plugin that is depended by another plugin is newly deployed.
*
* Called when a plugin is installed, but there was already a plugin installed which optionally depended on that plugin.
* The class loader of the existing depending plugin should be updated
* to load classes from the newly installed plugin.
* @param depender plugin depending on dependee.
* @param dependee newly loaded plugin.
* @since 1.557
*/
void updateDependency(PluginWrapper depender, PluginWrapper dependee);
}
15 changes: 8 additions & 7 deletions test/src/test/java/hudson/PluginManagerTest.java
Expand Up @@ -33,20 +33,20 @@
import hudson.scm.SubversionSCM;
import hudson.util.FormValidation;
import hudson.util.PersistedList;
import org.apache.commons.io.FileUtils;
import org.apache.tools.ant.filters.StringInputStream;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.Url;
import org.jvnet.hudson.test.recipes.WithPlugin;
import org.jvnet.hudson.test.recipes.WithPluginManager;

import java.io.File;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Future;
import org.apache.commons.io.FileUtils;
import org.apache.tools.ant.filters.StringInputStream;
import org.jvnet.hudson.test.Bug;
import org.jvnet.hudson.test.HudsonTestCase;
import org.jvnet.hudson.test.Url;
import org.jvnet.hudson.test.recipes.WithPlugin;
import org.jvnet.hudson.test.recipes.WithPluginManager;

/**
* @author Kohsuke Kawaguchi
Expand Down Expand Up @@ -310,6 +310,7 @@ public void testInstallDependingPluginWithoutRestart() throws Exception {
*
* @throws Exception
*/
@Bug(19976)
public void testInstallDependedPluginWithoutRestart() throws Exception {
// Load depender.
{
Expand Down

0 comments on commit 56b360d

Please sign in to comment.