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

Different exception behavior in groovy 1.6 (original exception is wrapped)

    XMLWordPrintableJSON

Details

    Description

      The current SVN Head code handles exceptions differently than groovy 1.5.4 or earlier. This change in the behavior is a breaking change for some existing code:

      Example Code from the groovy-eclipse project: org.codehaus.groovy.eclipse.astviews, TreeNodeFactory.groovy, Class DefaultTreeNode#loadChildren:

      try {
      return TreeNodeFactory.createTreeNode(this, value."${method.name}"(), name)
      } catch (org.codehaus.groovy.GroovyBugError e) {
      // Some getters are not for us.
      return null
      } catch (NullPointerException e) {
      // For some reason ClassNode.getAbstractMethods() has a problem - ClassNode.superclass is null.
      return null
      }

      This used to work with groovy 1.5.4: after the call of createTreeNode method the groovy core class "ClassNode" sometime threw a GroovyBugError and it was possible to catch this exception.

      After changing to 1.6 the exception that is thrown is not a GroovyBugError anymore, it is a InvokerInvocationException that wraps (cause field) around the GroovyBugError and therefore doesen't get caught anymore.

      Attachments

        Issue Links

          Activity

            People

              ait Alex Tkachman
              rkleeb Reto Kleeb
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: