From c500f461a36bd03e8499db0b441324087b81ca03 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Thu, 25 May 2023 12:00:36 -0400 Subject: [PATCH] jjb: Fix crash when launching new jobs from the the system trigger 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/system-tests/system-trigger.groovy b/scripts/system-tests/system-trigger.groovy index dc4e9b7..62df033 100644 --- a/scripts/system-tests/system-trigger.groovy +++ b/scripts/system-tests/system-trigger.groovy @@ -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(); } } -- 2.34.1