groovy

Filter stacktraces in the new shell

Details

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

Description

When things trigger some exceptions, those stacktraces should be filtered to just show the interesting bits to the user:

C:\Documents and Settings\Guillaume Laforge>groovysh
Groovy Shell (1.1-beta-3, JVM: 1.6.0_02-b06)
Type 'help' or '\h' for help.
-------------------------------------------------------------------------------------------------------------
groovy0):000> random()
001> random()
ERROR groovy.lang.MissingMethodException: No signature of method: groovysh_evaluate.random() is applicable for
argument types: () values: {}
at groovy.lang.MetaClassImpl.invokeMissingMethod (MetaClassImpl.java:574)
at groovy.lang.MetaClassImpl.invokeMissingMethod (MetaClassImpl.java:545)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:787)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:537)
at groovy.lang.GroovyObjectSupport.invokeMethod (GroovyObjectSupport.java:44)
at groovy.lang.Script.invokeMethod (Script.java:78)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav
a:71)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrent0 (ScriptBytecodeAdapter.jav
a:99)
at groovysh_evaluate.run (groovysh_evaluate)
...
groovy0):000>

In this example, reducing it to that would be great:

C:\Documents and Settings\Guillaume Laforge>groovysh
Groovy Shell (1.1-beta-3, JVM: 1.6.0_02-b06)
Type 'help' or '\h' for help.
-------------------------------------------------------------------------------------------------------------
groovy0):000> random()
001> random()
ERROR groovy.lang.MissingMethodException: No signature of method: groovysh_evaluate.random() is applicable for
argument types: () values: {}
...
groovy0):000>

Activity

Hide
Guillaume Laforge added a comment -

Another example with the bug on static imports, the stacktrace is immensly huge and unfriendly:

C:\Documents and Settings\Guillaume Laforge>groovysh
Groovy Shell (1.1-beta-3, JVM: 1.6.0_02-b06)
Type 'help' or '\h' for help.
-------------------------------------------------------------------------------------------------------------
groovy0):000> import static java.lang.Math.*
groovy0):000> random()
001> random()
===> 0.35025511331429426
groovy0):000> c = { random() }
001> c = { random() }
ERROR groovy.lang.MissingMethodException: No signature of method: groovysh_evaluate.random() is applicable for
argument types: () values: {}
at groovy.lang.MetaClassImpl.invokeMissingMethod (MetaClassImpl.java:574)
at groovy.lang.MetaClassImpl.invokeMissingMethod (MetaClassImpl.java:545)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:787)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:537)
at groovy.lang.GroovyObjectSupport.invokeMethod (GroovyObjectSupport.java:44)
at groovy.lang.Script.invokeMethod (Script.java:78)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects (ClosureMetaClass.
java:326)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod (ClosureMetaClass.java:287)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav
a:66)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrent0 (ScriptBytecodeAdapter.jav
a:99)
at groovysh_evaluate$_run_closure1.doCall (groovysh_evaluate:2)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod (ClosureMetaClass.java:224)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614)
at groovy.lang.Closure.call (Closure.java:292)
at groovy.lang.GString.writeTo (GString.java:155)
at groovy.lang.GString.toString (GString.java:133)
at org.codehaus.groovy.reflection.CachedClass.coerceGString (CachedClass.java:95)
at org.codehaus.groovy.reflection.ParameterTypes.coerceArgumentsToClasses (ParameterTypes.java:92)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:535)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614)
at org.codehaus.groovy.runtime.Invoker.invokePojoMethod (Invoker.java:87)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:75)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.Groovysh.setLastResult (Groovysh.groovy:92)
at org.codehaus.groovy.tools.shell.Groovysh.this$3$setLastResult (Groovysh.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.setProperty (MetaClassImpl.java:1764)
at groovy.lang.MetaClassImpl.setProperty (MetaClassImpl.java:2412)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614)
at org.codehaus.groovy.runtime.Invoker.invokePojoMethod (Invoker.java:87)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:75)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.Shell.setProperty (Shell.groovy)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setGroovyObjectProperty (ScriptBytecodeAdapter.ja
va:571)
at org.codehaus.groovy.tools.shell.Groovysh.execute (Groovysh.groovy:182)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav
a:66)
at org.codehaus.groovy.tools.shell.Shell.leftShift (Shell.groovy:121)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614)
at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.ShellRunner.work (ShellRunner.groovy:88)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav
a:66)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrent0 (ScriptBytecodeAdapter.jav
a:99)
at org.codehaus.groovy.tools.shell.ShellRunner.run (ShellRunner.groovy:57)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run (InteractiveShellRunner.groovy)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN (ScriptBytecodeAdapter.java:
118)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0 (ScriptBytecodeAdapter.java:
142)
at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run (InteractiveShellRunner.groovy:64)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614)
at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0 (ScriptBytecodeAdapter.java:201)
at org.codehaus.groovy.tools.shell.Groovysh.run (Groovysh.groovy:446)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64)
at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772)
at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614)
at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98)
at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79)
at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158)
at org.codehaus.groovy.tools.shell.Groovysh.main (Groovysh.groovy:591)
at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke (Method.java:597)
at org.codehaus.groovy.tools.GroovyStarter.rootLoader (GroovyStarter.java:101)
at org.codehaus.groovy.tools.GroovyStarter.main (GroovyStarter.java:130)
groovy0):000>

