jjb: Fix crash when launching new jobs from the the system trigger
authorKienan Stewart <kstewart@efficios.com>
Thu, 25 May 2023 16:00:36 +0000 (12:00 -0400)
committerKienan Stewart <kstewart@efficios.com>
Thu, 25 May 2023 18:25:38 +0000 (14:25 -0400)
ChoiceParameterDefinition does not have a method getDefaultValue().
However, getDefaultParameterValue() will return null if there is no
default, so the check can be altered.

C.f. https://javadoc.jenkins-ci.org/hudson/model/ParameterDefinition.html
C.f. https://javadoc.jenkins-ci.org/hudson/model/ChoiceParameterDefinition.html

Original crash:

```
ERROR: Build step failed with exception
groovy.lang.MissingMethodException: No signature of method:
hudson.model.ChoiceParameterDefinition.getDefaultValue() is applicable
for argument types: () values: []
...
at Script1$_run_closure8.doCall(Script1.groovy:276)
...
at Script1$_run_closure14.doCall(Script1.groovy:434)
...
```

Change-Id: I8847806b2abb556ff2b89aa772277b1318c507e1

scripts/system-tests/system-trigger.groovy

index dc4e9b75d5fbf5405f0c10248acf39f6fde72cd9..62df0335a865a1a6587f61bf2c79eef0c4630351 100644 (file)
@@ -273,7 +273,7 @@ def LaunchJob = { jobName, jobInfo ->
   for (paramdef in job.getProperty(ParametersDefinitionProperty.class).getParameterDefinitions()) {
     // If there is a default value for this parameter, use it. Don't use empty
     // default value parameters.
-    if (paramdef.getDefaultValue()) {
+    if (paramdef.getDefaultParameterValue() != null) {
       params += paramdef.getDefaultParameterValue();
     }
   }
This page took 0.02475 seconds and 4 git commands to generate.