From 3c5b37e4514768d208689b5694d9201d5e8aab30 Mon Sep 17 00:00:00 2001 From: Johannes Schnatterer Date: Tue, 12 Dec 2017 12:46:44 +0100 Subject: [PATCH] Jenkins: Init global variables in order to avoid NPE. Occurs in Jenkins ver. 2.73.3 and Pipeline: Groovy Plugin 2.42. java.lang.NullPointerException at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.isVarArgsMethod(GroovyCallSiteSelector.java:231) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.findMatchingMethod(GroovyCallSiteSelector.java:200) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.staticMethod(GroovyCallSiteSelector.java:193) at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onStaticCall(SandboxInterceptor.java:153) at org.kohsuke.groovy.sandbox.impl.Checker$2.call(Checker.java:186) at org.kohsuke.groovy.sandbox.impl.Checker.checkedStaticCall(Checker.java:190) at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:97) at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17) at WorkflowScript.run(WorkflowScript:42) at ___cps.transform___(Native Method) --- Jenkinsfile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 154ce3e22..5fd7f5728 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -52,9 +52,10 @@ node { junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml' } -String cesFqdn -String cesUrl -def credentials +// Init global vars in order to avoid NPE +String cesFqdn = '' +String cesUrl = '' +def credentials= {} void mvn(String args) { writeSettingsXml()