提交 2764acd0 编写于 作者: K kohsuke

added form field validation

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@13167 71c3de6d-444a-0410-be80-ed276b4c234a
上级 dc7863ca
......@@ -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();
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册