Index (Frames) | Index (No Frames) | Package | Package Tree | Tree
java.lang.reflect

Class UndeclaredThrowableException

java.lang.Object
|
+--java.lang.Throwable
   |
   +--java.lang.Exception
      |
      +--java.lang.RuntimeException
         |
         +--java.lang.reflect.UndeclaredThrowableException


public class UndeclaredThrowableException

extends RuntimeException

This exception class is thrown by a Proxy instance if the InvocationHandler#invoke(Object, Method, Object[]) invoke method of that instance's InvocationHandler attempts to throw an exception that not declared by the throws clauses of all of the interface methods that the proxy instance is implementing.

When thrown by Proxy, this class will always wrap a checked exception, never Error or RuntimeException, which are unchecked.

Since:Author:See Also:

Constructor Summary

UndeclaredThrowableException(java.lang.Throwable cause)

Wraps the given checked exception into a RuntimeException, with no detail message.
UndeclaredThrowableException(java.lang.Throwable cause, java.lang.String message)

Wraps the given checked exception into a RuntimeException, with the specified detail message.

Method Summary

java.lang.ThrowablegetCause()

Returns the cause of this exception.
java.lang.ThrowablegetUndeclaredThrowable()

Returns the cause of this exception.

Constructor Details

UndeclaredThrowableException

public UndeclaredThrowableException(java.lang.Throwable cause)

Wraps the given checked exception into a RuntimeException, with no detail message. Throwable#initCause(Throwable) will fail on this instance.

Parameters:


UndeclaredThrowableException

public UndeclaredThrowableException(java.lang.Throwable cause, java.lang.String message)

Wraps the given checked exception into a RuntimeException, with the specified detail message. Throwable#initCause(Throwable) will fail on this instance.

Parameters:


Method Details

getCause

public Throwable getCause()

Returns the cause of this exception. If this exception was created by a Proxy instance, it will be a non-null checked exception.

Since:Returns:


getUndeclaredThrowable

public Throwable getUndeclaredThrowable()

Returns the cause of this exception. If this exception was created by a Proxy instance, it will be a non-null checked exception. This method pre-dates exception chaining, and is now simply a longer way to call getCause().

Returns:

See Also: