org.apache.commons.lang.exception
Class NestableDelegate
java.lang.Object
|
+--org.apache.commons.lang.exception.NestableDelegate
- public class NestableDelegate
- extends java.lang.Object
- Version:
- $Id: NestableDelegate.java,v 1.1 2002/07/19 03:35:54 bayard Exp $
- Author:
- Rafal Krzewski, Daniel Rall, Kasper Nielsen, Steven Caswell
Field Summary |
private Nestable |
cause
Holds the reference to the exception or error that caused
this exception to be thrown. |
private static java.lang.String |
MUST_BE_THROWABLE
Constructor error message. |
Method Summary |
private java.lang.String[] |
decompose(java.lang.Throwable t)
Captures the stack trace associated with a Throwable
object, decomposing it into a list of stack frames. |
(package private) int |
getLength()
Returns the number of Throwable s contained in the
Nestable contained by this delegate. |
(package private) java.lang.String |
getMessage(int index)
|
(package private) java.lang.String |
getMessage(java.lang.String baseMsg)
|
(package private) java.lang.String[] |
getMessages()
|
(package private) java.lang.Throwable |
getThrowable(int index)
|
(package private) java.lang.Throwable[] |
getThrowables()
|
(package private) int |
indexOfThrowable(int pos,
java.lang.Class type)
|
void |
printStackTrace()
Prints the stack trace of this exception the the standar error
stream. |
void |
printStackTrace(java.io.PrintStream out)
Prints the stack trace of this exception to the specified print stream. |
void |
printStackTrace(java.io.PrintWriter out)
Prints the stack trace of this exception to the specified print writer. |
Methods inherited from class java.lang.Object |
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait |
MUST_BE_THROWABLE
private static final java.lang.String MUST_BE_THROWABLE
- Constructor error message.
cause
private Nestable cause
- Holds the reference to the exception or error that caused
this exception to be thrown.
NestableDelegate
NestableDelegate(Nestable cause)
- Parameters:
cause
- The Nestable implementation to get a stack trace for
(must extend Throwable
).
getLength
int getLength()
- Returns the number of
Throwable
s contained in the
Nestable
contained by this delegate.
getMessage
java.lang.String getMessage(java.lang.String baseMsg)
- Parameters:
baseMsg
- The base message to use when creating the full
message. Should be generally be called via
nestableHelper.getMessage(super.getMessage())
,
where super
is an instance of Throwable
.- Returns:
- The concatenated message for this and all nested
exceptions.
getMessage
java.lang.String getMessage(int index)
getThrowable
java.lang.Throwable getThrowable(int index)
getThrowables
java.lang.Throwable[] getThrowables()
getMessages
java.lang.String[] getMessages()
indexOfThrowable
int indexOfThrowable(int pos,
java.lang.Class type)
printStackTrace
public void printStackTrace()
- Prints the stack trace of this exception the the standar error
stream.
printStackTrace
public void printStackTrace(java.io.PrintStream out)
- Prints the stack trace of this exception to the specified print stream.
- Parameters:
out
- PrintStream
to use for output.
printStackTrace
public void printStackTrace(java.io.PrintWriter out)
- Prints the stack trace of this exception to the specified print writer.
- Parameters:
out
- PrintWriter
to use for output.
decompose
private java.lang.String[] decompose(java.lang.Throwable t)
- Captures the stack trace associated with a
Throwable
object, decomposing it into a list of stack frames.
- Parameters:
t
- The Throwable
.- Returns:
- An array of strings describing each stack frame.
Copyright (c) 2001-2002 - Apache Software Foundation