Adapt remaining cpp_uno bridges to #i114635#
authorStephan Bergmann <sbergman@redhat.com>
Tue, 10 Apr 2018 08:06:23 +0000 (10:06 +0200)
committerRaspbian forward porter <root@raspbian.org>
Tue, 26 Jun 2018 23:10:17 +0000 (00:10 +0100)
..."C++ UNO bridge should convert non-UNO exceptions into RuntimeException"
(<https://bz.apache.org/ooo/show_bug.cgi?id=114635>), see
<https://lists.freedesktop.org/archives/libreoffice/2018-April/079985.html>
"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 <ci@libreoffice.org>
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Gbp-Pq: Name bridges-exceptions-updates.diff

18 files changed:
bridges/source/cpp_uno/gcc3_aix_powerpc/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_ios/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_alpha/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_hppa/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_ia64/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_intel/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_m68k/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_mips/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_mips64/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_powerpc/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_powerpc64/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_s390/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_s390x/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_sparc/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_linux_sparc64/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_solaris_intel/uno2cpp.cxx
bridges/source/cpp_uno/gcc3_solaris_sparc/uno2cpp.cxx

index 6024ceed5cae2cddd06892b5bfa15bb86152e292..1c8045fafe2611b93a029765335a38945b4cc6db 100644 (file)
 #include <sys/types.h>
 #include <sys/malloc.h>
 
+#include <com/sun/star/uno/Exception.hxx>
+#include <com/sun/star/uno/RuntimeException.hxx>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #include "bridge.hxx"
 #include "vtables.hxx"
 
 #include "share.hxx"
+
+#include <exception>
 #include <stdio.h>
 #include <string.h>
+#include <typeinfo>
 
 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;
 
index 6d2c82fbe0d40aeca9c2606d54142baeb8272d29..07911906210ba4e0448bb033a43b778e02a2c203 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <exception>
+#include <typeinfo>
+
+#include <com/sun/star/uno/Exception.hpp>
 #include <com/sun/star/uno/RuntimeException.hpp>
+#include <o3tl/runtimetooustring.hxx>
 
 #include "bridge.hxx"
 #include "types.hxx"
@@ -347,13 +354,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;
index acc94546895869b6a0105defa54d347660a99581..143b1533479cd846af35d9343786267ec2cfec28 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
 
+#include <exception>
 #include <malloc.h>
+#include <typeinfo>
 
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;
 
index 0f464e1ea6bedaad9d85ad86f6373572a33986cd..5a5647bbf03b90542c50f87f9db0b7671625f084 100644 (file)
@@ -21,7 +21,9 @@
 #include <rtl/alloc.h>
 
 #include <com/sun/star/uno/genfunc.hxx>
+#include <com/sun/star/uno/Exception.hpp>
 #include "com/sun/star/uno/RuntimeException.hpp"
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #include <bridge.hxx>
 
 #include "share.hxx"
 
+#include <exception>
 #include <stdio.h>
 #include <string.h>
+#include <typeinfo>
 
 /*
  * 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;
index 2c81c707253af7543ea645e4e5b81e44efe5875d..656f55c6b29e4beec2745794dabc919f0f6b893e 100644 (file)
@@ -21,7 +21,9 @@
 #include <rtl/alloc.h>
 
 #include <com/sun/star/uno/genfunc.hxx>
+#include <com/sun/star/uno/Exception.hpp>
 #include "com/sun/star/uno/RuntimeException.hpp"
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #include <bridge.hxx>
 
 #include "share.hxx"
 
+#include <exception>
 #include <stdio.h>
 #include <string.h>
+#include <typeinfo>
 
 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;
index ef5a73fe45e193fb588f673d8c238adeabfb5ed8..bf9b06bc29523c6b233e9a153099f680a4c9e9cc 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
 
+#include <exception>
 #include <malloc.h>
+#include <typeinfo>
 
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;
 
index 5b4b8fc7ad422431f65264d98cf273434e57b962..549601048aebeafafb709ac2995a6cfa45e3bd3d 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <exception>
+#include <typeinfo>
 
 #include <sal/alloca.h>
 
 #include <com/sun/star/uno/genfunc.hxx>
+#include <com/sun/star/uno/Exception.hpp>
 #include "com/sun/star/uno/RuntimeException.hpp"
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #include "bridge.hxx"
@@ -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<sal_Int32 *>(pCppStackStart), (pCppStack - pCppStackStart) / sizeof(sal_Int32) );
+        try {
+            CPPU_CURRENT_NAMESPACE::callVirtualMethod(
+                pAdjustedThisPtr, aVtableSlot.index,
+                pCppReturn, pReturnTypeDescr, bSimpleReturn,
+                reinterpret_cast<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 = nullptr;
 
index d8da50873fd2094d224a5fcef21d075c1751f15e..ca3a2477ebc5615d6da1958b9f5f7543badb90e5 100644 (file)
@@ -21,7 +21,9 @@
 #include <rtl/alloc.h>
 
 #include <com/sun/star/uno/genfunc.hxx>
+#include <com/sun/star/uno/Exception.hpp>
 #include "com/sun/star/uno/RuntimeException.hpp"
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #include <bridge.hxx>
 
 #include "share.hxx"
 
+#include <exception>
 #include <stdio.h>
 #include <string.h>
+#include <typeinfo>
 
 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;
index 75a55c4ee0306582fa88baad1ccee294045a4cbf..259775f2570850989382fcc045070163882be561 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <exception>
 #include <malloc.h>
+#include <typeinfo>
 
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;
 
index 387b12eacdfe1920af6c756a739a73532be017c3..b65a7819a405ce66cd96ba76e42b73ec9eab0c45 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <exception>
 #include <malloc.h>
 #include <cstring>
+#include <typeinfo>
 
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;
 
index 6b2ac3dd9ec4949d9b90e327d3fdc01b52a75ca7..7fdd362906ce98238ba66858c0777d689c65aaae 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
 
+#include <exception>
 #include <malloc.h>
+#include <typeinfo>
 
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;
 
index a77c4022be66bd26c9ab2ce4694c0f448e6ea12c..b58a515121f2c24c4bc9e7b64fdc2304ecc9c701 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
 
+#include <exception>
 #include <malloc.h>
+#include <typeinfo>
 
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;
 
index 51e331f5d4281fdcb03303f346ef1ed5500d957f..fda52d056ebc5d1eb54079af499d5ff2984d0f38 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
 
+#include <exception>
 #include <malloc.h>
+#include <typeinfo>
 
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;
 
index 8e40d003f03c8ea393fce6b703f71eb65c7960e4..e7354a4ba8c55ef6e2f44e42109a3ebbeec270ba 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
 
+#include <exception>
 #include <malloc.h>
+#include <typeinfo>
 
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;
 
index 99d60d17f351b80ea70773b9384ba8919119b2cc..39b625fb35c2f39c1aa94a83ccef8a5c64cf2833 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <exception>
 #include <malloc.h>
+#include <typeinfo>
+
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;
 
index 939f1b1ee2f32c21f13814eb42002e9f93c91787..81012dfdcda3caf1fc1e5ee0ea379118f88389ce 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <exception>
 #include <malloc.h>
+#include <typeinfo>
+
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;
 
index a94e339d632ae9c3fae4b0f4c6ef28b95467f9cb..7ad7d1955a44c073771235ea8c5aa12963a9b01c 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <exception>
+#include <typeinfo>
 
 #include <malloc.h>
 #include <sal/alloca.h>
 
 #include <com/sun/star/uno/genfunc.hxx>
+#include <com/sun/star/uno/Exception.hpp>
 #include "com/sun/star/uno/RuntimeException.hpp"
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;
 
index 40932f1f46f88bb019d6dbe57b3f9d5d17c5f4bd..dbfcc1c66b2b97d272d5f59813e457e137c165d5 100644 (file)
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <exception>
 #include <malloc.h>
+#include <typeinfo>
+
+#include <com/sun/star/uno/Exception.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/uno/genfunc.hxx>
+#include <o3tl/runtimetooustring.hxx>
 #include <uno/data.h>
 
 #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;