From 8b5e23eac31cafbd442a3acab5fbcf98bfd0af11 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 1 Mar 2019 14:42:38 +0200 Subject: log nice exception messages whereever possible Change-Id: Idd125c18bee1a39b9ea8cc4f8c55cddfd37c33e1 Reviewed-on: https://gerrit.libreoffice.org/68579 Tested-by: Jenkins Reviewed-by: Noel Grandin --- javaunohelper/Library_juhx.mk | 1 + javaunohelper/source/bootstrap.cxx | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'javaunohelper') diff --git a/javaunohelper/Library_juhx.mk b/javaunohelper/Library_juhx.mk index 1a24e5ef54f2..6eacff250c0f 100644 --- a/javaunohelper/Library_juhx.mk +++ b/javaunohelper/Library_juhx.mk @@ -19,6 +19,7 @@ $(eval $(call gb_Library_use_libraries,juhx,\ jvmaccess \ sal \ salhelper \ + tl \ )) $(eval $(call gb_Library_add_exception_objects,juhx,\ diff --git a/javaunohelper/source/bootstrap.cxx b/javaunohelper/source/bootstrap.cxx index cb927de74e9f..442dd00ef2c5 100644 --- a/javaunohelper/source/bootstrap.cxx +++ b/javaunohelper/source/bootstrap.cxx @@ -38,6 +38,7 @@ #include #include #include +#include #include "juhx-export-functions.hxx" #include "vm.hxx" @@ -148,10 +149,11 @@ jobject Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap( } catch (const RuntimeException & exc) { + css::uno::Any exAny( cppu::getCaughtException() ); jclass c = jni_env->FindClass( "com/sun/star/uno/RuntimeException" ); if (nullptr != c) { - SAL_WARN("javaunohelper", "forwarding RuntimeException: " << exc ); + SAL_WARN("javaunohelper", "forwarding RuntimeException: " << exceptionToString(exAny) ); OString cstr( OUStringToOString( exc.Message, RTL_TEXTENCODING_JAVA_UTF8 ) ); jni_env->ThrowNew( c, cstr.getStr() ); @@ -159,10 +161,11 @@ jobject Java_com_sun_star_comp_helper_Bootstrap_cppuhelper_1bootstrap( } catch (const Exception & exc) { + css::uno::Any ex( cppu::getCaughtException() ); jclass c = jni_env->FindClass( "com/sun/star/uno/Exception" ); if (nullptr != c) { - SAL_WARN("javaunohelper", "forwarding Exception: " << exc ); + SAL_WARN("javaunohelper", "forwarding Exception: " << exceptionToString(ex) ); OString cstr( OUStringToOString( exc.Message, RTL_TEXTENCODING_JAVA_UTF8 ) ); jni_env->ThrowNew( c, cstr.getStr() ); -- cgit v1.2.3