Show
Guillaume Laforge added a comment - Another example with the bug on static imports, the stacktrace is immensly huge and unfriendly: C:\Documents and Settings\Guillaume Laforge>groovysh Groovy Shell (1.1-beta-3, JVM: 1.6.0_02-b06) Type 'help' or '\h' for help. ------------------------------------------------------------------------------------------------------------- groovy0):000> import static java.lang.Math.* groovy0):000> random() 001> random() ===> 0.35025511331429426 groovy0):000> c = { random() } 001> c = { random() } ERROR groovy.lang.MissingMethodException: No signature of method: groovysh_evaluate.random() is applicable for argument types: () values: {} at groovy.lang.MetaClassImpl.invokeMissingMethod (MetaClassImpl.java:574) at groovy.lang.MetaClassImpl.invokeMissingMethod (MetaClassImpl.java:545) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:787) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:537) at groovy.lang.GroovyObjectSupport.invokeMethod (GroovyObjectSupport.java:44) at groovy.lang.Script.invokeMethod (Script.java:78) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeOnDelegationObjects (ClosureMetaClass. java:326) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod (ClosureMetaClass.java:287) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav a:66) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrent0 (ScriptBytecodeAdapter.jav a:99) at groovysh_evaluate$_run_closure1.doCall (groovysh_evaluate:2) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64) at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537) at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod (ClosureMetaClass.java:224) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614) at groovy.lang.Closure.call (Closure.java:292) at groovy.lang.GString.writeTo (GString.java:155) at groovy.lang.GString.toString (GString.java:133) at org.codehaus.groovy.reflection.CachedClass.coerceGString (CachedClass.java:95) at org.codehaus.groovy.reflection.ParameterTypes.coerceArgumentsToClasses (ParameterTypes.java:92) at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:535) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614) at org.codehaus.groovy.runtime.Invoker.invokePojoMethod (Invoker.java:87) at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:75) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158) at org.codehaus.groovy.tools.shell.Groovysh.setLastResult (Groovysh.groovy:92) at org.codehaus.groovy.tools.shell.Groovysh.this$3$setLastResult (Groovysh.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64) at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537) at groovy.lang.MetaClassImpl.setProperty (MetaClassImpl.java:1764) at groovy.lang.MetaClassImpl.setProperty (MetaClassImpl.java:2412) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64) at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614) at org.codehaus.groovy.runtime.Invoker.invokePojoMethod (Invoker.java:87) at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:75) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158) at org.codehaus.groovy.tools.shell.Shell.setProperty (Shell.groovy) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.setGroovyObjectProperty (ScriptBytecodeAdapter.ja va:571) at org.codehaus.groovy.tools.shell.Groovysh.execute (Groovysh.groovy:182) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64) at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav a:66) at org.codehaus.groovy.tools.shell.Shell.leftShift (Shell.groovy:121) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64) at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614) at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98) at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158) at org.codehaus.groovy.tools.shell.ShellRunner.work (ShellRunner.groovy:88) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64) at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrentN (ScriptBytecodeAdapter.jav a:66) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnCurrent0 (ScriptBytecodeAdapter.jav a:99) at org.codehaus.groovy.tools.shell.ShellRunner.run (ShellRunner.groovy:57) at org.codehaus.groovy.tools.shell.InteractiveShellRunner.super$2$run (InteractiveShellRunner.groovy) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64) at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN (ScriptBytecodeAdapter.java: 118) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuper0 (ScriptBytecodeAdapter.java: 142) at org.codehaus.groovy.tools.shell.InteractiveShellRunner.run (InteractiveShellRunner.groovy:64) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64) at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614) at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98) at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod0 (ScriptBytecodeAdapter.java:201) at org.codehaus.groovy.tools.shell.Groovysh.run (Groovysh.groovy:446) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.codehaus.groovy.runtime.metaclass.ReflectionMetaMethod.invoke (ReflectionMetaMethod.java:64) at org.codehaus.groovy.runtime.MetaClassHelper.doMethodInvoke (MetaClassHelper.java:537) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:772) at groovy.lang.MetaClassImpl.invokeMethod (MetaClassImpl.java:614) at org.codehaus.groovy.runtime.Invoker.invokePogoMethod (Invoker.java:98) at org.codehaus.groovy.runtime.Invoker.invokeMethod (Invoker.java:79) at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod (InvokerHelper.java:74) at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodN (ScriptBytecodeAdapter.java:158) at org.codehaus.groovy.tools.shell.Groovysh.main (Groovysh.groovy:591) at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke (Method.java:597) at org.codehaus.groovy.tools.GroovyStarter.rootLoader (GroovyStarter.java:101) at org.codehaus.groovy.tools.GroovyStarter.main (GroovyStarter.java:130) groovy0):000>
Hide
Daniel.Sun added a comment -

