[FIXED 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 but this gives us a better solution
anyway by guaranteeing we have a null property rather than one without
parameters.
@@ -221,6 +221,15 @@ public class ParametersDefinitionProperty extends OptionalJobProperty<Job<?, ?>>
@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);
