提交 a77c21dd 编写于 作者: K Kohsuke Kawaguchi

[FIXED JENKINS-7826] it is possible that findNearest finds no match, if

the user has no read permission on any of the jobs.
上级 6b2af915
......@@ -61,6 +61,9 @@ Upcoming changes</a>
<li class=bug>
Failing to install a plugin from CLI should result in non-zero exit code
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-10057">issue 10057</a>)
<li class=bug>
Fixed NPE in trying to diagnose undefined job error.
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-7826">issue 7826</a>)
<li class=bug>
Disable auto refresh in slave markOffline screen
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-10608">issue 10608</a>)
......
......@@ -50,8 +50,13 @@ public class AbstractProjectOptionHandler extends OptionHandler<AbstractProject>
String src = params.getParameter(0);
AbstractProject s = h.getItemByFullName(src,AbstractProject.class);
if (s==null)
throw new CmdLineException(owner, "No such job '"+src+"' perhaps you meant "+ AbstractProject.findNearest(src)+"?");
if (s==null) {
AbstractProject nearest = AbstractProject.findNearest(src);
if (nearest!=null)
throw new CmdLineException(owner, "No such job '"+src+"' perhaps you meant "+ nearest +"?");
else
throw new CmdLineException(owner, "No such job '"+src+"'");
}
setter.addValue(s);
return 1;
}
......
......@@ -2052,6 +2052,7 @@ public class Jenkins extends AbstractCIBase implements ModifiableItemGroup<TopLe
*/
public Item getItem(String relativeName, ItemGroup context) {
if (context==null) context = this;
if (relativeName==null) return null;
if (relativeName.startsWith("/")) // absolute
return getItemByFullName(relativeName);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册