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

GroovyShell.evaluate(File) NPE

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.6.3
    • 1.6.4, 1.7-beta-1
    • groovy-jdk
    • None

    Description

      NPE when evaluating a script with Groovy 1.6.2 and 1.6.3 using groovy.lang.GroovyShell.evaluate(File). The problem is not happening with v.1.0 and v.1.5.6.

      java.lang.NullPointerException
      at groovy.lang.GroovyClassLoader.getPermissions(GroovyClassLoader.java:342)
      at java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader.java:192)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
      at groovy.lang.GroovyClassLoader.access$200(GroovyClassLoader.java:54)
      at groovy.lang.GroovyClassLoader$ClassCollector.createClass(GroovyClassLoader.java:468)
      at groovy.lang.GroovyClassLoader$ClassCollector.onClassNode(GroovyClassLoader.java:485)
      at groovy.lang.GroovyClassLoader$ClassCollector.call(GroovyClassLoader.java:489)
      at org.codehaus.groovy.control.CompilationUnit$10.call(CompilationUnit.java:727)
      at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:924)
      at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:462)
      at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:278)
      at groovy.lang.GroovyShell.parseClass(GroovyShell.java:590)
      at groovy.lang.GroovyShell.parse(GroovyShell.java:602)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:490)
      at groovy.lang.GroovyShell.evaluate(GroovyShell.java:526)
      at Refresh_Groovy_List.actionPerformed(Refresh_Groovy_List.java:127)
      at java.awt.MenuItem.processActionEvent(MenuItem.java:627)
      at java.awt.MenuItem.processEvent(MenuItem.java:586)

      The problem is a bit tricky to reproduce, but can be reproduced consistently. You need to run the test code from within ImageJ (http://rsb.info.nih.gov/ij/). There is no problem when I execute the same code and script from IDEA.

      Steps to reproduce:
      1) Download and install ImageJ
      2) In ImageJ 'plugins' directory create directory named 'Groovy"
      3) Copy attached files to the new directory
      4) Start ImageJ and select from menu Plugins>Groovy>Refresh Groovy List (if you do not see the last menu item, steps 2) and 3) were not done right). This will create new menu item "Add Noise"
      5) Select from menu Plugins>Groovy>Add Noise

      GroovyShell.evaluate is executed by the code in Refresh_Groovy_List.java line 127.

      Attachments

        1. Refresh_Groovy_List.class
          4 kB
          Jarek
        2. Refresh_Groovy_List.java
          6 kB
          Jarek
        3. Add_Noise.groovy
          0.8 kB
          Jarek

        Issue Links

          Activity

            People

              roshandawrani Roshan Dawrani
              jsacha Jarek
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: