Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
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.
fixed