|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Throwable | +--java.lang.Exception | +--com.sas.net.util.WrapperException
Base class for exceptions that may contain nested exceptions. When there is a nested exception, toString() and printStackTrace(), etc. defer to the nested exception.
If the nested exception is itself a WrapperException, then there will be yet another layer of deferal.
This is for checked exceptions. There is also a RuntimeWrapperException to use as a base class for unchecked exceptions.
Java has it's own notion of a wrapper exception
in java.lang.reflect.InvocationTargetException
.
This class would not exist were it not for three
problems with InvocationTargetException.
This base class is often useful in the following
situation where AnException
extends
WrapperException
:
public void aMethod() throws AnException
{
try
{
doStuff();
}
catch (AnotherException e)
{
throw new AnException(e);
}
}
Constructor Summary | |
WrapperException()
No-argument constructor. |
|
WrapperException(String message)
Constructor with message. |
|
WrapperException(String message,
Throwable nestedException)
Wrapper constructor. |
|
WrapperException(Throwable nestedException)
Wrapper constructor. |
Method Summary | |
Throwable |
fillInStackTrace()
|
String |
getLocalizedMessage()
|
String |
getMessage()
|
Throwable |
getNestedException()
Gets the nested exception. |
void |
printStackTrace()
|
void |
printStackTrace(PrintStream p)
|
void |
printStackTrace(PrintWriter p)
|
String |
toString()
|
Methods inherited from class java.lang.Throwable |
getCause, getStackTrace, initCause, setStackTrace |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public WrapperException()
public WrapperException(String message)
message
- a message adding detail to the exceptionpublic WrapperException(Throwable nestedException)
nestedException
- exception being wrappedpublic WrapperException(String message, Throwable nestedException)
message
- a message to include in the exception.nestedException
- an exception being wrapped.Method Detail |
public String getMessage()
getMessage
in class Throwable
Throwable.getMessage()
public String getLocalizedMessage()
getLocalizedMessage
in class Throwable
Throwable.getLocalizedMessage()
public String toString()
toString
in class Throwable
Throwable.toString()
public void printStackTrace()
printStackTrace
in class Throwable
Throwable.printStackTrace()
public void printStackTrace(PrintStream p)
printStackTrace
in class Throwable
Throwable.printStackTrace()
public void printStackTrace(PrintWriter p)
printStackTrace
in class Throwable
Throwable.printStackTrace()
public Throwable fillInStackTrace()
fillInStackTrace
in class Throwable
Throwable.fillInStackTrace()
public Throwable getNestedException()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |