Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2660 from daniel-beck/JENKINS-39700
[FIX JENKINS-39700] Don't fail when no parameters property for job
  • Loading branch information
daniel-beck committed Dec 12, 2016
2 parents e2e17da + e43222d commit e7e51ee
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions core/src/main/java/hudson/model/Job.java
Expand Up @@ -1231,8 +1231,6 @@ public synchronized void doConfigSubmit(StaplerRequest req,
DescribableList<JobProperty<?>, JobPropertyDescriptor> t = new DescribableList<JobProperty<?>, JobPropertyDescriptor>(NOOP,getAllProperties());
JSONObject jsonProperties = json.optJSONObject("properties");
if (jsonProperties != null) {
//This handles the situation when Parameterized build checkbox is checked but no parameters are selected. User will be redirected to an error page with proper error message.
Job.checkForEmptyParameters(jsonProperties);
t.rebuild(req,jsonProperties,JobPropertyDescriptor.getPropertyDescriptors(Job.this.getClass()));
} else {
t.clear();
Expand Down Expand Up @@ -1537,18 +1535,4 @@ public BuildTimelineWidget getTimeline() {
}

private final static HexStringConfidentialKey SERVER_COOKIE = new HexStringConfidentialKey(Job.class,"serverCookie",16);

/**
* This handles the situation when Parameterized build checkbox is checked
* but no parameters are selected. User will be redirected to an error page
* with proper error message.
* @param jsonProperties
* @throws FormException
*/
private static void checkForEmptyParameters(JSONObject jsonProperties) throws FormException{
JSONObject parameterDefinitionProperty = jsonProperties.getJSONObject("hudson-model-ParametersDefinitionProperty");
if ((parameterDefinitionProperty.getBoolean("specified") == true)&& !parameterDefinitionProperty.has("parameterDefinitions")) {
throw new FormException(Messages.Hudson_NoParamsSpecified(),"parameterDefinitions");
}
}
}

0 comments on commit e7e51ee

Please sign in to comment.