If possible, please provide an entry to access the original full stacktrace to report bug

Show
Daniel.Sun added a comment - If possible, please provide an entry to access the original full stacktrace to report bug
Hide
Guillaume Laforge added a comment -

Agreed Daniel. With the -d flag (d for debug), we should be allowed to see the full stacktrace.

Show
Guillaume Laforge added a comment - Agreed Daniel. With the -d flag (d for debug), we should be allowed to see the full stacktrace.
Hide
Jason Dillon added a comment -

I'm not really sure what else that can be easily trimmed out of the stack traces... I've already trimmed things up to the groovysh_evaluate.run invocation. And ya, you should see the full traces when --debug is set.

Show
Jason Dillon added a comment - I'm not really sure what else that can be easily trimmed out of the stack traces... I've already trimmed things up to the groovysh_evaluate.run invocation. And ya, you should see the full traces when --debug is set.
Hide
Guillaume Laforge added a comment -

Several packages should be filtered by default:

groovy.*/*
org.codehaus.groovy.*/*
java.*/*
javax.*/*
sun.*/*

Show
Guillaume Laforge added a comment - Several packages should be filtered by default: groovy.*/* org.codehaus.groovy.*/* java.*/* javax.*/* sun.*/*
Hide
Danno Ferrin added a comment -

I lifted the sanitize stack trace stuff from grails and moved it into org.codehaus.groovy.runtime.StackTraceUtils, I am using it in GroovyConsole.

Just updated the defaults to reflect Guillaume's default.

The defaults can be changed by setting the system property "groovy.sanitized.stacktraces" to a comma/whitespace separated list of class prefixes (no globbing or regexing, not that advanced). This hast to be done before the class is loaded however.

