added form field validation for shell executable.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6315 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2007-12-16 16:50:42 +00:00
1 parent 6afcc1e6ff
commit ed431fe3e8
2 files changed
+15 -7

No files matched your search

+14 -5
View File
@@ -3,11 +3,14 @@ package hudson.tasks;
import hudson.FilePath;
import hudson.model.Descriptor;
import static hudson.model.Hudson.isWindows;
import org.kohsuke.stapler.StaplerRequest;
import java.util.Map;
import hudson.util.FormFieldValidator;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import javax.servlet.ServletException;
import java.io.IOException;
import java.util.Map;
/**
* Executes a series of commands by using a shell.
@@ -70,7 +73,6 @@ public class Shell extends CommandInterpreter {
load();
}
protected void convert(Map<String, Object> oldPropertyBag) {
shell = (String)oldPropertyBag.get("shell");
}
@@ -102,5 +104,12 @@ public class Shell extends CommandInterpreter {
setShell(req.getParameter("shell"));
return true;
}
/**
* Check the existence of sh in the given location.
*/
public void doCheck(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
new FormFieldValidator.Executable(req,rsp).process();
}
}
}
@@ -1,8 +1,7 @@
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:section title="Shell">
<f:entry title="Shell executable">
<input class="setting-input" name="shell"
type="text" value="${descriptor.shell}"/>
<f:textbox name="shell" value="${descriptor.shell}" checkUrl="'${rootURL}/builder/Shell/check?value='+encode(this.value)"/>
</f:entry>
</f:section>
</j:jelly>