org.codehaus.groovy.runtime
Class StackTraceUtils

Originally was grails.utils.GrailsUtils, removed some grails specific stuff. Utility methods removing internal lines from stack traces

author:
Graeme Rocher
since:
0.2
version:
$Revision: 5544 $
First Created: 02-Jun-2006 Last Updated: $Date: 2007-09-21 13:53:07 -0500 (Fri, 21 Sep 2007) $

Field Summary
 def GROOVY_PACKAGES
           
 Logger STACK_LOG
           
 String STACK_LOG_NAME
           
 
Constructor Summary
StackTraceUtils()
           
 
Method Summary
static Throwable deepSanitize(Throwable t)
          

Sanitize the exception and ALL nested causes

This will MODIFY the stacktrace of the exception instance and all its causes irreversibly

static Throwable extractRootCause(Throwable t)
          

Extracts the root cause of the exception, no matter how nested it is

static boolean isApplicationClass(String className)
          
static void printSanitizedStackTrace(Throwable t, PrintWriter p)
          
static void printSanitizedStackTrace(Throwable t)
          
static Throwable sanitize(Throwable t)
          

Remove all apparently groovy-internal trace entries from the exception instance

This modifies the original instance and returns it, it does not clone

static Throwable sanitizeRootCause(Throwable t)
          

Get the root cause of an exception and sanitize it for display to the user

This will MODIFY the stacktrace of the root cause exception object and return it

 

Constructor Detail

StackTraceUtils

StackTraceUtils()


Method Detail

deepSanitize

public static Throwable deepSanitize(Throwable t)

Sanitize the exception and ALL nested causes

This will MODIFY the stacktrace of the exception instance and all its causes irreversibly

param:
t
return:
The root cause exception instances, with stack trace modified to filter out groovy runtime classes


extractRootCause

public static Throwable extractRootCause(Throwable t)

Extracts the root cause of the exception, no matter how nested it is

param:
t
return:
The deepest cause of the exception that can be found


isApplicationClass

public static boolean isApplicationClass(String className)


printSanitizedStackTrace

public static void printSanitizedStackTrace(Throwable t, PrintWriter p)


printSanitizedStackTrace

public static void printSanitizedStackTrace(Throwable t)


sanitize

public static Throwable sanitize(Throwable t)

Remove all apparently groovy-internal trace entries from the exception instance

This modifies the original instance and returns it, it does not clone

param:
t
return:
The exception passed in, after cleaning the stack trace


sanitizeRootCause

public static Throwable sanitizeRootCause(Throwable t)

Get the root cause of an exception and sanitize it for display to the user

This will MODIFY the stacktrace of the root cause exception object and return it

param:
t
return:
The root cause exception instance, with its stace trace modified to filter out groovy runtime classes