I tried looking into getting this added to new shell, but ran out of time and the fix in console was working.

Show
Danno Ferrin added a comment - I lifted the sanitize stack trace stuff from grails and moved it into org.codehaus.groovy.runtime.StackTraceUtils, I am using it in GroovyConsole. Just updated the defaults to reflect Guillaume's default. The defaults can be changed by setting the system property "groovy.sanitized.stacktraces" to a comma/whitespace separated list of class prefixes (no globbing or regexing, not that advanced). This hast to be done before the class is loaded however. I tried looking into getting this added to new shell, but ran out of time and the fix in console was working.
Hide
Jason Dillon added a comment -

I'm not sure that it is a good idea to filter these packages... since sometimes exceptions come from classes in those packages, which ends up producing quite unusable stack traces.

Show
Jason Dillon added a comment - I'm not sure that it is a good idea to filter these packages... since sometimes exceptions come from classes in those packages, which ends up producing quite unusable stack traces.
Hide
Danno Ferrin added a comment - - edited

In the Groovy console I address that issue via View->Show Full Stack Traces. Perhaps a prefs could be set to sanitize? "\= show-full-stack".

Also, when a stack trace is sanitized the throwable is logged first to the 'StackTrace' logger. You could add a log listener, clone the throwables and store them in ' _ ' as the "return value". This allows the user to '_ .printStackTrace()' to get the full stack if it is confusing. If you do a deep sanitize you may want to catch only the first one per iteration.

Show
Danno Ferrin added a comment - - edited In the Groovy console I address that issue via View->Show Full Stack Traces. Perhaps a prefs could be set to sanitize? "\= show-full-stack". Also, when a stack trace is sanitized the throwable is logged first to the 'StackTrace' logger. You could add a log listener, clone the throwables and store them in ' _ ' as the "return value". This allows the user to '_ .printStackTrace()' to get the full stack if it is confusing. If you do a deep sanitize you may want to catch only the first one per iteration.
Hide
Jason Dillon added a comment -

Ya, I think it should be fine add a preference to show the full stack.... I will look at StackTraceUtils and see how I can use it in groovysh.

Show
Jason Dillon added a comment - Ya, I think it should be fine add a preference to show the full stack.... I will look at StackTraceUtils and see how I can use it in groovysh.
Hide
Jason Dillon added a comment -

StackTraceUtils looks good... except its spitting out logging crap, which makes the output even harder to grok... I think we need to remove that logging in StackTraceUtils... and then I'm happy happy to add this.

Show
Jason Dillon added a comment - StackTraceUtils looks good... except its spitting out logging crap, which makes the output even harder to grok... I think we need to remove that logging in StackTraceUtils... and then I'm happy happy to add this.
Hide
Jason Dillon added a comment -

Um... I think I'm just gonna rip out that logging... if someone is using StackTraceUtils and they are worried about losing trace data, they should either log it themselves... or not use StackTraceUtils.

I'm gonna hook this up and use the sanitize-stack-trace preference (ala \=) to flip it on or off. And when --verbose is set, then it will override, so they always get the non-sanitize stack trace.

Will that work for everyone?

Show
Jason Dillon added a comment - Um... I think I'm just gonna rip out that logging... if someone is using StackTraceUtils and they are worried about losing trace data, they should either log it themselves... or not use StackTraceUtils. I'm gonna hook this up and use the sanitize-stack-trace preference (ala \=) to flip it on or off. And when --verbose is set, then it will override, so they always get the non-sanitize stack trace. Will that work for everyone?
Hide
Jason Dillon added a comment -

I've hooked up StackTraceUtils to sanitize the stack trace by default. Lemme know if there is more filtering/sanitization you want to see.

Show
Jason Dillon added a comment - I've hooked up StackTraceUtils to sanitize the stack trace by default. Lemme know if there is more filtering/sanitization you want to see.
Hide
Guillaume Laforge added a comment -

Cool, I'll try this out.

Show
Guillaume Laforge added a comment - Cool, I'll try this out.

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: