Skip to content

Commit

Permalink
[FIXED JENKINS-37590] Return a null property if no parameters
Browse files Browse the repository at this point in the history
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 8a8c4c2
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -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);
Expand Down

0 comments on commit 8a8c4c2

Please sign in to comment.