jira.codehaus.org

  • Log In Access more options
    • Online Help
    • Keyboard Shortcuts
    • About JIRA
    • JIRA Credits
    • What?s New
  • Dashboards Access more options (Alt+d)
  • Projects Access more options (Alt+p)
  • Issues Access more options (Alt+i)
  • groovy
  • GROOVY-726

no line number in exception stack trace

  • Log In
  • Views
    • XML
    • Word
    • Printable

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.0-beta-9
  • Fix Version/s: 1.0-beta-10
  • Component/s: bytecode, class generator
  • Labels:
    None

Description

An exception thrown from inside a Groovy script doesn't include the line number with the StackTraceElement associated with the script. Note that this worked fine with Groovy 1.0-beta-7.

So if the following script test.groovy:

throw new RuntimeException()

is executed as follows from a Java class:

new GroovyShell().parse(new File("test.groovy")).run();

Then the following is printed:

java.lang.RuntimeException
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:274)
at groovy.lang.MetaClass.doConstructorInvoke(MetaClass.java:1619)
at groovy.lang.MetaClass.invokeConstructor(MetaClass.java:530)
at org.codehaus.groovy.runtime.Invoker.invokeConstructorOf(Invoker.java:183)
at org.codehaus.groovy.runtime.InvokerHelper.invokeNoArgumentsConstructorOf(InvokerHelper.java:126)
at test.run(test.groovy)
at Main.main(Main.java:16)

Note the missing line number for the second last line corresponding to the Groovy script.

Activity

Ascending order - Click to sort in descending order
  • All
  • Comments
  • Work Log
  • History
  • Activity
Hide
Permalink
blackdrag blackdrag added a comment - 23/Feb/05 5:47 PM

fixed

Show
blackdrag blackdrag added a comment - 23/Feb/05 5:47 PM fixed
Hide
Permalink
Guillaume Pothier added a comment - 12/Jul/05 11:01 AM

Is there a special step to take to obtain line numbers?
I'm using JSR-2 and I'm getting that kind of stack trace:
java.lang.ArithmeticException: BigInteger divide by zero
at java.math.MutableBigInteger.divide(MutableBigInteger.java:780)
at java.math.BigInteger.divideAndRemainder(BigInteger.java:1306)
at java.math.BigDecimal.divide(BigDecimal.java:1124)
at org.codehaus.groovy.runtime.BigDecimalMath.divideImpl(BigDecimalMath.java:45)
at org.codehaus.groovy.runtime.IntegerMath.divideImpl(IntegerMath.java:35)
at org.codehaus.groovy.runtime.NumberMath.divide(NumberMath.java:53)
at org.codehaus.groovy.runtime.DefaultGroovyMethods.div(DefaultGroovyMethods.java:3023)
at gjdk.java.lang.Number_GroovyReflector.invoke(Unknown Source)
at groovy.lang.MetaMethod.invoke(MetaMethod.java:110)
at org.codehaus.groovy.runtime.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:99)
at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1386)
at groovy.lang.MetaClass.invokeMethod(MetaClass.java:309)
at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:145)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:104)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptBytecodeAdapter.java:85)
at tod.vbuilder.BaseTreeStructure.<init>(Unknown Source)
... 6 more

The last line is the culprit, but I have no source information...

Guillaume

Show
Guillaume Pothier added a comment - 12/Jul/05 11:01 AM Is there a special step to take to obtain line numbers? I'm using JSR-2 and I'm getting that kind of stack trace: java.lang.ArithmeticException: BigInteger divide by zero at java.math.MutableBigInteger.divide(MutableBigInteger.java:780) at java.math.BigInteger.divideAndRemainder(BigInteger.java:1306) at java.math.BigDecimal.divide(BigDecimal.java:1124) at org.codehaus.groovy.runtime.BigDecimalMath.divideImpl(BigDecimalMath.java:45) at org.codehaus.groovy.runtime.IntegerMath.divideImpl(IntegerMath.java:35) at org.codehaus.groovy.runtime.NumberMath.divide(NumberMath.java:53) at org.codehaus.groovy.runtime.DefaultGroovyMethods.div(DefaultGroovyMethods.java:3023) at gjdk.java.lang.Number_GroovyReflector.invoke(Unknown Source) at groovy.lang.MetaMethod.invoke(MetaMethod.java:110) at org.codehaus.groovy.runtime.NewInstanceMetaMethod.invoke(NewInstanceMetaMethod.java:99) at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1386) at groovy.lang.MetaClass.invokeMethod(MetaClass.java:309) at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:145) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:104) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptBytecodeAdapter.java:85) at tod.vbuilder.BaseTreeStructure.<init>(Unknown Source) ... 6 more The last line is the culprit, but I have no source information... Guillaume
Hide
Permalink
blackdrag blackdrag added a comment - 29/Aug/05 8:18 AM

line numbers where broken in jsr-02 and jsr-03, but it should be fixed in the relaeses after again.

Show
blackdrag blackdrag added a comment - 29/Aug/05 8:18 AM line numbers where broken in jsr-02 and jsr-03, but it should be fixed in the relaeses after again.
Hide
Permalink
Knut Wannheden added a comment - 21/Oct/05 3:17 AM

As noted this problem resurfaced with jsr-02 and jsr-03 so I'm reopening this issue so it doesn't get lost.

Show
Knut Wannheden added a comment - 21/Oct/05 3:17 AM As noted this problem resurfaced with jsr-02 and jsr-03 so I'm reopening this issue so it doesn't get lost.
Hide
Permalink
blackdrag blackdrag added a comment - 21/Oct/05 6:10 AM

jsr-02 and 03 have the line numbers only somehow the source file attribute got lost. This is fixed for jsr-04.

Show
blackdrag blackdrag added a comment - 21/Oct/05 6:10 AM jsr-02 and 03 have the line numbers only somehow the source file attribute got lost. This is fixed for jsr-04.
Hide
Permalink
blackdrag blackdrag added a comment - 20/Nov/05 4:52 PM

I added a testcase to avoid future problems with that

Show
blackdrag blackdrag added a comment - 20/Nov/05 4:52 PM I added a testcase to avoid future problems with that

People

  • Assignee:
    blackdrag blackdrag
    Reporter:
    Knut Wannheden
Vote (2)
Watch (2)

Dates

  • Created:
    09/Feb/05 5:01 AM
    Updated:
    20/Nov/05 4:52 PM
    Resolved:
    20/Nov/05 4:52 PM
  • Atlassian JIRA (v5.0.4#731-sha1:3aa7374)
  • Report a problem
  • Powered by a free Atlassian JIRA open source license for Codehaus. Try JIRA - bug tracking software for your team.