提交 ab26fdbe 编写于 作者: G godfath3r

[JENKINS-36193] Raise exception when trying to build a job that is disabled.

上级 6561a9cc
......@@ -52,7 +52,7 @@ import java.util.Map;
import javax.annotation.CheckForNull;
import javax.servlet.ServletException;
import static javax.servlet.http.HttpServletResponse.SC_CREATED;
import static javax.servlet.http.HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
import static javax.servlet.http.HttpServletResponse.SC_CONFLICT;
import jenkins.util.TimeDuration;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
......@@ -178,7 +178,7 @@ public abstract class ParameterizedJobMixIn<JobT extends Job<JobT, RunT> & Param
}
if (!asJob().isBuildable()) {
throw HttpResponses.error(SC_INTERNAL_SERVER_ERROR, new IOException(asJob().getFullName() + " is not buildable"));
throw HttpResponses.error(SC_CONFLICT, new IOException(asJob().getFullName() + " is not buildable"));
}
// if a build is parameterized, let that take over
......@@ -215,6 +215,9 @@ public abstract class ParameterizedJobMixIn<JobT extends Job<JobT, RunT> & Param
hudson.model.BuildAuthorizationToken.checkPermission(asJob(), asJob().getAuthToken(), req, rsp);
ParametersDefinitionProperty pp = asJob().getProperty(ParametersDefinitionProperty.class);
if (!asJob().isBuildable()) {
throw HttpResponses.error(SC_CONFLICT, new IOException(asJob().getFullName() + " is not buildable!"));
}
if (pp != null) {
pp.buildWithParameters(req, rsp, delay);
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册