Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-38908

Script.main(String[]) vs. Script.main() ArrayIndexOutOfBoundsException

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The script

      node {
        writeFile file: 'x', text: 'def main() {}; this'
        load('x').main()
      }
      

      fails

      java.lang.ArrayIndexOutOfBoundsException: 0
          at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.isMoreSpecific(GroovyCallSiteSelector.java:230)
          at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.findMatchingMethod(GroovyCallSiteSelector.java:178)
          at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovyCallSiteSelector.method(GroovyCallSiteSelector.java:146)
          at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:78)
          at ...
      

      whereas if you pick a different name it is OK.

      Claimed to be a regression in 1.22 though it seems unlikely those changes are related.

        Attachments

          Issue Links

            Activity

            Hide
            jglick Jesse Glick added a comment -

            Root cause is that Groovy seems to define a main(String...) method on Script, and the code to pick which of those was being called got confused.

            Show
            jglick Jesse Glick added a comment - Root cause is that Groovy seems to define a main(String...) method on Script , and the code to pick which of those was being called got confused.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Jesse Glick
            Path:
            src/main/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/GroovyCallSiteSelector.java
            src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/GroovyCallSiteSelectorTest.java
            http://jenkins-ci.org/commit/script-security-plugin/fa6f8e3372e3e38fa43bc7b4be09d2d26758beca
            Log:
            [FIXED JENKINS-38908] Incorrect specificity calculation when varargs are involved.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: src/main/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/GroovyCallSiteSelector.java src/test/java/org/jenkinsci/plugins/scriptsecurity/sandbox/groovy/GroovyCallSiteSelectorTest.java http://jenkins-ci.org/commit/script-security-plugin/fa6f8e3372e3e38fa43bc7b4be09d2d26758beca Log: [FIXED JENKINS-38908] Incorrect specificity calculation when varargs are involved.
            Hide
            recampbell Ryan Campbell added a comment -

            Released as script-security-1.24

            Show
            recampbell Ryan Campbell added a comment - Released as script-security-1.24

              People

              • Assignee:
                jglick Jesse Glick
                Reporter:
                jglick Jesse Glick
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: