Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIXED JENKINS-7826] it is possible that findNearest finds no match, if
the user has no read permission on any of the jobs.
  • Loading branch information
kohsuke committed Aug 10, 2011
1 parent 6b2af91 commit a77c21d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions changelog.html
Expand Up @@ -61,6 +61,9 @@
<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>)
Expand Down
Expand Up @@ -50,8 +50,13 @@ public int parseArguments(Parameters params) throws CmdLineException {
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;
}
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/jenkins/model/Jenkins.java
Expand Up @@ -2052,6 +2052,7 @@ public TopLevelItem getItem(String name) {
*/
public Item getItem(String relativeName, ItemGroup context) {
if (context==null) context = this;
if (relativeName==null) return null;

if (relativeName.startsWith("/")) // absolute
return getItemByFullName(relativeName);
Expand Down

0 comments on commit a77c21d

Please sign in to comment.