From 4544713d3ae7a83d45047b65bf7ba520b3e8762e Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Tue, 10 Apr 2018 10:06:23 +0200 Subject: [PATCH] Adapt remaining cpp_uno bridges to #i114635# ..."C++ UNO bridge should convert non-UNO exceptions into RuntimeException" (), see "Re: CppunitTest_sw_filters_test failing on x86 Linux, std::exception -> uno::RuntimeException". (The msvc_win32_{intel,x86-64} versions already handle non-UNO exceptions in their msc{i,x}_filterCppException functions, in a different way.) Change-Id: Ie359affed6831d16be0de3e3ff065484e28bd9c3 Reviewed-on: https://gerrit.libreoffice.org/52665 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- .../cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx | 24 ++++++++++--- bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx | 31 ++++++++++++---- .../cpp_uno/gcc3_linux_alpha/uno2cpp.cxx | 28 +++++++++++---- .../source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx | 28 +++++++++++---- .../cpp_uno/gcc3_linux_hppa/uno2cpp.cxx | 24 ++++++++++--- .../cpp_uno/gcc3_linux_ia64/uno2cpp.cxx | 16 +++++++++ .../cpp_uno/gcc3_linux_intel/uno2cpp.cxx | 24 ++++++++++--- .../cpp_uno/gcc3_linux_m68k/uno2cpp.cxx | 24 ++++++++++--- .../cpp_uno/gcc3_linux_mips/uno2cpp.cxx | 27 +++++++++++--- .../cpp_uno/gcc3_linux_mips64/uno2cpp.cxx | 27 +++++++++++--- .../cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx | 24 ++++++++++--- .../cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx | 16 +++++++++ .../cpp_uno/gcc3_linux_s390/uno2cpp.cxx | 24 ++++++++++--- .../cpp_uno/gcc3_linux_s390x/uno2cpp.cxx | 28 +++++++++++---- .../cpp_uno/gcc3_linux_sparc/uno2cpp.cxx | 32 +++++++++++++---- .../cpp_uno/gcc3_linux_sparc64/uno2cpp.cxx | 36 ++++++++++++++----- .../cpp_uno/gcc3_solaris_intel/uno2cpp.cxx | 24 ++++++++++--- .../cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx | 32 +++++++++++++---- 18 files changed, 380 insertions(+), 89 deletions(-) diff --git a/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx index 6024ceed5cae..1c8045fafe26 100644 --- a/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx @@ -20,7 +20,10 @@ #include #include +#include +#include #include +#include #include #include "bridge.hxx" @@ -29,8 +32,11 @@ #include "vtables.hxx" #include "share.hxx" + +#include #include #include +#include using namespace ::com::sun::star::uno; @@ -294,10 +300,20 @@ static void cpp_call( try { assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" ); - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr->eTypeClass, - pStackStart, (pStack - pStackStart), pFPR, nFPR ); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr->eTypeClass, + pStackStart, (pStack - pStackStart), pFPR, nFPR ); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx index 7915fa7a9513..9287bb4ea224 100644 --- a/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx @@ -19,7 +19,14 @@ #ifdef __arm64 +#include + +#include +#include + +#include #include +#include #include "bridge.hxx" #include "types.hxx" @@ -348,13 +355,23 @@ static void cpp_call( try { - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeRef, - pStackStart, - (pStack - pStackStart), - pGPR, - pFPR); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeRef, + pStackStart, + (pStack - pStackStart), + pGPR, + pFPR); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx index acc945468958..143b1533479c 100644 --- a/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx @@ -17,10 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include #include +#include +#include +#include #include +#include #include #include "bridge.hxx" @@ -323,12 +329,22 @@ static void cpp_call( try { - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr, - pStackStart, (pStack - pStackStart), - pGPR, nRegs, - pFPR, nRegs ); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr, + pStackStart, (pStack - pStackStart), + pGPR, nRegs, + pFPR, nRegs ); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx index 3fc2602a602b..b8deb4ba7439 100644 --- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx @@ -21,7 +21,9 @@ #include #include +#include #include "com/sun/star/uno/RuntimeException.hpp" +#include #include #include @@ -31,8 +33,10 @@ #include "share.hxx" +#include #include #include +#include /* * Based on http://gcc.gnu.org/PR41443 @@ -524,13 +528,23 @@ static void cpp_call( try { - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeRef, - pStackStart, - (pStack - pStackStart), - pGPR, nGPR, - pFPR); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeRef, + pStackStart, + (pStack - pStackStart), + pGPR, nGPR, + pFPR); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx index 2c81c707253a..656f55c6b29e 100644 --- a/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx @@ -21,7 +21,9 @@ #include #include +#include #include "com/sun/star/uno/RuntimeException.hpp" +#include #include #include @@ -31,8 +33,10 @@ #include "share.hxx" +#include #include #include +#include using namespace ::com::sun::star::uno; @@ -307,11 +311,21 @@ static void cpp_call( try { - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr, bRegisterReturn, - pStackStart, - (pStack - pStackStart), pGPR, pFPR); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr, bRegisterReturn, + pStackStart, + (pStack - pStackStart), pGPR, pFPR); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx index ef5a73fe45e1..bf9b06bc2952 100644 --- a/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx @@ -17,10 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include #include +#include +#include +#include #include +#include #include #include "bridge.hxx" @@ -486,12 +492,22 @@ static void cpp_call( try { + try { callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, pCppReturn, pReturnTypeDescr, bSimpleReturn, pStackStart, ( pStack - pStackStart ), pGPR, nGPR, pFPR, nFPR ); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx index d9ead282e42a..ff8618cf8171 100644 --- a/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx @@ -17,11 +17,17 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include +#include #include #include +#include #include +#include #include #include @@ -155,10 +161,20 @@ void cpp_call( try { assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" ); - CPPU_CURRENT_NAMESPACE::callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr, bSimpleReturn, - reinterpret_cast(pCppStackStart), (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); + try { + CPPU_CURRENT_NAMESPACE::callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr, bSimpleReturn, + reinterpret_cast(pCppStackStart), (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = nullptr; diff --git a/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx index d8da50873fd2..ca3a2477ebc5 100644 --- a/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx @@ -21,7 +21,9 @@ #include #include +#include #include "com/sun/star/uno/RuntimeException.hpp" +#include #include #include @@ -31,8 +33,10 @@ #include "share.hxx" +#include #include #include +#include using namespace ::com::sun::star::uno; @@ -285,11 +289,21 @@ static void cpp_call( try { - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr->eTypeClass, - pStackStart, - (pStack - pStackStart)); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr->eTypeClass, + pStackStart, + (pStack - pStackStart)); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx index 75a55c4ee030..259775f25708 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx @@ -17,9 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include +#include +#include +#include +#include + +#include +#include #include +#include #include #include "bridge.hxx" @@ -389,10 +396,20 @@ namespace try { assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" ); - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr->eTypeClass, pParamType, - (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr->eTypeClass, pParamType, + (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_mips64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_mips64/uno2cpp.cxx index 387b12eacdfe..b65a7819a405 100644 --- a/bridges/source/cpp_uno/gcc3_linux_mips64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_mips64/uno2cpp.cxx @@ -17,10 +17,17 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include #include #include +#include +#include +#include #include +#include #include #include "bridge.hxx" @@ -379,11 +386,21 @@ namespace try { - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeRef, bSimpleReturn, - pStackStart, ( pStack - pStackStart ), - pGPR, pFPR, nREG); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeRef, bSimpleReturn, + pStackStart, ( pStack - pStackStart ), + pGPR, pFPR, nREG); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx index 6b2ac3dd9ec4..7fdd362906ce 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx @@ -17,10 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include #include +#include +#include +#include #include +#include #include #include "bridge.hxx" @@ -480,10 +486,20 @@ static void cpp_call( try { assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)"); - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr->eTypeClass, pParamType, - (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr->eTypeClass, pParamType, + (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx index a77c4022be66..b58a515121f2 100644 --- a/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx @@ -17,10 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include #include +#include +#include +#include #include +#include #include #include "bridge.hxx" @@ -454,12 +460,22 @@ static void cpp_call( try { + try { callVirtualMethod( pAdjustedThisPtr, aVtableSlot.index, pCppReturn, pReturnTypeDescr, pStackStart, ( pStack - pStackStart ), pGPR, nGPR, pFPR, nFPR ); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx index 51e331f5d428..fda52d056ebc 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx @@ -17,10 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include #include +#include +#include +#include #include +#include #include #include "bridge.hxx" @@ -426,10 +432,20 @@ static void cpp_call( try { assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)" ); - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr->eTypeClass, pParamType, - (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr->eTypeClass, pParamType, + (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx index 8e40d003f03c..e7354a4ba8c5 100644 --- a/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx @@ -17,10 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include +#include #include +#include +#include +#include #include +#include #include #include "bridge.hxx" @@ -328,12 +334,22 @@ static void cpp_call( try { - callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr, - pStackStart, (pStack - pStackStart), - pGPR, nGPR, - pFPR, nFPR ); + try { + callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr, + pStackStart, (pStack - pStackStart), + pGPR, nGPR, + pFPR, nFPR ); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx index 99d60d17f351..39b625fb35c2 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx @@ -17,8 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include #include +#include + +#include +#include #include +#include #include #include "bridge.hxx" @@ -395,13 +403,23 @@ static void cpp_call( if( nStackLongs & 1 ) // stack has to be 8 byte aligned nStackLongs++; - callVirtualMethod( - pAdjustedThisPtr, - aVtableSlot.index, - pCppReturn, - pReturnTypeDescr->eTypeClass, - (sal_Int32 *)pCppStackStart, - nStackLongs); + try { + callVirtualMethod( + pAdjustedThisPtr, + aVtableSlot.index, + pCppReturn, + pReturnTypeDescr->eTypeClass, + (sal_Int32 *)pCppStackStart, + nStackLongs); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_linux_sparc64/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_sparc64/uno2cpp.cxx index 939f1b1ee2f3..81012dfdcda3 100644 --- a/bridges/source/cpp_uno/gcc3_linux_sparc64/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_linux_sparc64/uno2cpp.cxx @@ -17,8 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include #include +#include + +#include +#include #include +#include #include #include "bridge.hxx" @@ -637,15 +645,25 @@ static void cpp_call( // pReturnTypeRef, // pCppStackStart, // (long long)nStackHypers); - callVirtualMethod( - pAdjustedThisPtr, - aVtableSlot.index, - pCppReturn, - pReturnTypeRef, - (sal_Int64 *)pCppStackStart, - nStackHypers, - pParams, - nParams); + try { + callVirtualMethod( + pAdjustedThisPtr, + aVtableSlot.index, + pCppReturn, + pReturnTypeRef, + (sal_Int64 *)pCppStackStart, + nStackHypers, + pParams, + nParams); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx index a94e339d632a..7ad7d1955a44 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx @@ -17,12 +17,18 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include +#include #include #include #include +#include #include "com/sun/star/uno/RuntimeException.hpp" +#include #include #include "bridge.hxx" @@ -152,10 +158,20 @@ static void cpp_call( try { assert( !( (pCppStack - pCppStackStart ) & 3) && "UNALIGNED STACK !!! (Please DO panic)"); - CPPU_CURRENT_NAMESPACE::callVirtualMethod( - pAdjustedThisPtr, aVtableSlot.index, - pCppReturn, pReturnTypeDescr->eTypeClass, - (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); + try { + CPPU_CURRENT_NAMESPACE::callVirtualMethod( + pAdjustedThisPtr, aVtableSlot.index, + pCppReturn, pReturnTypeDescr->eTypeClass, + (sal_Int32 *)pCppStackStart, (pCppStack - pCppStackStart) / sizeof(sal_Int32) ); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0; diff --git a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx index 40932f1f46f8..dbfcc1c66b2b 100644 --- a/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx +++ b/bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx @@ -17,8 +17,16 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include + +#include #include +#include + +#include +#include #include +#include #include #include "bridge.hxx" @@ -390,13 +398,23 @@ static void cpp_call( if( nStackLongs & 1 ) // stack has to be 8 byte aligned nStackLongs++; - callVirtualMethod( - pAdjustedThisPtr, - aVtableSlot.index, - pCppReturn, - pReturnTypeDescr->eTypeClass, - (sal_Int32 *)pCppStackStart, - nStackLongs); + try { + callVirtualMethod( + pAdjustedThisPtr, + aVtableSlot.index, + pCppReturn, + pReturnTypeDescr->eTypeClass, + (sal_Int32 *)pCppStackStart, + nStackLongs); + } catch (css::uno::Exception &) { + throw; + } catch (std::exception & e) { + throw css::uno::RuntimeException( + "C++ code threw " + o3tl::runtimeToOUString(typeid(e).name()) + ": " + + o3tl::runtimeToOUString(e.what())); + } catch (...) { + throw css::uno::RuntimeException("C++ code threw unknown exception"); + } // NO exception occurred... *ppUnoExc = 0;