mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-11 11:06:25 +00:00
[FIXED JENKINS-12753] Added PluginStrategy.getShortName to avoid actually trying to unpack a plugin before throwing RestartRequiredException.
This commit is contained in:
1 parent
9062a944b7
commit
7f856b5608
6 files changed
+78
-15
No files matched your search
@@ -412,11 +412,21 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
*/
|
||||
public void dynamicLoad(File arc) throws IOException, InterruptedException, RestartRequiredException {
|
||||
LOGGER.info("Attempting to dynamic load "+arc);
|
||||
final PluginWrapper p = strategy.createPluginWrapper(arc);
|
||||
String sn = p.getShortName();
|
||||
PluginWrapper p = null;
|
||||
String sn;
|
||||
try {
|
||||
sn = strategy.getShortName(arc);
|
||||
} catch (AbstractMethodError x) {
|
||||
LOGGER.log(WARNING, "JENKINS-12753 fix not active: {0}", x.getMessage());
|
||||
p = strategy.createPluginWrapper(arc);
|
||||
sn = p.getShortName();
|
||||
}
|
||||
if (getPlugin(sn)!=null)
|
||||
throw new RestartRequiredException(Messages._PluginManager_PluginIsAlreadyInstalled_RestartRequired(sn));
|
||||
|
||||
if (p == null) {
|
||||
p = strategy.createPluginWrapper(arc);
|
||||
}
|
||||
if (p.supportsDynamicLoad()== YesNoMaybe.NO)
|
||||
throw new RestartRequiredException(Messages._PluginManager_PluginDoesntSupportDynamicLoad_RestartRequired(sn));
|
||||
|
||||
@@ -442,10 +452,11 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
|
||||
|
||||
// run initializers in the added plugin
|
||||
Reactor r = new Reactor(InitMilestone.ordering());
|
||||
r.addAll(new InitializerFinder(p.classLoader) {
|
||||
final ClassLoader loader = p.classLoader;
|
||||
r.addAll(new InitializerFinder(loader) {
|
||||
@Override
|
||||
protected boolean filter(Method e) {
|
||||
return e.getDeclaringClass().getClassLoader()!=p.classLoader || super.filter(e);
|
||||
return e.getDeclaringClass().getClassLoader() != loader || super.filter(e);
|
||||
}
|
||||
}.discoverTasks(r));
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user