spjp.getDefaultSubProjectsString()));
}
ParametersAction a = null;
if (!parameters.isEmpty()) {
ParametersDefinitionProperty pdp =
job.getProperty(ParametersDefinitionProperty.class);
if (pdp == null) {
throw new AbortException(
String.format(
"%s is not parameterized but the -p option was specified.",
job.getDisplayName()));
}
List<ParameterValue> values = Lists.<ParameterValue>newArrayList();
for (Map.Entry<String, String> e : parameters.entrySet()) {
String name = e.getKey();
ParameterDefinition pd = pdp.getParameterDefinition(name);
if (pd == null) {
throw new AbortException(
String.format(
"\'%s\' is not a valid parameter. Did you mean %s?",
name,
EditDistance.findNearest(
name,
pdp.getParameterDefinitionNames())));
}
values.add(pd.createValue(this, e.getValue()));
}
// handle missing parameters by adding as default values ISSUE JENKINS-7162
for (ParameterDefinition pd : pdp.getParameterDefinitions()) {
if (parameters.containsKey(pd.getName()))
continue;
// not passed in use default
values.add(pd.getDefaultParameterValue());