summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-02-05 17:34:10 +0100
committerStephan Bergmann <sbergman@redhat.com>2020-02-06 11:16:42 +0100
commit75c21f5a9298b8fa6ea6e8b6ae9f6bd59c442b36 (patch)
tree973135ab49553b634a9feee00705e62bf52bb2f2 /stoc
parent6fe261ea098c0e59c19307380de2b2c1d51895cc (diff)
Be more verbose about JNI errors at least with --enable-dbgutil
("The Java Native Interface" by Sheng Liang, Addison-Wesley 1999, states on page 211: "This function [ExceptionDescribe] has the side effect of clearing the pending exception." And since Java 10, the documentation of ExceptionDescription at <https://docs.oracle.com/javase/10/docs/specs/jni/ functions.html#exceptiondescribe> states that "[t]he pending exception is cleared as a side-effect of calling this function", even though for Java 8 <https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/functions.html# ExceptionDescribe> does not mention that. So assume that calling ExceptionDescribe always makes calling ExceptionClear superfluous.) Change-Id: I4f89eb44768d436a224d7027afb5e7a93f092f29 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88050 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/javavm/javavm.cxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 84120eaa3c85..7df1fed46c57 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -1582,7 +1582,11 @@ void JavaVirtualMachine::setUpUnoVirtualMachine(JNIEnv * environment) {
}
void JavaVirtualMachine::handleJniException(JNIEnv * environment) {
+#if defined DBG_UTIL
+ environment->ExceptionDescribe();
+#else
environment->ExceptionClear();
+#endif
throw css::uno::RuntimeException(
"JNI exception occurred",
static_cast< cppu::OWeakObject * >(this));