Fix bug in TextparameterDefinition (#5704)

TextParameterDefinition did not override getDefaultParameterValue()
method and instead relied on the implementation in
StringParameterDefinition. In most cases this wasn't a problem, but in
some cases, for example when triggering build through
buildWithParameters API without specifying the parameter, then the
parameter object would be of the wrong type (StringParameterValue as
opposed to TextParameterValue). This causes problems with visualization
in parameters view as well as incorrect values when rebuild plugin is
used.

Change-Id: If4e11bdafcd94c9c83462983f384fa80ae2c4d9c
This commit is contained in:
Jon authored and GitHub committed 2021-09-06 08:20:06 +01:00
1 parent 529cb5eefb
commit cfec42e28b
1 file changed
+5
@@ -58,6 +58,11 @@ public class TextParameterDefinition extends StringParameterDefinition {
}
}
@Override
public StringParameterValue getDefaultParameterValue() {
return new TextParameterValue(getName(), getDefaultValue(), getDescription());
}
@Override
public ParameterValue createValue(StaplerRequest req, JSONObject jo) {
TextParameterValue value = req.bindJSON(TextParameterValue.class, jo);