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

No line numbers/source file for exceptions

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.0-JSR-4
    • None
    • None

    Description

      The following groovy file:

      public class bug8 {
      bug8()

      { def x = null x + 3 }

      static void main(String[] args)

      { def b = new bug8() }

      }

      Produces:

      Caught: java.lang.NullPointerException: Cannot invoke method plus() on null object

      Without a line number for the exception, it's hard to pinpoint it. When called from Java, I get the following error message:

      Exception in thread "main" java.lang.NullPointerException: Cannot invoke method plus() on null object
      at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:130)
      at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:104)
      at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptBytecodeAdapter.java:85)
      at bug8.<init>(Unknown Source)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
      at java.lang.Class.newInstance0(Class.java:350)
      at java.lang.Class.newInstance(Class.java:303)
      at bug8j.main(bug8j.java:16)

      The "Unknown Source" is the issue here.

      Attachments

        Activity

          People

            blackdrag Jochen Theodorou
            mcspanky Martin C. Martin
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: