groovy
  1. groovy
  2. GROOVY-2117

GroovyBuilder causes an NPE on non-Groovy projects

    Details

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

      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

        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.
        Hide
        Aaron Digulla added a comment -

        I beg your pardon?

        Show
        Aaron Digulla added a comment - I beg your pardon?
        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.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: