Project Wonder 5.0.0.8795

er.extensions.foundation
Class ERXExceptionUtilities

java.lang.Object
  extended by er.extensions.foundation.ERXExceptionUtilities

public class ERXExceptionUtilities
extends Object

Provides a set of utilities for displaying and managing exceptions.

Author:
mschrag

Nested Class Summary
static class ERXExceptionUtilities.HideStackTraceException
          Wraps a root cause, but does not render a stack trace to the given writer.
static interface ERXExceptionUtilities.WeDontNeedAStackTraceException
          Implemented by any exception that you explicitly want to not appear in stack dumps.
 
Field Summary
static Logger log
           
 
Constructor Summary
ERXExceptionUtilities()
           
 
Method Summary
protected static void _printSingleStackTrace(Throwable t, PrintWriter writer, int exceptionDepth, boolean cleanupStackTrace)
           
protected static Throwable getCause(Throwable t)
          Returns the cause of an exception.
static Throwable getMeaningfulThrowable(Throwable t)
          Returns the "meaningful" root cause from a throwable.
static void logStackTrace()
          Logs a debug stack trace.
static void printStackTrace()
          Prints a debug stack trace to the console.
static void printStackTrace(Throwable t)
          Prints the given throwable to the console (stdout).
static void printStackTrace(Throwable t, OutputStream os)
          Prints the given throwable to the given outputstream.
static void printStackTrace(Throwable t, PrintWriter writer)
          Prints the given throwable to the given printwriter.
static void printStackTrace(Throwable t, PrintWriter writer, int exceptionDepth)
          Prints the given throwable to the given writer with an indent.
static void printStackTrace(Throwable t, Writer writer)
          Prints the given throwable to the given printwriter.
static String toParagraph(Throwable t)
          Returns a paragraph form of the given throwable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

public static Logger log
Constructor Detail

ERXExceptionUtilities

public ERXExceptionUtilities()
Method Detail

getCause

protected static Throwable getCause(Throwable t)
Returns the cause of an exception. This should be modified to be pluggable.

Parameters:
t - the original exception
Returns:
the cause of the exception or null of there isn't one

toParagraph

public static String toParagraph(Throwable t)
Returns a paragraph form of the given throwable.

Parameters:
t - the throwable to convert to paragraph form
Returns:
the paragraph string

getMeaningfulThrowable

public static Throwable getMeaningfulThrowable(Throwable t)
Returns the "meaningful" root cause from a throwable. For instance, an InvocationTargetException is useless -- it's the cause that matters.

Parameters:
t - the meaningful exception given another throwable
Returns:
the meaningful exception

printStackTrace

public static void printStackTrace()
Prints a debug stack trace to the console.


logStackTrace

public static void logStackTrace()
Logs a debug stack trace.


printStackTrace

public static void printStackTrace(Throwable t)
Prints the given throwable to the console (stdout).

Parameters:
t - the throwable to print

printStackTrace

public static void printStackTrace(Throwable t,
                                   OutputStream os)
Prints the given throwable to the given outputstream.

Parameters:
t - the throwable to print
os - the stream to print to

printStackTrace

public static void printStackTrace(Throwable t,
                                   Writer writer)
Prints the given throwable to the given printwriter.

Parameters:
t - the throwable to print
writer - the writer to print to

printStackTrace

public static void printStackTrace(Throwable t,
                                   PrintWriter writer)
Prints the given throwable to the given printwriter.

Parameters:
t - the throwable to print
writer - the writer to print to

_printSingleStackTrace

protected static void _printSingleStackTrace(Throwable t,
                                             PrintWriter writer,
                                             int exceptionDepth,
                                             boolean cleanupStackTrace)

printStackTrace

public static void printStackTrace(Throwable t,
                                   PrintWriter writer,
                                   int exceptionDepth)
Prints the given throwable to the given writer with an indent.

Parameters:
t - the throwable to print
writer - the writer to print to
exceptionDepth - the indent level to use

Last updated: Fri, Jan 9, 2009 • 04:35 AM EST

Copyright © 2002 – 2007 Project Wonder.