mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
strange place to check for buildability.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@29664 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
c5d891b1b9
commit
a52565547c
1 file changed
+15
-10
@@ -51,6 +51,8 @@ import hudson.scm.PollingResult;
|
||||
import hudson.scm.SCMRevisionState;
|
||||
import static hudson.scm.PollingResult.NO_CHANGES;
|
||||
import static hudson.scm.PollingResult.BUILD_NOW;
|
||||
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||
|
||||
import hudson.search.SearchIndexBuilder;
|
||||
import hudson.security.Permission;
|
||||
import hudson.tasks.BuildStep;
|
||||
@@ -70,6 +72,7 @@ import hudson.widgets.HistoryWidget;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.kohsuke.args4j.Argument;
|
||||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.stapler.HttpResponses;
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
import org.kohsuke.stapler.export.Exported;
|
||||
@@ -79,6 +82,7 @@ import org.kohsuke.stapler.HttpRedirect;
|
||||
import org.kohsuke.stapler.ForwardToView;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -1403,18 +1407,19 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
|
||||
cause = new UserCause();
|
||||
}
|
||||
|
||||
if (!isBuildable())
|
||||
throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR,new IOException(getFullName()+" is not buildable"));
|
||||
|
||||
String delay = req.getParameter("delay");
|
||||
if (delay!=null) {
|
||||
if (isBuildable()) {
|
||||
try {
|
||||
// TODO: more unit handling
|
||||
if(delay.endsWith("sec")) delay=delay.substring(0,delay.length()-3);
|
||||
if(delay.endsWith("secs")) delay=delay.substring(0,delay.length()-4);
|
||||
Hudson.getInstance().getQueue().schedule(this, Integer.parseInt(delay),
|
||||
new CauseAction(cause));
|
||||
} catch (NumberFormatException e) {
|
||||
throw new ServletException("Invalid delay parameter value: "+delay);
|
||||
}
|
||||
try {
|
||||
// TODO: more unit handling
|
||||
if(delay.endsWith("sec")) delay=delay.substring(0,delay.length()-3);
|
||||
if(delay.endsWith("secs")) delay=delay.substring(0,delay.length()-4);
|
||||
Hudson.getInstance().getQueue().schedule(this, Integer.parseInt(delay),
|
||||
new CauseAction(cause));
|
||||
} catch (NumberFormatException e) {
|
||||
throw new ServletException("Invalid delay parameter value: "+delay);
|
||||
}
|
||||
} else {
|
||||
scheduleBuild(cause);
|
||||
|
||||
Reference in new issue
Block a user