Skip to content
Permalink
Browse files
Merge pull request #9 from yoichi/JENKINS-18053
[FIXED JENKINS-18053] define doCheckViewName() to re-enable form validation
  • Loading branch information
ctapobep committed Sep 23, 2013
2 parents 4599b56 + 267e2f9 commit a82b5d30c576c6fc51b2ac8ed193945c5925a4f8
Showing with 25 additions and 0 deletions.
  1. +25 −0 src/main/java/hudson/plugins/nested_view/NestedView.java
@@ -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.
*/

0 comments on commit a82b5d3

Please sign in to comment.