mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-18 06:22:29 +00:00
added form field validation
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@13167 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
dc7863ca07
commit
2764acd06a
1 file changed
+22
-5
@@ -46,11 +46,7 @@ public class CommandLauncher extends ComputerLauncher {
|
||||
return DESCRIPTOR;
|
||||
}
|
||||
|
||||
public static final Descriptor<ComputerLauncher> DESCRIPTOR = new Descriptor<ComputerLauncher>(CommandLauncher.class) {
|
||||
public String getDisplayName() {
|
||||
return Messages.CommandLauncher_displayName();
|
||||
}
|
||||
};
|
||||
public static final Descriptor<ComputerLauncher> DESCRIPTOR = new DescriptorImpl();
|
||||
|
||||
/**
|
||||
* Gets the formatted current time stamp.
|
||||
@@ -121,4 +117,25 @@ public class CommandLauncher extends ComputerLauncher {
|
||||
static {
|
||||
LIST.add(DESCRIPTOR);
|
||||
}
|
||||
|
||||
public static class DescriptorImpl extends Descriptor<ComputerLauncher> {
|
||||
public DescriptorImpl() {
|
||||
super(CommandLauncher.class);
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return Messages.CommandLauncher_displayName();
|
||||
}
|
||||
|
||||
public void doCheckCommand(StaplerRequest req, StaplerResponse rsp, @QueryParameter final String value) throws IOException, ServletException {
|
||||
new FormFieldValidator(req,rsp,false) {
|
||||
protected void check() throws IOException, ServletException {
|
||||
if(Util.fixEmptyAndTrim(value)==null)
|
||||
error("Command is empty");
|
||||
else
|
||||
ok();
|
||||
}
|
||||
}.process();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user