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)
This commit is contained in:
Johannes Schnatterer 2017-12-12 12:46:44 +01:00
parent 6ec7e7eee2
commit 3c5b37e451

7
Jenkinsfile vendored
View file

@ -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()