## org.codehaus.groovy.runtime
Class StackTraceUtils

    java.lang.Object
      org.codehaus.groovy.runtime.StackTraceUtils

    public class StackTraceUtils

extends Object

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

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) $
Author:
  Graeme Rocher

Field Summary
`static 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)`
`static void` `printSanitizedStackTrace(Throwable t, PrintWriter p)`
`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

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### STACK_LOG_NAME

    public static final String STACK_LOG_NAME

See Also:
  Constant Field Values

Constructor Detail

### StackTraceUtils

    public StackTraceUtils()

Method Detail

### 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

  Parameters:
    `t` -
  Returns:
    The exception passed in, after cleaning the stack trace

### printSanitizedStackTrace

    public static void printSanitizedStackTrace(Throwable t,
                                                PrintWriter p)

### printSanitizedStackTrace

    public static void printSanitizedStackTrace(Throwable t)

### isApplicationClass

    public static boolean isApplicationClass(String className)

### extractRootCause

    public static Throwable extractRootCause(Throwable t)

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

  Parameters:
    `t` -
  Returns:
    The deepest cause of the exception that can be found

### 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

  Parameters:
    `t` -
  Returns:
    The root cause exception instance, with its stace trace modified to filter out groovy runtime classes

### 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

  Parameters:
    `t` -
  Returns:
    The root cause exception instances, with stack trace modified to filter out groovy runtime classes

Copyright © 2003-2008 The Codehaus. All rights reserved.