com.sas.net.util
Class RuntimeWrapperException

java.lang.Object
  |
  +--java.lang.Throwable
        |
        +--java.lang.Exception
              |
              +--java.lang.RuntimeException
                    |
                    +--com.sas.net.util.RuntimeWrapperException
All Implemented Interfaces:

public abstract class RuntimeWrapperException
extends RuntimeException

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 unchecked exceptions. There is also a WrapperException to use as a base class for checked 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); } }

See Also:
Serialized Form

Constructor Summary
RuntimeWrapperException()
          No-argument constructor.
RuntimeWrapperException(String message)
          Constructor with message.
RuntimeWrapperException(String message, Throwable nestedException)
          Wrapper constructor.
RuntimeWrapperException(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

RuntimeWrapperException

public RuntimeWrapperException()
No-argument constructor.

RuntimeWrapperException

public RuntimeWrapperException(String message)
Constructor with message.
Parameters:
message - a message adding detail to the exception

RuntimeWrapperException

public RuntimeWrapperException(Throwable nestedException)
Wrapper constructor.
Parameters:
nestedException - exception being wrapped

RuntimeWrapperException

public RuntimeWrapperException(String message,
                               Throwable nestedException)
Wrapper constructor.
Parameters:
message - a message to include in the exception.
nestedException - an exception being wrapped.
Method Detail

getMessage

public String getMessage()
Overrides:
getMessage in class Throwable
See Also:
Throwable.getMessage()

getLocalizedMessage

public String getLocalizedMessage()
Overrides:
getLocalizedMessage in class Throwable
See Also:
Throwable.getLocalizedMessage()

toString

public String toString()
Overrides:
toString in class Throwable
See Also:
Throwable.toString()

printStackTrace

public void printStackTrace()
Overrides:
printStackTrace in class Throwable
See Also:
Throwable.printStackTrace()

printStackTrace

public void printStackTrace(PrintStream p)
Overrides:
printStackTrace in class Throwable
See Also:
Throwable.printStackTrace()

printStackTrace

public void printStackTrace(PrintWriter p)
Overrides:
printStackTrace in class Throwable
See Also:
Throwable.printStackTrace()

fillInStackTrace

public Throwable fillInStackTrace()
Overrides:
fillInStackTrace in class Throwable
See Also:
Throwable.fillInStackTrace()

getNestedException

public Throwable getNestedException()
Gets the nested exception.
Returns:
The nested exception.



Copyright © 2003 SAS Institute Inc. All Rights Reserved.
javadoc generated Fri, 09 Jul 2004 16:13:38