Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

string split on variable not working #3815

tardis4500 ·

I have a variable named "var" with a value of "a.b"
I create a step which does: echo ${groovy:vars.getValue("var").split('.')[0]}
which fails with
13:07:35,337 ERROR - Step 'master>Test' is failed: java.lang.ArrayIndexOutOfBoundsException: 0
at org.codehaus.groovy.runtime.dgmimpl.arrays.ObjectArrayGetAtMetaMethod.invoke(ObjectArrayGetAtMetaMethod.java:38)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:233)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.invoke(PojoMetaMethodSite.java:48)
at org.codehaus.groovy.runtime.callsite.PojoMetaMethodSite.call(PojoMetaMethodSite.java:53)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at script1500484055328255825253.run(script1500484055328255825253.groovy:1)
at com.pmease.quickbuild.plugin.basis.BasisPlugin$30.evaluate(BasisPlugin.java:365)
at com.pmease.quickbuild.DefaultScriptEngine.evaluate(DefaultScriptEngine.java:305)
at com.pmease.quickbuild.DefaultScriptEngine.interp...

  • replies 1
  • views 645
  • stars 0
tardis4500 ·

Nevermind, I figured this out myself. I needed: echo ${groovy:vars.getValue("var").split('\.')[0]}