Groovy
  1. Groovy
  2. GROOVY-2117

GroovyBuilder causes an NPE on non-Groovy projects

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1-rc-3
    • Component/s: None
    • Labels:
      None

      Description

      If a builder doesn't define an associate nature via hasNature in the extension point, all defined builders run. Since the GroovyProject returned in such a case is null, the NPE is expected.
      We can either add the hasNature tag to the builder extension pt or deal with the null project. I opt for the former.

      java.lang.NullPointerException
      at org.codehaus.groovy.eclipse.core.builder.GroovyBuilder.build(GroovyBuilder.java:54)
      at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:624)
      at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
      at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:166)

      1. groovy2117.txt
        2 kB
        Michael Fraenkel

        Activity

        Michael Fraenkel created issue -
        Hide
        Michael Fraenkel added a comment -

        Seems that when I fixed 2118, I cannot reproduce this problem. I will keep on the look out for the cause of why this might occur.

        Show
        Michael Fraenkel added a comment - Seems that when I fixed 2118, I cannot reproduce this problem. I will keep on the look out for the cause of why this might occur.
        Hide
        Michael Fraenkel added a comment -

        The problem still exists and is easy to recreate as well as solve.

        Create a Groovy project. Remove the groovy nature in the .project.
        The groovyBuilder is present and will always attempt to run.

        The solution is either to check if the project is a Groovy project, or just associate the groovyBuilder with the groovyNature as part of the extension point.

        Show
        Michael Fraenkel added a comment - The problem still exists and is easy to recreate as well as solve. Create a Groovy project. Remove the groovy nature in the .project. The groovyBuilder is present and will always attempt to run. The solution is either to check if the project is a Groovy project, or just associate the groovyBuilder with the groovyNature as part of the extension point.
        Hide
        Aaron Digulla added a comment -

        In my case, the project has a groovyNature and a groovyBuilder in the .project file but sometimes, it seems that Eclipse forgets about the nature. Starting Eclipse with -clean solves the issue for a while.

        Maybe a classpath issue or an interference with another plugin?

        Show
        Aaron Digulla added a comment - In my case, the project has a groovyNature and a groovyBuilder in the .project file but sometimes, it seems that Eclipse forgets about the nature. Starting Eclipse with -clean solves the issue for a while. Maybe a classpath issue or an interference with another plugin?
        Hide
        Michael Fraenkel added a comment -

        Only performs a groovy build if its a groovy project.

        Show
        Michael Fraenkel added a comment - Only performs a groovy build if its a groovy project.
        Michael Fraenkel made changes -
        Field Original Value New Value
        Attachment groovy2117.txt [ 29780 ]
        Hide
        Aaron Digulla added a comment -

        I beg your pardon?

        Show
        Aaron Digulla added a comment - I beg your pardon?
        Michael Fraenkel made changes -
        Assignee Michael Fraenkel [ fraenkel ]
        Hide
        Michael Fraenkel added a comment -

        A project without the Groovy Nature is no longer built.

        Show
        Michael Fraenkel added a comment - A project without the Groovy Nature is no longer built.
        Michael Fraenkel made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 1.1 [ 13166 ]
        Guillaume Delcroix made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Jochen Theodorou made changes -
        Component/s eclipse-plugin [ 10635 ]
        Mark Thomas made changes -
        Project Import Sun Apr 05 13:32:57 UTC 2015 [ 1428240777691 ]
        Mark Thomas made changes -
        Workflow jira [ 12731204 ] Default workflow, editable Closed status [ 12743111 ]
        Mark Thomas made changes -
        Project Import Mon Apr 06 02:11:23 UTC 2015 [ 1428286283443 ]
        Mark Thomas made changes -
        Workflow jira [ 12969379 ] Default workflow, editable Closed status [ 12977156 ]
        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Resolved Resolved
        53d 11h 21m 1 Michael Fraenkel 05/Nov/07 08:12
        Resolved Resolved Closed Closed
        48d 4h 12m 1 Guillaume Delcroix 23/Dec/07 12:25

          People

          • Assignee:
            Michael Fraenkel
            Reporter:
            Michael Fraenkel
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development