public final class JNIExceptionWrapper extends RuntimeException
| Modifier and Type | Class and Description |
|---|---|
static interface |
JNIExceptionWrapper.ExceptionHandler |
static class |
JNIExceptionWrapper.ExceptionHandlerContext
Context for
JNIExceptionWrapper.ExceptionHandler. |
| Modifier and Type | Method and Description |
|---|---|
static JNI.JThrowable |
createHSException(JNI.JNIEnv env,
Throwable original)
Crates an exception in HotSpot representing the given
original exception. |
static JNIExceptionWrapper |
forHSException(JNI.JNIEnv env,
JNI.JThrowable jThrowable)
Creates a new
JNIExceptionWrapper for given HotSpot exception. |
static StackTraceElement[] |
mergeStackTraces(StackTraceElement[] hotSpotStackTrace,
StackTraceElement[] nativeStackTrace,
boolean originatedInHotSpot) |
static void |
throwInHotSpot(JNI.JNIEnv env,
Throwable original)
Throws an exception into HotSpot.
|
static void |
wrapAndThrowPendingJNIException(JNI.JNIEnv env)
If there is a pending JNI exception, this method wraps it in a
JNIExceptionWrapper,
clears the pending exception and throws the JNIExceptionWrapper wrapper. |
static void |
wrapAndThrowPendingJNIException(JNI.JNIEnv env,
JNIExceptionWrapper.ExceptionHandler exceptionHandler)
If there is a pending JNI exception, this method wraps it in a
JNIExceptionWrapper,
clears the pending exception and throws the JNIExceptionWrapper wrapper. |
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toStringpublic static void wrapAndThrowPendingJNIException(JNI.JNIEnv env)
JNIExceptionWrapper,
clears the pending exception and throws the JNIExceptionWrapper wrapper. The
JNIExceptionWrapper message is composed of the JNI exception class name and the JNI
exception message. For exception filtering or custom handling of JNI exceptions see
#wrapAndThrowPendingJNIException(JNIEnv, ExceptionHandler).public static void wrapAndThrowPendingJNIException(JNI.JNIEnv env, JNIExceptionWrapper.ExceptionHandler exceptionHandler)
JNIExceptionWrapper,
clears the pending exception and throws the JNIExceptionWrapper wrapper. The
JNIExceptionWrapper message is composed of the JNI exception class name and the JNI
exception message.JNIExceptionWrapper.ExceptionHandlerpublic static void throwInHotSpot(JNI.JNIEnv env, Throwable original)
original is a JNIExceptionWrapper the wrapped JNI exception is thrown.
Otherwise a new RuntimeException is thrown. The RuntimeException message is
composed of original.getClass().getName() and original.getMessage(). The
stack trace is result of merging the original.getStackTrace() with the current
execution stack in HotSpot.env - the JNI.JNIEnvoriginal - an exception to be thrown in HotSpotpublic static JNI.JThrowable createHSException(JNI.JNIEnv env, Throwable original)
original exception.env - the JNI.JNIEnvoriginal - an exception to be created in HotSpotpublic static JNIExceptionWrapper forHSException(JNI.JNIEnv env, JNI.JThrowable jThrowable)
JNIExceptionWrapper for given HotSpot exception.public static StackTraceElement[] mergeStackTraces(StackTraceElement[] hotSpotStackTrace, StackTraceElement[] nativeStackTrace, boolean originatedInHotSpot)