-
Bug
-
Resolution: Duplicate
-
Major
-
Jenkins 2.73, Script Security Plugin 1.31
The following produces a strange array conversion when assigning a string from a method within a closure.
def lst = [1,2,3,4]; lst.findAll { try { a = 1 / 0 } catch(e) { String msg = e.getMessage(); } }
Producing the exception
groovy.lang.MissingMethodException: No signature of method: Script1.toArray() is applicable for argument types: () values: []
Possible solutions: notify(), toString(), toString(), every()
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:58)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.unwrap(ScriptBytecodeAdapter.java:64)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:54)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
at org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:23)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:123)
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:110)
at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:153)
at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:157)
at org.kohsuke.groovy.sandbox.impl.Checker$checkedCall$0.callStatic(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallStatic(CallSiteArray.java:56)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:194)
at Script1$_run_closure1.doCall(Script1.groovy:6)
The workaround is to split the declaration
def lst = [1,2,3,4]; lst.findAll { try { a = 1 / 0 } catch(e) { String msg = "" msg = e.getMessage(); } }
- duplicates
-
JENKINS-46088 unclassified staticMethod when assigning java.util.regex.Matcher in included script
- Resolved