提交 067acbf6 编写于 作者: S Stephen Connolly

Merge pull request #1150 from stephenc/master

[FIXED JENKINS-22080] NPE if trying to install a plugin from the update ...
......@@ -684,13 +684,28 @@ public abstract class PluginManager extends AbstractModelObject implements OnMas
String n = en.nextElement();
if(n.startsWith("plugin.")) {
n = n.substring(7);
if (n.indexOf(".") > 0) {
String[] pluginInfo = n.split("\\.");
UpdateSite.Plugin p = Jenkins.getInstance().getUpdateCenter().getById(pluginInfo[1]).getPlugin(pluginInfo[0]);
if(p==null)
throw new Failure("No such plugin: "+n);
p.deploy(dynamicLoad);
// JENKINS-22080 plugin names can contain '.' as could (according to rumour) update sites
int index = n.indexOf('.');
UpdateSite.Plugin p = null;
while (index != -1) {
if (index + 1 >= n.length()) {
break;
}
String pluginName = n.substring(0, index);
String siteName = n.substring(index + 1);
UpdateSite updateSite = Jenkins.getInstance().getUpdateCenter().getById(siteName);
if (siteName != null) {
if (p != null) {
throw new Failure("Ambiguous plugin: " + n);
}
p = updateSite.getPlugin(pluginName);
}
index = n.indexOf('.', index + 1);
}
if (p == null) {
throw new Failure("No such plugin: " + n);
}
p.deploy(dynamicLoad);
}
}
rsp.sendRedirect("../updateCenter/");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册