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

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

      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.

          [JENKINS-38908] Script.main(String[]) vs. Script.main() ArrayIndexOutOfBoundsException

          Jesse Glick created issue -
          Jesse Glick made changes -
          Status Original: Open [ 1 ] New: In Progress [ 3 ]
          Jesse Glick made changes -
          Remote Link New: This issue links to "PR 91 (Web Link)" [ 14940 ]
          Jesse Glick made changes -
          Status Original: In Progress [ 3 ] New: In Review [ 10005 ]
          Ryan Campbell made changes -
          Resolution New: Fixed [ 1 ]
          Status Original: In Review [ 10005 ] New: Closed [ 6 ]
          Jesse Glick made changes -
          Link New: This issue relates to JENKINS-45117 [ JENKINS-45117 ]
          CloudBees Inc. made changes -
          Remote Link New: This issue links to "CloudBees Internal OSS-1535 (Web Link)" [ 18663 ]

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

              Created:
              Updated:
              Resolved: