java.lang.reflect
Class UndeclaredThrowableException

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.lang.Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable 
      extended by java.lang.Exception sample code for java.lang.Exception definition code for java.lang.Exception 
          extended by java.lang.RuntimeException sample code for java.lang.RuntimeException definition code for java.lang.RuntimeException 
              extended by java.lang.reflect.UndeclaredThrowableException
All Implemented Interfaces:
Serializable sample code for java.io.Serializable definition code for java.io.Serializable

public class UndeclaredThrowableException
extends RuntimeException sample code for java.lang.RuntimeException definition code for java.lang.RuntimeException

Thrown by a method invocation on a proxy instance if its invocation handler's invoke sample code for java.lang.reflect.InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) definition code for java.lang.reflect.InvocationHandler.invoke(java.lang.Object, java.lang.reflect.Method, java.lang.Object[]) method throws a checked exception (a Throwable that is not assignable to RuntimeException or Error) that is not assignable to any of the exception types declared in the throws clause of the method that was invoked on the proxy instance and dispatched to the invocation handler.

An UndeclaredThrowableException instance contains the undeclared checked exception that was thrown by the invocation handler, and it can be retrieved with the getUndeclaredThrowable() method. UndeclaredThrowableException extends RuntimeException, so it is an unchecked exception that wraps a checked exception.

As of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism. The "undeclared checked exception that was thrown by the invocation handler" that may be provided at construction time and accessed via the getUndeclaredThrowable() sample code for java.lang.reflect.UndeclaredThrowableException.getUndeclaredThrowable() definition code for java.lang.reflect.UndeclaredThrowableException.getUndeclaredThrowable() method is now known as the cause, and may be accessed via the Throwable.getCause() sample code for java.lang.Throwable.getCause() definition code for java.lang.Throwable.getCause() method, as well as the aforementioned "legacy method."

Since:
JDK1.3
See Also:
InvocationHandler sample code for java.lang.reflect.InvocationHandler definition code for java.lang.reflect.InvocationHandler , Serialized Form

Constructor Summary
UndeclaredThrowableException sample code for java.lang.reflect.UndeclaredThrowableException.UndeclaredThrowableException(java.lang.Throwable) definition code for java.lang.reflect.UndeclaredThrowableException.UndeclaredThrowableException(java.lang.Throwable) (Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable  undeclaredThrowable)
          Constructs an UndeclaredThrowableException with the specified Throwable.
UndeclaredThrowableException sample code for java.lang.reflect.UndeclaredThrowableException.UndeclaredThrowableException(java.lang.Throwable, java.lang.String) definition code for java.lang.reflect.UndeclaredThrowableException.UndeclaredThrowableException(java.lang.Throwable, java.lang.String) (Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable  undeclaredThrowable, String sample code for java.lang.String definition code for java.lang.String  s)
          Constructs an UndeclaredThrowableException with the specified Throwable and a detail message.
 
Method Summary
 Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable getCause sample code for java.lang.reflect.UndeclaredThrowableException.getCause() definition code for java.lang.reflect.UndeclaredThrowableException.getCause() ()
          Returns the cause of this exception (the Throwable instance wrapped in this UndeclaredThrowableException, which may be null).
 Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable getUndeclaredThrowable sample code for java.lang.reflect.UndeclaredThrowableException.getUndeclaredThrowable() definition code for java.lang.reflect.UndeclaredThrowableException.getUndeclaredThrowable() ()
          Returns the Throwable instance wrapped in this UndeclaredThrowableException, which may be null.
 
Methods inherited from class java.lang.Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable
fillInStackTrace sample code for java.lang.Throwable.fillInStackTrace() definition code for java.lang.Throwable.fillInStackTrace() , getLocalizedMessage sample code for java.lang.Throwable.getLocalizedMessage() definition code for java.lang.Throwable.getLocalizedMessage() , getMessage sample code for java.lang.Throwable.getMessage() definition code for java.lang.Throwable.getMessage() , getStackTrace sample code for java.lang.Throwable.getStackTrace() definition code for java.lang.Throwable.getStackTrace() , initCause sample code for java.lang.Throwable.initCause(java.lang.Throwable) definition code for java.lang.Throwable.initCause(java.lang.Throwable) , printStackTrace sample code for java.lang.Throwable.printStackTrace() definition code for java.lang.Throwable.printStackTrace() , printStackTrace sample code for java.lang.Throwable.printStackTrace(java.io.PrintStream) definition code for java.lang.Throwable.printStackTrace(java.io.PrintStream) , printStackTrace sample code for java.lang.Throwable.printStackTrace(java.io.PrintWriter) definition code for java.lang.Throwable.printStackTrace(java.io.PrintWriter) , setStackTrace sample code for java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]) definition code for java.lang.Throwable.setStackTrace(java.lang.StackTraceElement[]) , toString sample code for java.lang.Throwable.toString() definition code for java.lang.Throwable.toString()
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

UndeclaredThrowableException sample code for java.lang.reflect.UndeclaredThrowableException(java.lang.Throwable) definition code for java.lang.reflect.UndeclaredThrowableException(java.lang.Throwable)

public UndeclaredThrowableException(Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable  undeclaredThrowable)
Constructs an UndeclaredThrowableException with the specified Throwable.

Parameters:
undeclaredThrowable - the undeclared checked exception that was thrown

UndeclaredThrowableException sample code for java.lang.reflect.UndeclaredThrowableException(java.lang.Throwable, java.lang.String) definition code for java.lang.reflect.UndeclaredThrowableException(java.lang.Throwable, java.lang.String)

public UndeclaredThrowableException(Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable  undeclaredThrowable,
                                    String sample code for java.lang.String definition code for java.lang.String  s)
Constructs an UndeclaredThrowableException with the specified Throwable and a detail message.

Parameters:
undeclaredThrowable - the undeclared checked exception that was thrown
s - the detail message
Method Detail

getUndeclaredThrowable sample code for java.lang.reflect.UndeclaredThrowableException.getUndeclaredThrowable() definition code for java.lang.reflect.UndeclaredThrowableException.getUndeclaredThrowable()

public Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable  getUndeclaredThrowable()
Returns the Throwable instance wrapped in this UndeclaredThrowableException, which may be null.

This method predates the general-purpose exception chaining facility. The Throwable.getCause() sample code for java.lang.Throwable.getCause() definition code for java.lang.Throwable.getCause() method is now the preferred means of obtaining this information.

Returns:
the undeclared checked exception that was thrown

getCause sample code for java.lang.reflect.UndeclaredThrowableException.getCause() definition code for java.lang.reflect.UndeclaredThrowableException.getCause()

public Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable  getCause()
Returns the cause of this exception (the Throwable instance wrapped in this UndeclaredThrowableException, which may be null).

Overrides:
getCause sample code for java.lang.Throwable.getCause() definition code for java.lang.Throwable.getCause() in class Throwable sample code for java.lang.Throwable definition code for java.lang.Throwable
Returns:
the cause of this exception.
Since:
1.4