Skip to content

Commit

Permalink
Merge pull request #9 from yoichi/JENKINS-18053
Browse files Browse the repository at this point in the history
[FIXED JENKINS-18053] define doCheckViewName() to re-enable form validation
  • Loading branch information
ctapobep committed Sep 23, 2013
2 parents 4599b56 + 267e2f9 commit a82b5d3
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/main/java/hudson/plugins/nested_view/NestedView.java
Expand Up @@ -101,6 +101,31 @@ public Item doCreateItem(StaplerRequest req, StaplerResponse rsp)
return null;
}

/**
* Checks if a nested view with the given name exists and
* make sure that the name is good as a view name.
*/
public FormValidation doCheckViewName(@QueryParameter String value) {
checkPermission(View.CREATE);

String name = fixEmpty(value);
if (name == null)
return FormValidation.ok();

// already exists?
if (getView(name) != null)
return FormValidation.error(hudson.model.Messages.Hudson_ViewAlreadyExists(name));

// good view name?
try {
jenkins.model.Jenkins.checkGoodName(name);
} catch (Failure e) {
return FormValidation.error(e.getMessage());
}

return FormValidation.ok();
}

/**
* Checks if a nested view with the given name exists.
*/
Expand Down

0 comments on commit a82b5d3

Please sign in to comment.