From ed431fe3e8b9eb200084405eabedd9d4b60bec3d Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sun, 16 Dec 2007 16:50:42 +0000 Subject: [PATCH] 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 --- core/src/main/java/hudson/tasks/Shell.java | 15 ++++++++++++--- .../resources/hudson/tasks/Shell/global.jelly | 3 +-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/core/src/main/java/hudson/tasks/Shell.java b/core/src/main/java/hudson/tasks/Shell.java index fc38bad2c4..e5f73ac10a 100644 --- a/core/src/main/java/hudson/tasks/Shell.java +++ b/core/src/main/java/hudson/tasks/Shell.java @@ -3,12 +3,15 @@ package hudson.tasks; import hudson.FilePath; import hudson.model.Descriptor; import static hudson.model.Hudson.isWindows; +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; -import net.sf.json.JSONObject; - /** * Executes a series of commands by using a shell. * @@ -70,7 +73,6 @@ public class Shell extends CommandInterpreter { load(); } - protected void convert(Map 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(); + } } } diff --git a/core/src/main/resources/hudson/tasks/Shell/global.jelly b/core/src/main/resources/hudson/tasks/Shell/global.jelly index 1a4b741cd4..5eba931df1 100644 --- a/core/src/main/resources/hudson/tasks/Shell/global.jelly +++ b/core/src/main/resources/hudson/tasks/Shell/global.jelly @@ -1,8 +1,7 @@ - + \ No newline at end of file -- GitLab