foundry.throwables
Class ThrowableSupport
java.lang.Object
|
+--foundry.throwables.ThrowableSupport
- public final class ThrowableSupport
- extends Object
A static class that provides support for working with Throwables and ThrowableContainers.
- Version:
- $Revision: 1.4 $
- Author:
- Laird Nelson
- See Also:
ThrowableContainer,
Throwable
| Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
ThrowableSupport
public ThrowableSupport()
getStackTrace
public static final String getStackTrace(ThrowableContainer tc)
- Returns the stack trace of the
Throwable associated with
the supplied ThrowableContainer. If the supplied ThrowableContainer is itself an instance of Throwable,
then its stack trace is returned as well. In fact, all reachable
stack traces are represented in the returned String.
- Parameters:
tc - a ThrowableContainer- Returns:
- all stack traces reachable from the supplied
ThrowableContainer
getStackTrace
public static String getStackTrace(Throwable t)
- Returns the stack trace of the supplied
Throwable.
- Parameters:
t - a Throwable- Returns:
- the stack trace of the supplied
Throwable
printStackTrace
public static void printStackTrace(ThrowableContainer tc)
- Prints all stack traces reachable from the supplied
ThrowableContainer to System.err. Tabs in the result
are converted to four spaces and each stack trace is indented by
an additional four spaces from its parent's left margin.
- Parameters:
tc - a ThrowableContainer
printStackTrace
public static void printStackTrace(ThrowableContainer tc,
PrintWriter writer)
- Prints all stack traces reachable from the supplied
ThrowableContainer to the supplied PrintWriter.
- Parameters:
tc - a ThrowableContainerwriter - an opened PrintWriter
toString
public static String toString(ThrowableContainer container,
boolean includeClassname)
- Returns a
String representation of the supplied ThrowableContainer. The representation includes the class name
of the supplied ThrowableContainer (if the
includeClassname parameter is true),
its message (if the supplied
ThrowableContainer is itself an instance of Throwable), and the recursively formatted
representation of its contained Throwable, if
it has one.
- Parameters:
container - a ThrowableContainer for which a String representation is to be generated. This parameter may be
null.includeClassname - if true, then the class name
of the supplied ThrowableContainer is prepended to the
representation- Returns:
- a
String representation of the supplied ThrowableContainer, or null if the supplied ThrowableContainer is null
toString
public static String toString(ThrowableContainer container)
- Returns a
String representation of the supplied ThrowableContainer. The representation includes the class name
of the supplied ThrowableContainer, its message (if the supplied ThrowableContainer is itself an instance of Throwable),
and the recursively formatted representation of its contained
Throwable, if it has one.
- Parameters:
container - a ThrowableContainer for which a String representation is to be generated. This parameter may be
null.- Returns:
- a
String representation of the supplied ThrowableContainer, or null if the supplied ThrowableContainer is null
Copyright © 2000 - Laird Jarrett Nelson