Skip to content
Permalink
Browse files
[FIXED JENKINS-37590] Return a null property if no parameters
At least part of the impetus for this issue was dealt with a while
back by a revert of PR #2444, but this gives us a better solution
anyway by guaranteeing we have a null property rather than one without
parameters.
  • Loading branch information
abayer committed Jan 20, 2017
1 parent 712ff4b commit 8a8c4c20eb41204cd0535cc365a59ec6bad824ae
Showing with 9 additions and 0 deletions.
  1. +9 −0 core/src/main/java/hudson/model/ParametersDefinitionProperty.java
@@ -221,6 +221,15 @@ public ParameterDefinition getParameterDefinition(String name) {
@Extension
@Symbol("parameters")
public static class DescriptorImpl extends OptionalJobPropertyDescriptor {
@Override
public ParametersDefinitionProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException {
ParametersDefinitionProperty prop = (ParametersDefinitionProperty)super.newInstance(req, formData);
if (prop != null && prop.parameterDefinitions.isEmpty()) {
return null;
}
return prop;
}

@Override
public boolean isApplicable(Class<? extends Job> jobType) {
return ParameterizedJobMixIn.ParameterizedJob.class.isAssignableFrom(jobType);

0 comments on commit 8a8c4c2

Please sign in to comment.