invoke 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.
InvocationHandler
| Modifier and Type | Field and Description |
|---|---|
| private static final ObjectStreamField[] | serialPersistentFields
Serializable fields for UndeclaredThrowableException. |
| pack-priv static final long |
| Access | Constructor and Description |
|---|---|
| public | UndeclaredThrowableException(Throwable
the undeclared checked exception
that was thrown, may be undeclaredThrowable)nullConstructs an |
| public | UndeclaredThrowableException(Throwable
the undeclared checked exception
that was thrown, may be undeclaredThrowable, String nullthe detail message, may be s)nullConstructs an |
| Modifier and Type | Method and Description |
|---|---|
| public Throwable | Returns: the undeclared checked exception that was thrownReturns the |
| private void | readObject(ObjectInputStream
the s)ObjectInputStream from which data is readHides java. Reconstitutes the UndeclaredThrowableException instance from a stream and initialize the cause properly when deserializing from an older version. |
| private void | writeObject(ObjectOutputStream
the out)ObjectOutputStream to which data is writtenHides java. To maintain compatibility with older implementation, write a serial "ex" field with the cause as the value. |
| serialPersistentFields | back to summary |
|---|---|
| private static final ObjectStreamField[] serialPersistentFields Serializable fields for UndeclaredThrowableException.
| |
| serialVersionUID | back to summary |
|---|---|
| pack-priv static final long serialVersionUID Hides java. | |
| UndeclaredThrowableException | back to summary |
|---|---|
| public UndeclaredThrowableException(Throwable undeclaredThrowable) Constructs an
| |
| UndeclaredThrowableException | back to summary |
|---|---|
| public UndeclaredThrowableException(Throwable undeclaredThrowable, String s) Constructs an | |
| getUndeclaredThrowable | back to summary |
|---|---|
| public Throwable getUndeclaredThrowable() Returns the API Note This method predates the general-purpose exception chaining facility.
The
| |
| readObject | back to summary |
|---|---|
| private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException Hides java. Reconstitutes the UndeclaredThrowableException instance from a stream and initialize the cause properly when deserializing from an older version.
| |
| writeObject | back to summary |
|---|---|
| private void writeObject(ObjectOutputStream out) throws IOException Hides java. To maintain compatibility with older implementation, write a serial "ex" field with the cause as the value.
| |