Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3893

NPE in GroovyScriptEngine.getResourceConnection(String)

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.4, 1.7-beta-2
    • 1.6.6, 1.7-rc-1
    • None
    • None

    Description

      From Armin on the mailing-list:

      Hello Groovy devs,

      i found a NPE GroovyScriptEngine.getResourceConnection(String), when no script roots has been specified.

      Here is a small test.

       @Test(expected =  ResourceException)
       void "execute groovy script on unknown script root should cause some meaningfull exception"() {
        String[] emptyScriptRoots = []
        GroovyScriptEngine gse = new GroovyScriptEngine(emptyScriptRoots)
        gse.run("unknownScriptName", "")
       }
      

      Instead of getting a meaningfull exception, that the resource "unknownScriptName" can not be found, I get a NPE, because of an implicit
      "throw null" statetement within GroovyScriptEngine.getResourceConnection(String)

      I'm using Groovy 1.6.4.

      Attachments

        Activity

          People

            roshandawrani Roshan Dawrani
            guillaume Guillaume Sauthier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: