summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-24 15:47:30 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-25 21:46:49 +0200
commit3a51daeace695ead38cfd82b3a0f1e6f25a32e0f (patch)
treeaf3ef1144aef6ed62f4ab99b88d13b41bd3b3694
parentff3bdde2527123fc9e011ff0d93e958174632186 (diff)
Improve re-throwing of UNO exceptions
(*) if we are already throwing a Wrapped*Exception, get the exception using cppu::getCaughtexception. (*) when catching and then immediately throwing UNO exceptions, use cppu::getCaughtException to prevent exception slicing (*) if we are going to catch an exception and then immediately throw a RuntimeException, rather throw a WrappedTargetRuntimeException and preserve the original exception information. Change-Id: Ia7a501a50ae0e6f4d05186333c8517fdcb17d558 Reviewed-on: https://gerrit.libreoffice.org/54692 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--accessibility/source/extended/textwindowaccessibility.cxx7
-rw-r--r--basctl/source/dlged/dlgedobj.cxx6
-rw-r--r--chart2/source/controller/sidebar/Chart2PanelFactory.cxx6
-rw-r--r--chart2/source/tools/WrappedPropertySet.cxx10
-rw-r--r--comphelper/source/eventattachermgr/eventattachermgr.cxx4
-rw-r--r--comphelper/source/misc/backupfilehelper.cxx6
-rw-r--r--comphelper/source/misc/storagehelper.cxx16
-rw-r--r--configmgr/source/components.cxx8
-rw-r--r--configmgr/source/configurationregistry.cxx11
-rw-r--r--connectivity/source/drivers/dbase/DTables.cxx6
-rw-r--r--connectivity/source/drivers/hsqldb/HConnection.cxx3
-rw-r--r--connectivity/source/drivers/jdbc/JConnection.cxx7
-rw-r--r--connectivity/source/drivers/jdbc/Object.cxx5
-rw-r--r--connectivity/source/drivers/postgresql/pq_xcolumns.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_xindexes.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_xkeys.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_xtables.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_xusers.cxx6
-rw-r--r--connectivity/source/drivers/postgresql/pq_xviews.cxx6
-rw-r--r--connectivity/source/sdbcx/VCollection.cxx4
-rw-r--r--cppuhelper/source/component.cxx8
-rw-r--r--cppuhelper/source/implbase.cxx14
-rw-r--r--cppuhelper/source/propertysetmixin.cxx106
-rw-r--r--dbaccess/source/core/api/CRowSetDataColumn.cxx3
-rw-r--r--dbaccess/source/core/dataaccess/databasedocument.cxx21
-rw-r--r--dbaccess/source/core/dataaccess/definitioncontainer.cxx8
-rw-r--r--dbaccess/source/filter/xml/xmlfilter.cxx6
-rw-r--r--dbaccess/source/ui/control/tabletree.cxx5
-rw-r--r--dbaccess/source/ui/dlg/DbAdminImpl.cxx6
-rw-r--r--desktop/source/app/check_ext_deps.cxx6
-rw-r--r--desktop/source/deployment/gui/dp_gui_theextmgr.cxx10
-rw-r--r--desktop/source/deployment/gui/dp_gui_updatedialog.cxx6
-rw-r--r--desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx4
-rw-r--r--desktop/source/deployment/misc/dp_descriptioninfoset.cxx13
-rw-r--r--embeddedobj/source/commonembedding/embedobj.cxx6
-rw-r--r--embeddedobj/source/commonembedding/persistence.cxx5
-rw-r--r--embeddedobj/source/msole/oleembed.cxx14
-rw-r--r--eventattacher/source/eventattacher.cxx6
-rw-r--r--extensions/source/ole/oleobjw.cxx64
-rw-r--r--extensions/source/update/feed/updatefeed.cxx29
-rw-r--r--forms/source/component/clickableimage.cxx6
-rw-r--r--forms/source/xforms/submission.cxx6
-rw-r--r--framework/source/accelerators/storageholder.cxx17
-rw-r--r--framework/source/fwe/xml/menuconfiguration.cxx21
-rw-r--r--framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx7
-rw-r--r--jvmaccess/Library_jvmaccess.mk1
-rw-r--r--jvmaccess/source/classpath.cxx8
-rw-r--r--oox/source/docprop/docprophandler.cxx6
-rw-r--r--package/source/manifest/ManifestWriter.cxx6
-rw-r--r--package/source/xstor/ohierarchyholder.cxx12
-rw-r--r--package/source/zippackage/ZipPackage.cxx30
-rw-r--r--package/source/zippackage/zipfileaccess.cxx7
-rw-r--r--pyuno/source/module/pyuno_adapter.cxx4
-rw-r--r--pyuno/source/module/pyuno_runtime.cxx4
-rw-r--r--reportdesign/source/core/api/ReportDefinition.cxx5
-rw-r--r--sax/source/expatwrap/saxwriter.cxx15
-rw-r--r--sc/source/ui/sidebar/ScPanelFactory.cxx6
-rw-r--r--sc/source/ui/unoobj/dapiuno.cxx7
-rw-r--r--sc/source/ui/vba/vbaaxes.cxx6
-rw-r--r--sc/source/ui/vba/vbachartobjects.cxx5
-rw-r--r--sc/source/ui/vba/vbarange.cxx10
-rw-r--r--scripting/source/protocolhandler/scripthandler.cxx12
-rw-r--r--scripting/source/provider/ActiveMSPList.cxx3
-rw-r--r--scripting/source/provider/ProviderCache.cxx15
-rw-r--r--sd/source/core/stlsheet.cxx7
-rw-r--r--sfx2/source/doc/DocumentMetadataAccess.cxx86
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx36
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx20
-rw-r--r--sfx2/source/view/ipclient.cxx8
-rw-r--r--sot/source/unoolestorage/xolesimplestorage.cxx12
-rw-r--r--stoc/source/implementationregistration/implreg.cxx8
-rw-r--r--stoc/source/invocation/invocation.cxx4
-rw-r--r--stoc/source/javaloader/javaloader.cxx7
-rw-r--r--stoc/source/javavm/javavm.cxx30
-rw-r--r--stoc/source/uriproc/UriReferenceFactory.cxx6
-rw-r--r--svl/source/fsstor/fsstorage.cxx6
-rw-r--r--svx/source/svdraw/svdoole2.cxx7
-rw-r--r--svx/source/unodraw/unoshap4.cxx23
-rw-r--r--svx/source/xml/xmleohlp.cxx6
-rw-r--r--sw/source/core/unocore/unoparagraph.cxx12
-rw-r--r--sw/source/core/unocore/unoport.cxx8
-rw-r--r--sw/source/core/unocore/unorefmk.cxx8
-rw-r--r--sw/source/core/unocore/unosect.cxx12
-rw-r--r--sw/source/core/unocore/unostyle.cxx24
-rw-r--r--sw/source/core/unocore/unotext.cxx11
-rw-r--r--sw/source/uibase/uno/unoatxt.cxx6
-rw-r--r--ucb/source/cacher/cachedcontentresultset.cxx21
-rw-r--r--ucb/source/core/FileAccess.cxx7
-rw-r--r--ucb/source/ucp/ftp/ftpcontentprovider.cxx7
-rw-r--r--ucb/source/ucp/package/pkgprovider.cxx4
-rw-r--r--ucb/source/ucp/tdoc/tdoc_storage.cxx11
-rw-r--r--unoxml/source/rdf/librdf_repository.cxx42
-rw-r--r--uui/source/interactionhandler.cxx10
-rw-r--r--uui/source/requeststringresolver.cxx6
-rw-r--r--vbahelper/source/msforms/vbacontrols.cxx6
-rw-r--r--writerfilter/source/filter/RtfFilter.cxx6
-rw-r--r--writerfilter/source/filter/WriterFilter.cxx7
-rw-r--r--writerfilter/source/ooxml/OOXMLDocumentImpl.cxx9
-rw-r--r--xmloff/source/meta/xmlmetai.cxx11
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx6
102 files changed, 793 insertions, 413 deletions
diff --git a/accessibility/source/extended/textwindowaccessibility.cxx b/accessibility/source/extended/textwindowaccessibility.cxx
index 50ea92f78238..91055abc841b 100644
--- a/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/accessibility/source/extended/textwindowaccessibility.cxx
@@ -20,6 +20,8 @@
#include <sal/config.h>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <extended/textwindowaccessibility.hxx>
#include <comphelper/accessibleeventnotifier.hxx>
#include <unotools/accessiblerelationsethelper.hxx>
@@ -538,10 +540,11 @@ css::accessibility::TextSegment SAL_CALL Paragraph::getTextAtLineWithCaret( )
getTextAtLineNumber( nLineNo ) :
css::accessibility::TextSegment();
} catch (const css::lang::IndexOutOfBoundsException&) {
- throw css::uno::RuntimeException(
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
"textwindowaccessibility.cxx:"
" Paragraph::getTextAtLineWithCaret",
- static_cast< css::uno::XWeak * >( this ) );
+ static_cast< css::uno::XWeak * >( this ), anyEx );
}
}
diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx
index 8052f3cb159a..968a2ed3ed81 100644
--- a/basctl/source/dlged/dlgedobj.cxx
+++ b/basctl/source/dlged/dlgedobj.cxx
@@ -41,6 +41,7 @@
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/script/XScriptEventsSupplier.hpp>
#include <com/sun/star/table/CellAddress.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <o3tl/functional.hxx>
#include <unotools/sharedunocomponent.hxx>
#include <vcl/svapp.hxx>
@@ -1136,10 +1137,11 @@ void DlgEdObj::_propertyChange( const css::beans::PropertyChangeEvent& evt )
{
NameChange(evt);
}
- catch (container::NoSuchElementException const& e)
+ catch (container::NoSuchElementException const&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException("", nullptr,
- uno::Any(e));
+ anyEx);
}
}
}
diff --git a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
index 4034156f289d..19ce79f8fad7 100644
--- a/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
+++ b/chart2/source/controller/sidebar/Chart2PanelFactory.cxx
@@ -26,6 +26,7 @@
#include <rtl/ref.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -109,11 +110,12 @@ Reference<css::ui::XUIElement> SAL_CALL ChartPanelFactory::createUIElement (
{
throw;
}
- catch (const css::uno::Exception& e)
+ catch (const css::uno::Exception&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"ChartPanelFactory::createUIElement exception",
- nullptr, css::uno::Any(e));
+ nullptr, anyEx );
}
return xElement;
diff --git a/chart2/source/tools/WrappedPropertySet.cxx b/chart2/source/tools/WrappedPropertySet.cxx
index b63d25dfeea7..72c296ea6185 100644
--- a/chart2/source/tools/WrappedPropertySet.cxx
+++ b/chart2/source/tools/WrappedPropertySet.cxx
@@ -127,10 +127,9 @@ void SAL_CALL WrappedPropertySet::setPropertyValue( const OUString& rPropertyNam
}
catch( const uno::Exception& ex )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
OSL_FAIL("invalid exception caught in WrappedPropertySet::setPropertyValue");
- lang::WrappedTargetException aWrappedException;
- aWrappedException.TargetException <<= ex;
- throw aWrappedException;
+ throw lang::WrappedTargetException( ex.Message, nullptr, anyEx );
}
}
Any SAL_CALL WrappedPropertySet::getPropertyValue( const OUString& rPropertyName )
@@ -165,10 +164,9 @@ Any SAL_CALL WrappedPropertySet::getPropertyValue( const OUString& rPropertyName
}
catch( const uno::Exception& ex )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
OSL_FAIL("invalid exception caught in WrappedPropertySet::setPropertyValue");
- lang::WrappedTargetException aWrappedException;
- aWrappedException.TargetException <<= ex;
- throw aWrappedException;
+ throw lang::WrappedTargetException( ex.Message, nullptr, anyEx );
}
return aRet;
diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx
index 7da8ec29200f..4e5cdb0e0e53 100644
--- a/comphelper/source/eventattachermgr/eventattachermgr.cxx
+++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx
@@ -43,6 +43,7 @@
#include <com/sun/star/script/XScriptListener.hpp>
#include <cppuhelper/weak.hxx>
#include <comphelper/interfacecontainer2.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <rtl/ref.hxx>
@@ -311,9 +312,10 @@ Any SAL_CALL AttacherAllListener_Impl::approveFiring( const AllEventObject& Even
}
catch (const CannotConvertException& e)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"wrapped CannotConvertException " + e.Message,
- css::uno::Reference<css::uno::XInterface>(), Any(e));
+ css::uno::Reference<css::uno::XInterface>(), anyEx);
}
}
}
diff --git a/comphelper/source/misc/backupfilehelper.cxx b/comphelper/source/misc/backupfilehelper.cxx
index 3c681437eb55..530827c6f31b 100644
--- a/comphelper/source/misc/backupfilehelper.cxx
+++ b/comphelper/source/misc/backupfilehelper.cxx
@@ -19,6 +19,7 @@
#include <zlib.h>
#include <comphelper/processfactory.hxx>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#include <com/sun/star/ucb/CommandFailedException.hpp>
#include <com/sun/star/uno/Sequence.hxx>
@@ -38,6 +39,7 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <cppuhelper/exc_hlp.hxx>
using namespace css;
using namespace css::xml::dom;
@@ -595,7 +597,9 @@ namespace
}
catch (const lang::IllegalArgumentException & e)
{
- throw uno::RuntimeException(e.Message, e.Context);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
for (sal_Int32 i = 0; i < xAllPackages.getLength(); ++i)
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index abd06ed048a9..f1e87937b8d2 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/embed/FileSystemStorageFactory.hpp>
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/ucb/SimpleFileAccess.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -55,6 +56,7 @@
#include <comphelper/documentconstants.hxx>
#include <comphelper/storagehelper.hxx>
#include <comphelper/sequence.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#if HAVE_FEATURE_GPGME
# include <gpgme.h>
@@ -119,6 +121,7 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromURL2(
aArgs[1] <<= nStorageMode;
uno::Reference< lang::XSingleServiceFactory > xFact;
+ css::uno::Any anyEx;
try {
::ucbhelper::Content aCntnt( aURL,
uno::Reference< css::ucb::XCommandEnvironment > (),
@@ -128,9 +131,18 @@ uno::Reference< embed::XStorage > OStorageHelper::GetStorageFromURL2(
} else {
xFact = GetFileSystemStorageFactory( rxContext );
}
- } catch (uno::Exception &) { }
+ } catch (uno::Exception &)
+ {
+ anyEx = cppu::getCaughtException();
+ }
- if (!xFact.is()) throw uno::RuntimeException();
+ if (!xFact.is())
+ {
+ if (anyEx.hasValue())
+ throw css::lang::WrappedTargetRuntimeException( "", nullptr, anyEx );
+ else
+ throw uno::RuntimeException();
+ }
uno::Reference< embed::XStorage > xTempStorage(
xFact->createInstanceWithArguments( aArgs ), uno::UNO_QUERY_THROW );
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx
index e296f8dfa8de..af666ba2b719 100644
--- a/configmgr/source/components.cxx
+++ b/configmgr/source/components.cxx
@@ -31,12 +31,14 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/NoSuchElementException.hpp>
#include <com/sun/star/lang/WrappedTargetException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/uno/XInterface.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <config_dconf.h>
#include <config_folders.h>
#include <osl/conditn.hxx>
@@ -453,8 +455,10 @@ css::beans::Optional< css::uno::Any > Components::getExternalValue(
throw css::uno::RuntimeException(
"unknown external value descriptor ID: " + e.Message);
} catch (css::lang::WrappedTargetException & e) {
- throw css::uno::RuntimeException(
- "cannot obtain external value: " + e.Message);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "cannot obtain external value: " + e.Message,
+ nullptr, anyEx );
}
}
return value;
diff --git a/configmgr/source/configurationregistry.cxx b/configmgr/source/configurationregistry.cxx
index 65a24c6903fa..628640c43974 100644
--- a/configmgr/source/configurationregistry.cxx
+++ b/configmgr/source/configurationregistry.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/container/XNamed.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/registry/InvalidRegistryException.hpp>
#include <com/sun/star/registry/InvalidValueException.hpp>
#include <com/sun/star/registry/MergeConflictException.hpp>
@@ -48,6 +49,7 @@
#include <com/sun/star/uno/XInterface.hpp>
#include <com/sun/star/util/XFlushable.hpp>
#include <cppu/unotype.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weak.hxx>
@@ -262,10 +264,11 @@ void Service::open(OUString const & rURL, sal_Bool bReadOnly, sal_Bool)
} catch (css::uno::RuntimeException &) {
throw;
} catch (css::uno::Exception & e) {
- throw css::uno::RuntimeException(
- ("com.sun.star.configuration.ConfigurationRegistry: open failed: " +
- e.Message),
- static_cast< cppu::OWeakObject * >(this));
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "com.sun.star.configuration.ConfigurationRegistry: open failed: " +
+ e.Message,
+ static_cast< cppu::OWeakObject * >(this), anyEx );
}
url_ = rURL;
readOnly_ = bReadOnly;
diff --git a/connectivity/source/drivers/dbase/DTables.cxx b/connectivity/source/drivers/dbase/DTables.cxx
index 90f62bdc526f..056b287aa994 100644
--- a/connectivity/source/drivers/dbase/DTables.cxx
+++ b/connectivity/source/drivers/dbase/DTables.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <dbase/DCatalog.hxx>
#include <comphelper/types.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <strings.hrc>
#include <connectivity/dbexception.hxx>
@@ -85,9 +86,10 @@ sdbcx::ObjectType ODbaseTables::appendObject( const OUString& _rForName, const R
{
throw;
}
- catch(Exception&)
+ catch(Exception& ex)
{
- throw SQLException();
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw SQLException( ex.Message, nullptr, "", 0, anyEx );
}
}
}
diff --git a/connectivity/source/drivers/hsqldb/HConnection.cxx b/connectivity/source/drivers/hsqldb/HConnection.cxx
index cf4cafbe347c..7da46daafb2f 100644
--- a/connectivity/source/drivers/hsqldb/HConnection.cxx
+++ b/connectivity/source/drivers/hsqldb/HConnection.cxx
@@ -231,9 +231,10 @@ namespace connectivity { namespace hsqldb
catch( const RuntimeException& ) { throw; }
catch( const Exception& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
::connectivity::SharedResources aResources;
const OUString sError( aResources.getResourceString(STR_NO_TABLE_CONTAINER));
- throw WrappedTargetException( sError ,*this, ::cppu::getCaughtException() );
+ throw WrappedTargetException( sError ,*this, anyEx );
}
SAL_WARN_IF( !xTables.is(), "connectivity.hsqldb", "OHsqlConnection::impl_getTableContainer_throw: post condition not met!" );
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index 5fdc586cc038..bfaef457d35e 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <jvmaccess/classpath.hxx>
#include <comphelper/namedvaluecollection.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <rtl/ustrbuf.hxx>
#include <jni.h>
#include <strings.hrc>
@@ -688,15 +689,15 @@ void java_sql_Connection::loadDriverFromProperties( const OUString& _sDriverClas
}
}
}
- catch( const SQLException& e )
+ catch( const SQLException& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw SQLException(
lcl_getDriverLoadErrorMessage( getResources(),_sDriverClass, _sDriverClassPath ),
*this,
OUString(),
1000,
- makeAny(e)
- );
+ anyEx);
}
catch( Exception& )
{
diff --git a/connectivity/source/drivers/jdbc/Object.cxx b/connectivity/source/drivers/jdbc/Object.cxx
index 20edd90d6192..4a9a854d48f7 100644
--- a/connectivity/source/drivers/jdbc/Object.cxx
+++ b/connectivity/source/drivers/jdbc/Object.cxx
@@ -28,6 +28,7 @@
#include <strings.hxx>
#include <comphelper/logging.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <memory>
@@ -222,7 +223,9 @@ void java_lang_Object::ThrowRuntimeException( JNIEnv* _pEnvironment, const Refer
}
catch (const SQLException& e)
{
- throw WrappedTargetRuntimeException(e.Message, e.Context, makeAny(e));
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
}
diff --git a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
index 707d634044ce..180ded29a0b8 100644
--- a/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xcolumns.cxx
@@ -37,11 +37,13 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include "pq_xcolumns.hxx"
@@ -331,7 +333,9 @@ void Columns::refresh()
}
catch ( css::sdbc::SQLException & e )
{
- throw RuntimeException( e.Message , e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ nullptr, anyEx );
}
fire( RefreshedBroadcaster( *this ) );
}
diff --git a/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx b/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
index bab35147b26b..8501d84bea36 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexcolumns.cxx
@@ -38,10 +38,12 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include "pq_xcolumns.hxx"
#include "pq_xindexcolumns.hxx"
@@ -147,7 +149,9 @@ void IndexColumns::refresh()
}
catch ( css::sdbc::SQLException & e )
{
- throw RuntimeException( e.Message , e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
fire( RefreshedBroadcaster( *this ) );
diff --git a/connectivity/source/drivers/postgresql/pq_xindexes.cxx b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
index 22b8acf7102c..70f35d515cc2 100644
--- a/connectivity/source/drivers/postgresql/pq_xindexes.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xindexes.cxx
@@ -37,11 +37,13 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XParameters.hpp>
#include <com/sun/star/sdbc/KeyRule.hpp>
#include <com/sun/star/sdbcx/KeyType.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include "pq_xindexes.hxx"
#include "pq_xindex.hxx"
@@ -180,7 +182,9 @@ void Indexes::refresh()
}
catch ( css::sdbc::SQLException & e )
{
- throw RuntimeException( e.Message , e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
fire( RefreshedBroadcaster( *this ) );
diff --git a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
index 782861615707..1982d348851c 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeycolumns.cxx
@@ -36,10 +36,12 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
#include <com/sun/star/sdbc/ColumnValue.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include "pq_xcolumns.hxx"
#include "pq_xkeycolumns.hxx"
@@ -149,7 +151,9 @@ void KeyColumns::refresh()
}
catch ( css::sdbc::SQLException & e )
{
- throw RuntimeException( e.Message , e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
fire( RefreshedBroadcaster( *this ) );
diff --git a/connectivity/source/drivers/postgresql/pq_xkeys.cxx b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
index 07ee93726a4d..09aa41ea0f15 100644
--- a/connectivity/source/drivers/postgresql/pq_xkeys.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xkeys.cxx
@@ -37,11 +37,13 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbc/XParameters.hpp>
#include <com/sun/star/sdbc/KeyRule.hpp>
#include <com/sun/star/sdbcx/KeyType.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include "pq_xkeys.hxx"
#include "pq_xkey.hxx"
@@ -198,7 +200,9 @@ void Keys::refresh()
}
catch ( css::sdbc::SQLException & e )
{
- throw RuntimeException( e.Message , e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
fire( RefreshedBroadcaster( *this ) );
diff --git a/connectivity/source/drivers/postgresql/pq_xtables.cxx b/connectivity/source/drivers/postgresql/pq_xtables.cxx
index 0eb86f12942c..907e777f273d 100644
--- a/connectivity/source/drivers/postgresql/pq_xtables.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xtables.cxx
@@ -36,12 +36,14 @@
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbcx/Privilege.hpp>
#include <com/sun/star/sdbcx/KeyType.hpp>
#include <com/sun/star/sdbc/KeyRule.hpp>
#include <com/sun/star/sdbc/DataType.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include "pq_xtables.hxx"
#include "pq_xviews.hxx"
@@ -142,7 +144,9 @@ void Tables::refresh()
}
catch ( const css::sdbc::SQLException & e )
{
- throw RuntimeException( e.Message , e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
fire( RefreshedBroadcaster( *this ) );
diff --git a/connectivity/source/drivers/postgresql/pq_xusers.cxx b/connectivity/source/drivers/postgresql/pq_xusers.cxx
index e7d6b6112b5a..cb30c0b50b4c 100644
--- a/connectivity/source/drivers/postgresql/pq_xusers.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xusers.cxx
@@ -36,9 +36,11 @@
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
#include <com/sun/star/sdbcx/Privilege.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include "pq_xusers.hxx"
#include "pq_xuser.hxx"
@@ -109,7 +111,9 @@ void Users::refresh()
}
catch ( css::sdbc::SQLException & e )
{
- throw RuntimeException( e.Message , e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
fire( RefreshedBroadcaster( *this ) );
diff --git a/connectivity/source/drivers/postgresql/pq_xviews.cxx b/connectivity/source/drivers/postgresql/pq_xviews.cxx
index 7b1abf581468..8f1d58d07f8e 100644
--- a/connectivity/source/drivers/postgresql/pq_xviews.cxx
+++ b/connectivity/source/drivers/postgresql/pq_xviews.cxx
@@ -36,8 +36,10 @@
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sdbc/SQLException.hpp>
#include <com/sun/star/sdbc/XRow.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include "pq_xviews.hxx"
#include "pq_xview.hxx"
@@ -124,7 +126,9 @@ void Views::refresh()
}
catch ( css::sdbc::SQLException & e )
{
- throw RuntimeException( e.Message , e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
fire( RefreshedBroadcaster( *this ) );
}
diff --git a/connectivity/source/sdbcx/VCollection.cxx b/connectivity/source/sdbcx/VCollection.cxx
index 595b66576ed1..70f15dc4bd9d 100644
--- a/connectivity/source/sdbcx/VCollection.cxx
+++ b/connectivity/source/sdbcx/VCollection.cxx
@@ -27,6 +27,7 @@
#include <comphelper/enumhelper.hxx>
#include <comphelper/types.hxx>
#include <comphelper/property.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <TConnection.hxx>
#include <rtl/ustrbuf.hxx>
#include <strings.hrc>
@@ -533,6 +534,7 @@ ObjectType OCollection::getObject(sal_Int32 _nIndex)
}
catch(const SQLException& e)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
try
{
dropImpl(_nIndex,false);
@@ -540,7 +542,7 @@ ObjectType OCollection::getObject(sal_Int32 _nIndex)
catch(const Exception& )
{
}
- throw WrappedTargetException(e.Message,static_cast<XTypeProvider*>(this),makeAny(e));
+ throw WrappedTargetException(e.Message,static_cast<XTypeProvider*>(this),anyEx);
}
m_pElements->setObject(_nIndex,xName);
}
diff --git a/cppuhelper/source/component.cxx b/cppuhelper/source/component.cxx
index d906243bfddb..16cf56f257e6 100644
--- a/cppuhelper/source/component.cxx
+++ b/cppuhelper/source/component.cxx
@@ -20,8 +20,10 @@
#include <rtl/string.hxx>
#include <osl/diagnose.h>
#include <cppuhelper/component.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/typeprovider.hxx>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
using namespace osl;
@@ -189,8 +191,10 @@ void OComponentHelper::dispose()
}
catch (Exception & exc)
{
- throw RuntimeException(
- "unexpected UNO exception caught: " + exc.Message );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException(
+ "unexpected UNO exception caught: " + exc.Message,
+ nullptr, anyEx );
}
}
else
diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx
index b8bc91b769b1..f16c587431f0 100644
--- a/cppuhelper/source/implbase.cxx
+++ b/cppuhelper/source/implbase.cxx
@@ -18,11 +18,13 @@
*/
#include <cppuhelper/compbase_ex.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <osl/diagnose.h>
#include <rtl/instance.hxx>
#include <rtl/string.hxx>
#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/uno/RuntimeException.hpp>
using namespace ::osl;
@@ -120,8 +122,10 @@ void WeakComponentImplHelperBase::dispose()
}
catch (Exception & exc)
{
- throw RuntimeException(
- "unexpected UNO exception caught: " + exc.Message );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException(
+ "unexpected UNO exception caught: " + exc.Message,
+ nullptr, anyEx );
}
}
}
@@ -244,8 +248,10 @@ void WeakAggComponentImplHelperBase::dispose()
}
catch (Exception & exc)
{
- throw RuntimeException(
- "unexpected UNO exception caught: " + exc.Message );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException(
+ "unexpected UNO exception caught: " + exc.Message,
+ nullptr, anyEx );
}
}
}
diff --git a/cppuhelper/source/propertysetmixin.cxx b/cppuhelper/source/propertysetmixin.cxx
index 8469f1a7c51d..88e104d90453 100644
--- a/cppuhelper/source/propertysetmixin.cxx
+++ b/cppuhelper/source/propertysetmixin.cxx
@@ -66,6 +66,7 @@
#include <com/sun/star/uno/TypeClass.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/uno/XInterface.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/propertysetmixin.hxx>
#include <cppuhelper/weak.hxx>
@@ -436,9 +437,11 @@ PropertySetMixinImpl::Impl::Impl(
m_type.getTypeName()),
css::uno::UNO_QUERY_THROW);
} catch (css::container::NoSuchElementException & e) {
- throw css::uno::RuntimeException(
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
"unexpected com.sun.star.container.NoSuchElementException: "
- + e.Message);
+ + e.Message,
+ nullptr, anyEx );
}
std::vector< rtl::OUString > handleNames;
initProperties(ifc, m_absentOptional, &handleNames);
@@ -509,10 +512,11 @@ void PropertySetMixinImpl::Impl::setProperty(
throw css::lang::IllegalArgumentException(
e.Message, object, illegalArgumentPosition);
} else {
- throw css::uno::RuntimeException(
- ("unexpected com.sun.star.lang.IllegalArgumentException: "
- + e.Message),
- object);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected com.sun.star.lang.IllegalArgumentException: "
+ + e.Message,
+ object, anyEx );
}
} catch (css::lang::IllegalAccessException &) {
//TODO Clarify whether PropertyVetoException is the correct exception
@@ -564,10 +568,11 @@ css::uno::Any PropertySetMixinImpl::Impl::getProperty(
try {
value = field->get(object->queryInterface(m_type));
} catch (css::lang::IllegalArgumentException & e) {
- throw css::uno::RuntimeException(
- ("unexpected com.sun.star.lang.IllegalArgumentException: "
- + e.Message),
- object);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected com.sun.star.lang.IllegalArgumentException: "
+ + e.Message,
+ object, anyEx );
} catch (css::lang::WrappedTargetRuntimeException & e) {
//FIXME A WrappedTargetRuntimeException from XIdlField2.get is not
// guaranteed to originate directly within XIdlField2.get (and thus have
@@ -621,10 +626,11 @@ css::uno::Any PropertySetMixinImpl::Impl::getProperty(
ambiguous->getField("Value"), css::uno::UNO_QUERY_THROW)->
get(value);
} catch (css::lang::IllegalArgumentException & e) {
- throw css::uno::RuntimeException(
- ("unexpected com.sun.star.lang.IllegalArgumentException: "
- + e.Message),
- object);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected com.sun.star.lang.IllegalArgumentException: "
+ + e.Message,
+ object, anyEx );
}
undoAmbiguous = false;
} else if (undoDefaulted
@@ -649,10 +655,11 @@ css::uno::Any PropertySetMixinImpl::Impl::getProperty(
defaulted->getField("Value"), css::uno::UNO_QUERY_THROW)->
get(value);
} catch (css::lang::IllegalArgumentException & e) {
- throw css::uno::RuntimeException(
- ("unexpected com.sun.star.lang.IllegalArgumentException: "
- + e.Message),
- object);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected com.sun.star.lang.IllegalArgumentException: "
+ + e.Message,
+ object, anyEx );
}
undoDefaulted = false;
} else if (undoOptional
@@ -681,10 +688,11 @@ css::uno::Any PropertySetMixinImpl::Impl::getProperty(
optional->getField("Value"), css::uno::UNO_QUERY_THROW)->
get(value);
} catch (css::lang::IllegalArgumentException & e) {
- throw css::uno::RuntimeException(
- ("unexpected com.sun.star.lang.IllegalArgumentException: "
- + e.Message),
- object);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected com.sun.star.lang.IllegalArgumentException: "
+ + e.Message,
+ object, anyEx );
}
undoOptional = false;
} else {
@@ -738,15 +746,17 @@ css::uno::Any PropertySetMixinImpl::Impl::wrapValue(
type->getField("IsAmbiguous"), css::uno::UNO_QUERY_THROW)->set(
strct, css::uno::Any(isAmbiguous));
} catch (css::lang::IllegalArgumentException & e) {
- throw css::uno::RuntimeException(
- ("unexpected com.sun.star.lang.IllegalArgumentException: "
- + e.Message),
- object);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected com.sun.star.lang.IllegalArgumentException: "
+ + e.Message,
+ object, anyEx );
} catch (css::lang::IllegalAccessException & e) {
- throw css::uno::RuntimeException(
- ("unexpected com.sun.star.lang.IllegalAccessException: "
- + e.Message),
- object);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected com.sun.star.lang.IllegalAccessException: "
+ + e.Message,
+ object, anyEx );
}
return strct;
}
@@ -767,15 +777,17 @@ css::uno::Any PropertySetMixinImpl::Impl::wrapValue(
type->getField("IsDefaulted"), css::uno::UNO_QUERY_THROW)->set(
strct, css::uno::Any(isDefaulted));
} catch (css::lang::IllegalArgumentException & e) {
- throw css::uno::RuntimeException(
- ("unexpected com.sun.star.lang.IllegalArgumentException: "
- + e.Message),
- object);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected com.sun.star.lang.IllegalArgumentException: "
+ + e.Message,
+ object, anyEx );
} catch (css::lang::IllegalAccessException & e) {
- throw css::uno::RuntimeException(
- ("unexpected com.sun.star.lang.IllegalAccessException: "
- + e.Message),
- object);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected com.sun.star.lang.IllegalAccessException: "
+ + e.Message,
+ object, anyEx );
}
return strct;
}
@@ -799,15 +811,17 @@ css::uno::Any PropertySetMixinImpl::Impl::wrapValue(
isAmbiguous, wrapDefaulted, isDefaulted, false));
}
} catch (css::lang::IllegalArgumentException & e) {
- throw css::uno::RuntimeException(
- ("unexpected com.sun.star.lang.IllegalArgumentException: "
- + e.Message),
- object);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected com.sun.star.lang.IllegalArgumentException: "
+ + e.Message,
+ object, anyEx );
} catch (css::lang::IllegalAccessException & e) {
- throw css::uno::RuntimeException(
- ("unexpected com.sun.star.lang.IllegalAccessException: "
- + e.Message),
- object);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected com.sun.star.lang.IllegalAccessException: "
+ + e.Message,
+ object, anyEx );
}
return strct;
}
diff --git a/dbaccess/source/core/api/CRowSetDataColumn.cxx b/dbaccess/source/core/api/CRowSetDataColumn.cxx
index 14970364a798..c11fe639bf25 100644
--- a/dbaccess/source/core/api/CRowSetDataColumn.cxx
+++ b/dbaccess/source/core/api/CRowSetDataColumn.cxx
@@ -113,9 +113,10 @@ void SAL_CALL ORowSetDataColumn::getFastPropertyValue( Any& rValue, sal_Int32 nH
}
catch(const SQLException &e)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw WrappedTargetRuntimeException("Could not retrieve column value: " + e.Message,
*const_cast<ORowSetDataColumn*>(this),
- Any(e));
+ anyEx);
}
}
else if ( PROPERTY_ID_LABEL == nHandle && !m_sLabel.isEmpty() )
diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index eee5e8465031..e147cf0281de 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -646,18 +646,21 @@ void SAL_CALL ODatabaseDocument::storeToRecoveryFile( const OUString& i_TargetLo
// commit the root storage
tools::stor::commitStorageIfWriteable( xTargetStorage );
}
+ catch( const IOException& )
+ {
+ throw;
+ }
+ catch( const RuntimeException& )
+ {
+ throw;
+ }
+ catch( const WrappedTargetException& )
+ {
+ throw;
+ }
catch( const Exception& )
{
Any aError = ::cppu::getCaughtException();
- if ( aError.isExtractableTo( ::cppu::UnoType< IOException >::get() )
- || aError.isExtractableTo( ::cppu::UnoType< RuntimeException >::get() )
- || aError.isExtractableTo( ::cppu::UnoType< WrappedTargetException >::get() )
- )
- {
- // allowed to leave
- throw;
- }
-
throw WrappedTargetException( OUString(), *this, aError );
}
}
diff --git a/dbaccess/source/core/dataaccess/definitioncontainer.cxx b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
index 95b4676006ba..ae52ecc5e67b 100644
--- a/dbaccess/source/core/dataaccess/definitioncontainer.cxx
+++ b/dbaccess/source/core/dataaccess/definitioncontainer.cxx
@@ -30,6 +30,7 @@
#include <comphelper/enumhelper.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/ucb/CommandInfo.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -619,10 +620,11 @@ void SAL_CALL ODefinitionContainer::propertyChange( const PropertyChangeEvent& e
implRemove( sOldName );
implAppend( sNewName, xContent );
}
- catch(const Exception&)
+ catch(const Exception& ex)
{
- DBG_UNHANDLED_EXCEPTION("dbaccess");
- throw RuntimeException();
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ nullptr, anyEx );
}
m_bInPropertyChange = false;
}
diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx
index 906a2bd69272..11b424901bc2 100644
--- a/dbaccess/source/filter/xml/xmlfilter.cxx
+++ b/dbaccess/source/filter/xml/xmlfilter.cxx
@@ -324,11 +324,13 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
if (!sStreamRelPath.isEmpty())
xStorage = xStorage->openStorageElement(sStreamRelPath, embed::ElementModes::READ);
}
+ catch (const RuntimeException&)
+ {
+ throw;
+ }
catch (const Exception&)
{
Any aError = ::cppu::getCaughtException();
- if (aError.isExtractableTo(::cppu::UnoType<RuntimeException>::get()))
- throw;
throw lang::WrappedTargetRuntimeException(OUString(), *this, aError);
}
}
diff --git a/dbaccess/source/ui/control/tabletree.cxx b/dbaccess/source/ui/control/tabletree.cxx
index 31428879bf09..a285b7f9675a 100644
--- a/dbaccess/source/ui/control/tabletree.cxx
+++ b/dbaccess/source/ui/control/tabletree.cxx
@@ -167,10 +167,9 @@ void OTableTreeListBox::UpdateTableList( const Reference< XConnection >& _rxConn
}
catch(Exception&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
// a non-SQLException exception occurred ... simply throw an SQLException
- SQLException aInfo;
- aInfo.Message = sCurrentActionError;
- throw aInfo;
+ throw SQLException(sCurrentActionError, nullptr, "", 0, anyEx);
}
UpdateTableList( _rxConnection, sTables, sViews );
diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
index 49cdf5756619..0cce73ebbba6 100644
--- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx
+++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx
@@ -388,11 +388,11 @@ Reference< XDriver > ODbDataSourceAdministrationHelper::getDriver(const OUString
{
xDriverManager.set( ConnectionPool::create( getORB() ) );
}
- catch (const Exception& e)
+ catch (const Exception&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
// wrap the exception into an SQLException
- SQLException aSQLWrapper(e.Message, getORB(), "S1000", 0, Any());
- throw SQLException(sCurrentActionError, getORB(), "S1000", 0, makeAny(aSQLWrapper));
+ throw SQLException(sCurrentActionError, getORB(), "S1000", 0, anyEx);
}
Reference< XDriver > xDriver = xDriverManager->getDriverByURL(_sURL);
diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx
index d5b2876779f7..620377d60e62 100644
--- a/desktop/source/app/check_ext_deps.cxx
+++ b/desktop/source/app/check_ext_deps.cxx
@@ -37,6 +37,8 @@
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
#include <cppuhelper/bootstrap.hxx>
+#include <cppuhelper/exc_hlp.hxx>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#include <com/sun/star/ucb/CommandFailedException.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp>
@@ -256,7 +258,9 @@ static bool impl_checkDependencies( const uno::Reference< uno::XComponentContext
catch ( const ucb::CommandFailedException & ) { return true; }
catch ( const ucb::CommandAbortedException & ) { return true; }
catch ( const lang::IllegalArgumentException & e ) {
- throw uno::RuntimeException( e.Message, e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
#ifdef DEBUG
diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
index 94a8dd09df6c..fb883e15b82e 100644
--- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
+++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx
@@ -24,11 +24,13 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/configuration/theDefaultProvider.hpp>
#include <com/sun/star/deployment/DeploymentException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/TerminationVetoException.hpp>
#include <com/sun/star/ucb/CommandAbortedException.hpp>
#include <com/sun/star/ucb/CommandFailedException.hpp>
#include <comphelper/propertysequence.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include "dp_gui_dialog2.hxx"
#include "dp_gui_extensioncmdqueue.hxx"
@@ -202,7 +204,9 @@ void TheExtensionManager::checkUpdates()
} catch ( const ucb::CommandAbortedException & ) {
return;
} catch ( const lang::IllegalArgumentException & e ) {
- throw uno::RuntimeException( e.Message, e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i )
@@ -281,7 +285,9 @@ void TheExtensionManager::createPackageList()
} catch ( const ucb::CommandAbortedException & ) {
return;
} catch ( const lang::IllegalArgumentException & e ) {
- throw uno::RuntimeException( e.Message, e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
for ( sal_Int32 i = 0; i < xAllPackages.getLength(); ++i )
diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
index 1b33096de022..37513af9e031 100644
--- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx
@@ -52,6 +52,7 @@
#include <com/sun/star/frame/XDispatch.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/task/InteractionHandler.hpp>
@@ -95,6 +96,7 @@
#include <vcl/svapp.hxx>
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <dp_dependencies.hxx>
#include <dp_descriptioninfoset.hxx>
@@ -521,7 +523,9 @@ UpdateDialog::UpdateDialog(
} catch (const uno::RuntimeException &) {
throw;
} catch (const uno::Exception & e) {
- throw uno::RuntimeException(e.Message, e.Context);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
m_pUpdates->SetSelectHdl(LINK(this, UpdateDialog, selectionHandler));
m_pAll->SetToggleHdl(LINK(this, UpdateDialog, allHandler));
diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
index 0541a0b04f47..4a0090456217 100644
--- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
+++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx
@@ -344,7 +344,9 @@ void UpdateInstallDialog::Thread::downloadExtensions()
dp_misc::create_folder(nullptr, destFolder, m_updateCmdEnv.get() );
} catch (const cssu::Exception & e)
{
- throw cssu::Exception(e.Message + " No extensions will be installed.", nullptr);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetException( e.Message + " No extensions will be installed",
+ nullptr, anyEx );
}
diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
index 62e721e028e0..9acb846ae32e 100644
--- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
+++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/io/SequenceInputStream.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/uno/Sequence.hxx>
@@ -93,8 +94,10 @@ OUString getNodeValue(
try {
return node->getNodeValue();
} catch (const css::xml::dom::DOMException & e) {
- throw css::uno::RuntimeException(
- "com.sun.star.xml.dom.DOMException: " + e.Message);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "com.sun.star.xml.dom.DOMException: " + e.Message,
+ nullptr, anyEx );
}
}
@@ -303,8 +306,10 @@ DescriptionInfoset getDescriptionInfoset(OUString const & sExtensionFolderURL)
getRootElement();
} catch (const NoDescriptionException &) {
} catch (const css::deployment::DeploymentException & e) {
- throw css::uno::RuntimeException(
- "com.sun.star.deployment.DeploymentException: " + e.Message, nullptr);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "com.sun.star.deployment.DeploymentException: " + e.Message,
+ nullptr, anyEx );
}
return DescriptionInfoset(context, root);
}
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index 5eb943273fdf..8ec68838800f 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -38,6 +38,7 @@
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/embed/EmbedMisc.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/lok.hxx>
@@ -100,12 +101,13 @@ void OCommonEmbeddedObject::Deactivate()
catch( const embed::ObjectSaveVetoException& )
{
}
- catch( const uno::Exception& e )
+ catch( const uno::Exception& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw embed::StorageWrappedTargetException(
"The client could not store the object!",
static_cast< ::cppu::OWeakObject* >( this ),
- uno::makeAny( e ) );
+ anyEx );
}
}
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index e8eaee6d59eb..999ccd28955d 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -138,12 +138,13 @@ uno::Reference< io::XInputStream > createTempInpStreamFromStor(
try
{
xStorage->copyToStorage( xTempStorage );
- } catch( const uno::Exception& e )
+ } catch( const uno::Exception& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw embed::StorageWrappedTargetException(
"Can't copy storage!",
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ anyEx );
}
try {
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index 64d95c3d7a56..e9078734d2a9 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/io/TempFile.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
@@ -43,6 +44,7 @@
#include <com/sun/star/system/SystemShellExecute.hpp>
#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <comphelper/processfactory.hxx>
#include <comphelper/mimeconfighelper.hxx>
@@ -382,14 +384,16 @@ bool OleEmbeddedObject::TryToConvertToOOo( const uno::Reference< io::XStream >&
m_xParentStorage->removeElement( m_aEntryName );
m_xParentStorage->renameElement( aTmpStreamName, m_aEntryName );
}
- catch ( const uno::Exception& )
+ catch ( const uno::Exception& ex )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
try {
close( true );
} catch( const uno::Exception& ) {}
m_xParentStorage->dispose(); // ??? the storage has information loss, it should be closed without committing!
- throw uno::RuntimeException(); // the repairing is not possible
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ nullptr, anyEx ); // the repairing is not possible
}
SAL_FALLTHROUGH;
case 2:
@@ -398,13 +402,15 @@ bool OleEmbeddedObject::TryToConvertToOOo( const uno::Reference< io::XStream >&
m_xObjectStream = m_xParentStorage->openStreamElement( m_aEntryName, m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE );
m_nObjectState = embed::EmbedStates::LOADED;
}
- catch( const uno::Exception& )
+ catch( const uno::Exception& ex )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
try {
close( true );
} catch( const uno::Exception& ) {}
- throw uno::RuntimeException(); // the repairing is not possible
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ nullptr, anyEx ); // the repairing is not possible
}
SAL_FALLTHROUGH;
diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx
index 758189f65307..045d9d968036 100644
--- a/eventattacher/source/eventattacher.cxx
+++ b/eventattacher/source/eventattacher.cxx
@@ -37,6 +37,7 @@
// InvocationToAllListenerMapper
#include <com/sun/star/script/XInvocation.hpp>
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase.hxx>
@@ -510,9 +511,10 @@ Any SAL_CALL FilterAllListenerImpl::approveFiring( const AllEventObject& Event )
convertToEventReturn( aRet, aRetType );
}
}
- catch( const CannotConvertException& e )
+ catch( const CannotConvertException& )
{
- throw InvocationTargetException( OUString(), Reference< XInterface >(), Any(&e, cppu::UnoType<CannotConvertException>::get()) );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw InvocationTargetException( OUString(), Reference< XInterface >(), anyEx );
}
}
return aRet;
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index 8238088e641f..73ef6bd60df1 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -29,11 +29,13 @@
#include <com/sun/star/script/CannotConvertException.hpp>
#include <com/sun/star/script/FailReason.hpp>
#include <com/sun/star/beans/XMaterialHolder.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/bridge/ModelDependent.hpp>
#include <com/sun/star/bridge/oleautomation/NamedArgument.hpp>
#include <com/sun/star/bridge/oleautomation/PropertyPutArgument.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <typelib/typedescription.hxx>
#include <rtl/uuid.h>
@@ -158,9 +160,11 @@ Any SAL_CALL IUnknownWrapper::invokeGetProperty( const OUString& aPropertyName,
}
catch ( const Exception& e )
{
- throw RuntimeException("[automation bridge] unexpected exception in "
- "IUnknownWrapper::invokeGetProperty ! Message : \n" +
- e.Message);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException("[automation bridge] unexpected exception in "
+ "IUnknownWrapper::invokeGetProperty ! Message : \n " +
+ e.Message,
+ nullptr, anyEx );
}
return aResult;
}
@@ -186,9 +190,11 @@ Any SAL_CALL IUnknownWrapper::invokePutProperty( const OUString& aPropertyName,
}
catch ( const Exception& e )
{
- throw RuntimeException("[automation bridge] unexpected exception in "
- "IUnknownWrapper::invokePutProperty ! Message : \n" +
- e.Message);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException("[automation bridge] unexpected exception in "
+ "IUnknownWrapper::invokePutProperty ! Message : \n" +
+ e.Message,
+ nullptr, anyEx );
}
return aResult;
}
@@ -241,9 +247,11 @@ Any SAL_CALL IUnknownWrapper::invoke( const OUString& aFunctionName,
}
catch (const Exception & e)
{
- throw RuntimeException("[automation bridge] unexpected exception in "
- "IUnknownWrapper::invoke ! Message : \n" +
- e.Message);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException("[automation bridge] unexpected exception in "
+ "IUnknownWrapper::invoke ! Message : \n" +
+ e.Message,
+ nullptr, anyEx );
}
catch(...)
@@ -408,9 +416,11 @@ void SAL_CALL IUnknownWrapper::setValue( const OUString& aPropertyName,
}
catch (const Exception & e)
{
- throw RuntimeException("[automation bridge] unexpected exception in "
- "IUnknownWrapper::setValue ! Message : \n" +
- e.Message);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException("[automation bridge] unexpected exception in "
+ "IUnknownWrapper::setValue ! Message : \n" +
+ e.Message,
+ nullptr, anyEx );
}
catch (...)
@@ -550,9 +560,11 @@ Any SAL_CALL IUnknownWrapper::getValue( const OUString& aPropertyName )
}
catch (const Exception & e)
{
- throw RuntimeException("[automation bridge] unexpected exception in "
- "IUnknownWrapper::getValue ! Message : \n" +
- e.Message);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException("[automation bridge] unexpected exception in "
+ "IUnknownWrapper::getValue ! Message : \n" +
+ e.Message,
+ nullptr, anyEx );
}
catch (...)
{
@@ -599,9 +611,11 @@ sal_Bool SAL_CALL IUnknownWrapper::hasMethod( const OUString& aName )
}
catch (const Exception & e)
{
- throw RuntimeException("[automation bridge] unexpected exception in "
- "IUnknownWrapper::hasMethod ! Message : \n" +
- e.Message);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException("[automation bridge] unexpected exception in "
+ "IUnknownWrapper::hasMethod ! Message : \n" +
+ e.Message,
+ nullptr, anyEx );
}
catch (...)
{
@@ -648,9 +662,11 @@ sal_Bool SAL_CALL IUnknownWrapper::hasProperty( const OUString& aName )
}
catch (const Exception & e)
{
- throw RuntimeException("[automation bridge] unexpected exception in "
- "IUnknownWrapper::hasProperty ! Message : \n" +
- e.Message);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException("[automation bridge] unexpected exception in "
+ "IUnknownWrapper::hasProperty ! Message : \n" +
+ e.Message,
+ nullptr, anyEx );
}
catch (...)
@@ -1211,8 +1227,10 @@ void SAL_CALL IUnknownWrapper::initialize( const Sequence< Any >& aArguments )
}
catch( const Exception& e )
{
- throw RuntimeException(
- "[automation bridge] unexpected exception in IUnknownWrapper::initialize() error message: \n" + e.Message );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "[automation bridge] unexpected exception in IUnknownWrapper::initialize() error message: \n" + e.Message,
+ nullptr, anyEx );
}
}
}
diff --git a/extensions/source/update/feed/updatefeed.cxx b/extensions/source/update/feed/updatefeed.cxx
index e42f064d156f..6998da2f941b 100644
--- a/extensions/source/update/feed/updatefeed.cxx
+++ b/extensions/source/update/feed/updatefeed.cxx
@@ -19,6 +19,7 @@
#include <config_folders.h>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/implementationentry.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -255,17 +256,23 @@ public:
return uno::makeAny(aEntry);
}
-
- // action has been aborted
- catch( ucb::CommandAbortedException const & e)
- { throw lang::WrappedTargetException( "Command aborted", *this, uno::makeAny(e) ); }
-
- // let runtime exception pass
- catch( uno::RuntimeException const & ) { throw; }
-
- // document not accessible
- catch( uno::Exception const & e)
- { throw lang::WrappedTargetException( "Document not accessible", *this, uno::makeAny(e) ); }
+ catch( ucb::CommandAbortedException const &)
+ {
+ // action has been aborted
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetException( "Command aborted", *this, anyEx );
+ }
+ catch( uno::RuntimeException const & )
+ {
+ // let runtime exception pass
+ throw;
+ }
+ catch( uno::Exception const &)
+ {
+ // document not accessible
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetException( "Document not accessible", *this, anyEx );
+ }
}
private:
diff --git a/forms/source/component/clickableimage.cxx b/forms/source/component/clickableimage.cxx
index ab3cfe52d83b..d110b36f1524 100644
--- a/forms/source/component/clickableimage.cxx
+++ b/forms/source/component/clickableimage.cxx
@@ -43,6 +43,7 @@
#include <osl/mutex.hxx>
#include <services.hxx>
#include <comphelper/listenernotification.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <svtools/imageresourceaccess.hxx>
#define LOCAL_URL_PREFIX '#'
@@ -422,10 +423,11 @@ namespace frm
// allowed to leave
throw;
}
- catch( const Exception& e )
+ catch( const Exception& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
OSL_FAIL( "OClickableImageBaseControl::implSubmit: caught an unknown exception!" );
- throw WrappedTargetException( OUString(), *this, makeAny( e ) );
+ throw WrappedTargetException( OUString(), *this, anyEx );
}
}
diff --git a/forms/source/xforms/submission.cxx b/forms/source/xforms/submission.cxx
index 3757378c663d..08e04b8b2a33 100644
--- a/forms/source/xforms/submission.cxx
+++ b/forms/source/xforms/submission.cxx
@@ -45,6 +45,7 @@
#include <com/sun/star/task/XInteractionContinuation.hpp>
#include <com/sun/star/xforms/InvalidDataOnSubmitException.hpp>
#include <com/sun/star/frame/XFrame.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <comphelper/propertysetinfo.hxx>
#include <comphelper/interaction.hxx>
@@ -469,12 +470,13 @@ void SAL_CALL Submission::submitWithInteraction(
// allowed to leave
throw;
}
- catch( const Exception& e )
+ catch( const Exception& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
// exception caught: re-throw as wrapped target exception
throw WrappedTargetException(
lcl_message( sID, " due to exception being thrown" ),
- *this, makeAny( e ) );
+ *this, anyEx );
}
if( !bResult )
diff --git a/framework/source/accelerators/storageholder.cxx b/framework/source/accelerators/storageholder.cxx
index 1cf4ca98719d..99c67af297e0 100644
--- a/framework/source/accelerators/storageholder.cxx
+++ b/framework/source/accelerators/storageholder.cxx
@@ -383,7 +383,6 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openSubStorageWithFal
{
// a) try it first with user specified open mode
// ignore errors ... but save it for later use!
- css::uno::Exception exResult;
try
{
css::uno::Reference< css::embed::XStorage > xSubStorage = xBaseStorage->openStorageElement(sSubStorage, eOpenMode);
@@ -391,13 +390,19 @@ css::uno::Reference< css::embed::XStorage > StorageHolder::openSubStorageWithFal
return xSubStorage;
}
catch(const css::uno::RuntimeException&)
- { throw; }
- catch(const css::uno::Exception& ex)
- { exResult = ex; }
+ {
+ throw;
+ }
+ catch(const css::uno::Exception&)
+ {
+ // b) readonly already tried? => forward last error!
+ if ((eOpenMode & css::embed::ElementModes::WRITE) != css::embed::ElementModes::WRITE) // fallback possible ?
+ throw;
+ }
- // b) readonly already tried? => forward last error!
+ // b) readonly already tried, throw error
if ((eOpenMode & css::embed::ElementModes::WRITE) != css::embed::ElementModes::WRITE) // fallback possible ?
- throw exResult;
+ throw css::uno::Exception();
// c) try it readonly
// don't catch exception here! Outside code wish to know, if operation failed or not.
diff --git a/framework/source/fwe/xml/menuconfiguration.cxx b/framework/source/fwe/xml/menuconfiguration.cxx
index 1057119bc572..b4d8c7164c00 100644
--- a/framework/source/fwe/xml/menuconfiguration.cxx
+++ b/framework/source/fwe/xml/menuconfiguration.cxx
@@ -30,6 +30,7 @@
#include <com/sun/star/xml/sax/Writer.hpp>
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <cppuhelper/exc_hlp.hxx>
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::lang;
@@ -80,20 +81,23 @@ Reference< XIndexAccess > MenuConfiguration::CreateMenuBarConfigurationFromXML(
}
catch ( const RuntimeException& e )
{
- throw WrappedTargetException( e.Message, Reference< XInterface >(), Any() );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw WrappedTargetException( e.Message, Reference< XInterface >(), anyEx );
}
catch( const SAXException& e )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
SAXException aWrappedSAXException;
if ( !( e.WrappedException >>= aWrappedSAXException ))
- throw WrappedTargetException( e.Message, Reference< XInterface >(), Any() );
+ throw WrappedTargetException( e.Message, Reference< XInterface >(), anyEx );
else
- throw WrappedTargetException( aWrappedSAXException.Message, Reference< XInterface >(), Any() );
+ throw WrappedTargetException( aWrappedSAXException.Message, Reference< XInterface >(), e.WrappedException );
}
catch( const css::io::IOException& e )
{
- throw WrappedTargetException( e.Message, Reference< XInterface >(), Any() );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw WrappedTargetException( e.Message, Reference< XInterface >(), anyEx );
}
}
@@ -111,15 +115,18 @@ void MenuConfiguration::StoreMenuBarConfigurationToXML(
}
catch ( const RuntimeException& e )
{
- throw WrappedTargetException( e.Message, Reference< XInterface >(), Any() );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw WrappedTargetException( e.Message, Reference< XInterface >(), anyEx );
}
catch ( const SAXException& e )
{
- throw WrappedTargetException( e.Message, Reference< XInterface >(), Any() );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw WrappedTargetException( e.Message, Reference< XInterface >(), anyEx );
}
catch ( const css::io::IOException& e )
{
- throw WrappedTargetException( e.Message, Reference< XInterface >(), Any() );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw WrappedTargetException( e.Message, Reference< XInterface >(), anyEx );
}
}
diff --git a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
index 26e462495e16..229b5392b640 100644
--- a/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
+++ b/framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx
@@ -51,6 +51,7 @@
#include <comphelper/propertysequence.hxx>
#include <comphelper/sequence.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -1022,12 +1023,12 @@ void SAL_CALL ModuleUIConfigurationManager::reset()
impl_resetElementTypeData( rUserElementType, rDefaultElementType, aRemoveEventNotifyContainer, aReplaceEventNotifyContainer );
rUserElementType.bModified = false;
}
- catch (const Exception& e)
+ catch (const Exception&)
{
- css::uno::Any a(e);
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"ModuleUIConfigurationManager::reset exception",
- css::uno::Reference<css::uno::XInterface>(*this), a);
+ css::uno::Reference<css::uno::XInterface>(*this), anyEx);
}
}
diff --git a/jvmaccess/Library_jvmaccess.mk b/jvmaccess/Library_jvmaccess.mk
index 0a0fc2312e15..b4ef50a7d427 100644
--- a/jvmaccess/Library_jvmaccess.mk
+++ b/jvmaccess/Library_jvmaccess.mk
@@ -19,6 +19,7 @@ $(eval $(call gb_Library_use_api,jvmaccess,\
$(eval $(call gb_Library_use_libraries,jvmaccess,\
cppu \
+ cppuhelper \
sal \
salhelper \
))
diff --git a/jvmaccess/source/classpath.cxx b/jvmaccess/source/classpath.cxx
index 4be1fedb7d26..c1a0d165f397 100644
--- a/jvmaccess/source/classpath.cxx
+++ b/jvmaccess/source/classpath.cxx
@@ -25,6 +25,7 @@
#include <vector>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/RuntimeException.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -32,6 +33,7 @@
#include <com/sun/star/uri/UriReferenceFactory.hpp>
#include <com/sun/star/uri/XVndSunStarExpandUrlReference.hpp>
#include <com/sun/star/util/theMacroExpander.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <rtl/ustring.hxx>
#include <sal/types.h>
@@ -66,9 +68,11 @@ jobjectArray jvmaccess::ClassPath::translateToUrls(
try {
url = expUrl->expand( expander );
} catch (const css::lang::IllegalArgumentException & e) {
- throw css::uno::RuntimeException(
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
"com.sun.star.lang.IllegalArgumentException: "
- + e.Message);
+ + e.Message,
+ nullptr, anyEx );
}
}
jvalue arg;
diff --git a/oox/source/docprop/docprophandler.cxx b/oox/source/docprop/docprophandler.cxx
index ae8d4829a91c..26d7e32443f7 100644
--- a/oox/source/docprop/docprophandler.cxx
+++ b/oox/source/docprop/docprophandler.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <o3tl/safeint.hxx>
#include <osl/time.h>
@@ -676,12 +677,13 @@ void SAL_CALL OOXMLDocPropHandler::characters( const OUString& aChars )
{
throw;
}
- catch( uno::Exception& e )
+ catch( uno::Exception& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw xml::sax::SAXException(
"Error while setting document property!",
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ anyEx );
}
}
diff --git a/package/source/manifest/ManifestWriter.cxx b/package/source/manifest/ManifestWriter.cxx
index d349eaadeaa6..bedb6121d37c 100644
--- a/package/source/manifest/ManifestWriter.cxx
+++ b/package/source/manifest/ManifestWriter.cxx
@@ -19,11 +19,13 @@
#include "ManifestWriter.hxx"
#include "ManifestExport.hxx"
+#include <cppuhelper/exc_hlp.hxx>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
@@ -63,7 +65,9 @@ void SAL_CALL ManifestWriter::writeManifestSequence( const Reference< XOutputStr
}
catch( SAXException& )
{
- throw RuntimeException( THROW_WHERE );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( THROW_WHERE,
+ nullptr, anyEx );
}
}
diff --git a/package/source/xstor/ohierarchyholder.cxx b/package/source/xstor/ohierarchyholder.cxx
index c07c7740c502..508107ac7c53 100644
--- a/package/source/xstor/ohierarchyholder.cxx
+++ b/package/source/xstor/ohierarchyholder.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/embed/XTransactionBroadcaster.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include "ohierarchyholder.hxx"
@@ -275,9 +276,11 @@ void SAL_CALL OHierarchyElement_Impl::disposing( const lang::EventObject& Source
TestForClosing();
}
- catch( uno::Exception& )
+ catch( uno::Exception& ex )
{
- throw uno::RuntimeException(); // no exception must happen here, usually an exception means disaster
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException( ex.Message,
+ nullptr, anyEx ); // no exception must happen here, usually an exception means disaster
}
}
@@ -309,12 +312,13 @@ void SAL_CALL OHierarchyElement_Impl::commited( const css::lang::EventObject& /*
{
Commit();
}
- catch( const uno::Exception& e )
+ catch( const uno::Exception& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"Can not commit storage sequence!",
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ anyEx );
}
}
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index a04580dcaeae..45eda6d4837e 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -1037,12 +1037,13 @@ void ZipPackage::WriteMimetypeMagicFile( ZipOutputStream& aZipOut )
aZipOut.rawWrite(aType);
aZipOut.rawCloseEntry();
}
- catch ( const css::io::IOException & r )
+ catch ( const css::io::IOException & )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw WrappedTargetException(
THROW_WHERE "Error adding mimetype to the ZipOutputStream!",
static_cast < OWeakObject * > ( this ),
- makeAny( r ) );
+ anyEx );
}
}
@@ -1432,10 +1433,11 @@ void SAL_CALL ZipPackage::commitChanges()
{
xTempInStream = writeTempFile();
}
- catch (const ucb::ContentCreationException& r)
+ catch (const ucb::ContentCreationException&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw WrappedTargetException(THROW_WHERE "Temporary file should be creatable!",
- static_cast < OWeakObject * > ( this ), makeAny ( r ) );
+ static_cast < OWeakObject * > ( this ), anyEx );
}
if ( xTempInStream.is() )
{
@@ -1445,10 +1447,11 @@ void SAL_CALL ZipPackage::commitChanges()
{
xTempSeek->seek( 0 );
}
- catch( const uno::Exception& r )
+ catch( const uno::Exception& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw WrappedTargetException(THROW_WHERE "Temporary file should be seekable!",
- static_cast < OWeakObject * > ( this ), makeAny ( r ) );
+ static_cast < OWeakObject * > ( this ), anyEx );
}
try
@@ -1456,10 +1459,11 @@ void SAL_CALL ZipPackage::commitChanges()
// connect to the temporary stream
ConnectTo( xTempInStream );
}
- catch( const io::IOException& r )
+ catch( const io::IOException& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw WrappedTargetException(THROW_WHERE "Temporary file should be connectable!",
- static_cast < OWeakObject * > ( this ), makeAny ( r ) );
+ static_cast < OWeakObject * > ( this ), anyEx );
}
if ( m_eMode == e_IMode_XStream )
@@ -1484,10 +1488,11 @@ void SAL_CALL ZipPackage::commitChanges()
// after successful truncation the original file contents are already lost
xTruncate->truncate();
}
- catch( const uno::Exception& r )
+ catch( const uno::Exception& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw WrappedTargetException(THROW_WHERE "This package is read only!",
- static_cast < OWeakObject * > ( this ), makeAny ( r ) );
+ static_cast < OWeakObject * > ( this ), anyEx );
}
try
@@ -1579,15 +1584,16 @@ void SAL_CALL ZipPackage::commitChanges()
// if the file is still not corrupted, it can become after the next step
aContent.executeCommand ("transfer", Any(aInfo) );
}
- catch ( const css::uno::Exception& r )
+ catch ( const css::uno::Exception& )
{
if ( bCanBeCorrupted )
DisconnectFromTargetAndThrowException_Impl( xTempInStream );
+ css::uno::Any anyEx = cppu::getCaughtException();
throw WrappedTargetException(
THROW_WHERE "This package may be read only!",
static_cast < OWeakObject * > ( this ),
- makeAny ( r ) );
+ anyEx );
}
}
}
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx
index eb5ad53f1ce7..f2b1015a7055 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -25,6 +25,7 @@
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <zipfileaccess.hxx>
#include <ZipEnumeration.hxx>
@@ -282,11 +283,11 @@ uno::Any SAL_CALL OZipFileAccess::getByName( const OUString& aName )
{
throw;
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetException( "This package is unusable!",
- static_cast < OWeakObject * > ( this ),
- makeAny(e));
+ static_cast < OWeakObject * > ( this ), anyEx);
}
if ( !xEntryStream.is() )
diff --git a/pyuno/source/module/pyuno_adapter.cxx b/pyuno/source/module/pyuno_adapter.cxx
index 0a18a48ae75b..1461d1adec48 100644
--- a/pyuno/source/module/pyuno_adapter.cxx
+++ b/pyuno/source/module/pyuno_adapter.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/beans/MethodConcept.hpp>
#include <com/sun/star/beans/UnknownPropertyException.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/typeprovider.hxx>
@@ -378,7 +379,8 @@ void Adapter::setValue( const OUString & aPropertyName, const Any & value )
}
catch( const IllegalArgumentException & exc )
{
- throw InvocationTargetException( exc.Message, *this, css::uno::makeAny( exc ) );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw InvocationTargetException( exc.Message, *this, anyEx );
}
}
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index 751c104dca04..53c7acb709b8 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -40,6 +40,7 @@
#include <com/sun/star/script/InvocationAdapterFactory.hpp>
#include <com/sun/star/reflection/theCoreReflection.hpp>
#include <comphelper/sequence.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <vector>
@@ -804,8 +805,9 @@ Any Runtime::pyObject2Any ( const PyRef & source, enum ConversionMode mode ) con
}
catch( const css::uno::Exception & e )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw WrappedTargetRuntimeException(
- e.Message, e.Context, makeAny(e));
+ e.Message, e.Context, anyEx);
}
}
diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx
index f738292b7e24..de391990eb12 100644
--- a/reportdesign/source/core/api/ReportDefinition.cxx
+++ b/reportdesign/source/core/api/ReportDefinition.cxx
@@ -1647,12 +1647,15 @@ void SAL_CALL OReportDefinition::load( const uno::Sequence< beans::PropertyValue
catch (const uno::Exception&)
{
if ( i == nLastOpenMode )
+ {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetException(
"An error occurred while creating the document storage.",
// TODO: resource
*this,
- ::cppu::getCaughtException()
+ anyEx
);
+ }
}
}
diff --git a/sax/source/expatwrap/saxwriter.cxx b/sax/source/expatwrap/saxwriter.cxx
index c9d0a9b48cce..e35bb5c2b0e3 100644
--- a/sax/source/expatwrap/saxwriter.cxx
+++ b/sax/source/expatwrap/saxwriter.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/io/XActiveDataSource.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -212,14 +213,13 @@ inline sal_uInt32 SaxWriterHelper::writeSequence()
{
m_out->writeBytes( m_Sequence );
}
- catch (const IOException & e)
+ catch (const IOException &)
{
- Any a;
- a <<= e;
+ css::uno::Any anyEx = cppu::getCaughtException();
throw SAXException(
"IO exception during writing",
Reference< XInterface > (),
- a );
+ anyEx );
}
nLastLineFeedPos -= SEQUENCESIZE;
return 0;
@@ -1088,14 +1088,13 @@ void SAXWriter::endDocument()
{
m_out->closeOutput();
}
- catch (const IOException & e)
+ catch (const IOException &)
{
- Any a;
- a <<= e;
+ css::uno::Any anyEx = cppu::getCaughtException();
throw SAXException(
"IO exception during closing the IO Stream",
Reference< XInterface > (),
- a );
+ anyEx );
}
}
diff --git a/sc/source/ui/sidebar/ScPanelFactory.cxx b/sc/source/ui/sidebar/ScPanelFactory.cxx
index fcbe9a495a42..41777caf360c 100644
--- a/sc/source/ui/sidebar/ScPanelFactory.cxx
+++ b/sc/source/ui/sidebar/ScPanelFactory.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <comphelper/namedvaluecollection.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
using namespace css;
@@ -109,11 +110,12 @@ Reference<ui::XUIElement> SAL_CALL ScPanelFactory::createUIElement (
{
throw;
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"ScPanelFactory::createUIElement exception",
- nullptr, uno::makeAny(e));
+ nullptr, anyEx);
}
return xElement;
diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx
index 8bf22f9f4925..1bc766238ce3 100644
--- a/sc/source/ui/unoobj/dapiuno.cxx
+++ b/sc/source/ui/unoobj/dapiuno.cxx
@@ -48,6 +48,7 @@
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/lang/NullPointerException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/sheet/XHierarchiesSupplier.hpp>
#include <com/sun/star/sheet/XLevelsSupplier.hpp>
#include <com/sun/star/sheet/XMembersSupplier.hpp>
@@ -63,6 +64,7 @@
#include <comphelper/propertysequence.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/exc_hlp.hxx>
using namespace com::sun::star;
using namespace com::sun::star::sheet;
@@ -2664,9 +2666,12 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons
}
catch (const container::NoSuchElementException&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
SAL_WARN("sc.ui", "Cannot find field with that name: " + sNewDim + ".");
// Avoid throwing exception that's not specified in the method signature.
- throw RuntimeException("Cannot find field with name \"" + sNewDim + "\"", static_cast<cppu::OWeakObject*>(this));
+ throw css::lang::WrappedTargetRuntimeException(
+ "Cannot find field with name \"" + sNewDim + "\"",
+ static_cast<cppu::OWeakObject*>(this), anyEx );
}
}
}
diff --git a/sc/source/ui/vba/vbaaxes.cxx b/sc/source/ui/vba/vbaaxes.cxx
index babb55e034b3..1f1ee3b2a9de 100644
--- a/sc/source/ui/vba/vbaaxes.cxx
+++ b/sc/source/ui/vba/vbaaxes.cxx
@@ -21,6 +21,7 @@
#include "vbaaxis.hxx"
#include "vbachart.hxx"
#include <basic/sberrors.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <ooo/vba/excel/XlAxisType.hpp>
#include <ooo/vba/excel/XlAxisGroup.hpp>
@@ -124,12 +125,13 @@ public:
AxesCoordinate dIndexes = mCoordinates[ Index ];
return uno::makeAny( ScVbaAxes::createAxis( mxChart, mxContext, dIndexes.second, dIndexes.first ) );
}
- catch (const css::script::BasicErrorException& e)
+ catch (const css::script::BasicErrorException&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetException(
"Error Getting Index!",
static_cast < OWeakObject * > ( this ),
- makeAny( e ) );
+ anyEx );
}
}
// XElementAccess
diff --git a/sc/source/ui/vba/vbachartobjects.cxx b/sc/source/ui/vba/vbachartobjects.cxx
index 3b427d4228b4..beb97e5b0ea6 100644
--- a/sc/source/ui/vba/vbachartobjects.cxx
+++ b/sc/source/ui/vba/vbachartobjects.cxx
@@ -65,12 +65,13 @@ public:
{
throw;
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
+ css::uno::Any anyEx(cppu::getCaughtException());
throw lang::WrappedTargetException(
"Error creating ScVbaChartObject!",
static_cast < OWeakObject * > ( this ),
- makeAny( e ) );
+ anyEx );
}
return ret;
}
diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx
index 2ad45a3716a8..9d2b78693fee 100644
--- a/sc/source/ui/vba/vbarange.cxx
+++ b/sc/source/ui/vba/vbarange.cxx
@@ -22,6 +22,7 @@
#include <vbahelper/helperdecl.hxx>
#include <comphelper/unwrapargs.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <o3tl/any.hxx>
#include <sfx2/objsh.hxx>
@@ -61,6 +62,7 @@
#include <com/sun/star/table/TableSortField.hpp>
#include <com/sun/star/util/XMergeable.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
@@ -2981,7 +2983,9 @@ ScVbaRange::getHidden()
}
catch( const uno::Exception& e )
{
- throw uno::RuntimeException( e.Message );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ nullptr, anyEx );
}
return uno::makeAny( !bIsVisible );
}
@@ -3008,7 +3012,9 @@ ScVbaRange::setHidden( const uno::Any& _hidden )
}
catch( const uno::Exception& e )
{
- throw uno::RuntimeException( e.Message );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( e.Message,
+ nullptr, anyEx );
}
}
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx
index d238bdbd300d..2933ab8b7f0d 100644
--- a/scripting/source/protocolhandler/scripthandler.cxx
+++ b/scripting/source/protocolhandler/scripthandler.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/document/XEmbeddedScripts.hpp>
#include <com/sun/star/document/XScriptInvocationContext.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/script/provider/ScriptFrameworkErrorException.hpp>
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
@@ -399,15 +400,12 @@ void ScriptProtocolHandler::createScriptProvider()
m_xScriptProvider.set( xFac->createScriptProvider( aContext ), UNO_QUERY_THROW );
}
}
- catch ( const RuntimeException & e )
- {
- OUString temp = "ScriptProtocolHandler::createScriptProvider(), ";
- throw RuntimeException( temp.concat( e.Message ) );
- }
catch ( const Exception & e )
{
- OUString temp = "ScriptProtocolHandler::createScriptProvider: ";
- throw RuntimeException( temp.concat( e.Message ) );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "ScriptProtocolHandler::createScriptProvider: " + e.Message,
+ nullptr, anyEx );
}
}
diff --git a/scripting/source/provider/ActiveMSPList.cxx b/scripting/source/provider/ActiveMSPList.cxx
index 6b1da6093352..5411b5a474ef 100644
--- a/scripting/source/provider/ActiveMSPList.cxx
+++ b/scripting/source/provider/ActiveMSPList.cxx
@@ -218,10 +218,11 @@ Reference< provider::XScriptProvider >
}
catch( const Exception& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"Failed to create MasterScriptProvider for context '"
+ context + "'.",
- *this, ::cppu::getCaughtException() );
+ *this, anyEx );
}
return msp;
}
diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx
index 98103a8984e3..09cfbcb6c988 100644
--- a/scripting/source/provider/ProviderCache.cxx
+++ b/scripting/source/provider/ProviderCache.cxx
@@ -22,6 +22,7 @@
#include <tools/diagnose_ex.h>
#include <com/sun/star/container/XContentEnumerationAccess.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include "ProviderCache.hxx"
using namespace com::sun::star;
@@ -168,10 +169,11 @@ ProviderCache::populateCache()
}
catch ( const Exception &e )
{
- OUString temp =
- "ProviderCache::populateCache: couldn't obtain XSingleComponentFactory for "
- + serviceName;
- throw RuntimeException( temp.concat( e.Message ) );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "ProviderCache::populateCache: couldn't obtain XSingleComponentFactory for " + serviceName
+ + " " + e.Message,
+ nullptr, anyEx );
}
}
@@ -185,7 +187,10 @@ ProviderCache::createProvider( ProviderDetails& details )
}
catch ( const Exception& e )
{
- throw RuntimeException( "ProviderCache::createProvider() Error creating provider from factory. " + e.Message );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "ProviderCache::createProvider() Error creating provider from factory. " + e.Message,
+ nullptr, anyEx );
}
return details.provider;
diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx
index 3327304a0d3d..4f2cde188768 100644
--- a/sd/source/core/stlsheet.cxx
+++ b/sd/source/core/stlsheet.cxx
@@ -19,10 +19,12 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <osl/mutex.hxx>
#include <vcl/svapp.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/interfacecontainer.hxx>
@@ -723,7 +725,10 @@ void SAL_CALL SdStyleSheet::dispose( )
}
catch (const Exception & exc)
{
- throw RuntimeException( "unexpected UNO exception caught: " + exc.Message );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "unexpected UNO exception caught: " + exc.Message ,
+ nullptr, anyEx );
}
}
}
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
index ff6ad06ea6a7..b24edf6e184c 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -44,6 +44,7 @@
#include <unotools/mediadescriptor.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/storagehelper.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/XmlIdRegistry.hxx>
@@ -305,9 +306,10 @@ addFile(struct DocumentMetadataAccess_Impl const & i_rImpl,
}
} catch (const uno::RuntimeException &) {
throw;
- } catch (const uno::Exception & e) {
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
- "addFile: exception", /*this*/nullptr, uno::makeAny(e));
+ "addFile: exception", /*this*/nullptr, anyEx);
}
}
@@ -353,10 +355,11 @@ removeFile(struct DocumentMetadataAccess_Impl const & i_rImpl,
getURI<rdf::URIs::RDF_TYPE>(i_rImpl.m_xContext), nullptr);
} catch (const uno::RuntimeException &) {
throw;
- } catch (const uno::Exception & e) {
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"removeFile: exception",
- nullptr, uno::makeAny(e));
+ nullptr, anyEx);
}
}
@@ -382,10 +385,11 @@ getAllParts(struct DocumentMetadataAccess_Impl const & i_rImpl)
return ret;
} catch (const uno::RuntimeException &) {
throw;
- } catch (const uno::Exception & e) {
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"getAllParts: exception",
- nullptr, uno::makeAny(e));
+ nullptr, anyEx);
}
}
@@ -404,10 +408,11 @@ isPartOfType(struct DocumentMetadataAccess_Impl const & i_rImpl,
return xEnum->hasMoreElements();
} catch (const uno::RuntimeException &) {
throw;
- } catch (const uno::Exception & e) {
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"isPartOfType: exception",
- nullptr, uno::makeAny(e));
+ nullptr, anyEx);
}
}
@@ -577,10 +582,11 @@ retry:
if (handleError(e, i_xHandler)) goto retry;
} catch (const uno::RuntimeException &) {
throw;
- } catch (const uno::Exception & e) {
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"importFile: exception",
- nullptr, uno::makeAny(e));
+ nullptr, anyEx);
}
}
@@ -735,10 +741,11 @@ static void init(struct DocumentMetadataAccess_Impl & i_rImpl)
i_rImpl.m_xManifest->addStatement(i_rImpl.m_xBaseURI.get(),
getURI<rdf::URIs::RDF_TYPE>(i_rImpl.m_xContext),
getURI<rdf::URIs::PKG_DOCUMENT>(i_rImpl.m_xContext).get());
- } catch (const uno::Exception & e) {
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"init: unexpected exception", nullptr,
- uno::makeAny(e));
+ anyEx);
}
// add top-level content files
@@ -898,10 +905,11 @@ DocumentMetadataAccess::addMetadataFile(const OUString & i_rFileName,
try {
m_pImpl->m_xRepository->createGraph(xGraphName);
- } catch (const rdf::RepositoryException & e) {
+ } catch (const rdf::RepositoryException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"DocumentMetadataAccess::addMetadataFile: exception",
- *this, uno::makeAny(e));
+ *this, anyEx);
// note: all other exceptions are propagated
}
@@ -940,10 +948,11 @@ DocumentMetadataAccess::importMetadataFile(::sal_Int16 i_Format,
try {
m_pImpl->m_xRepository->importGraph(
i_Format, i_xInStream, xGraphName, i_xBaseURI);
- } catch (const rdf::RepositoryException & e) {
+ } catch (const rdf::RepositoryException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"DocumentMetadataAccess::importMetadataFile: "
- "RepositoryException", *this, uno::makeAny(e));
+ "RepositoryException", *this, anyEx);
// note: all other exceptions are propagated
}
@@ -958,10 +967,11 @@ DocumentMetadataAccess::removeMetadataFile(
{
try {
m_pImpl->m_xRepository->destroyGraph(i_xGraphName);
- } catch (const rdf::RepositoryException & e) {
+ } catch (const rdf::RepositoryException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"DocumentMetadataAccess::removeMetadataFile: "
- "RepositoryException", *this, uno::makeAny(e));
+ "RepositoryException", *this, anyEx);
// note: all other exceptions are propagated
}
@@ -1017,10 +1027,11 @@ DocumentMetadataAccess::removeContentOrStylesFile(
} catch (const uno::RuntimeException &) {
throw;
- } catch (const uno::Exception & e) {
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"DocumentMetadataAccess::removeContentOrStylesFile: exception",
- *this, uno::makeAny(e));
+ *this, anyEx);
}
}
@@ -1113,10 +1124,11 @@ void SAL_CALL DocumentMetadataAccess::loadMetadataFromStorage(
}
} catch (const uno::RuntimeException &) {
throw;
- } catch (const uno::Exception & e) {
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"DocumentMetadataAccess::loadMetadataFromStorage: "
- "exception", *this, uno::makeAny(e));
+ "exception", *this, anyEx);
}
for (const auto& aStgFile : StgFiles)
@@ -1143,12 +1155,14 @@ void SAL_CALL DocumentMetadataAccess::storeMetadataToStorage(
writeStream(*m_pImpl, i_xStorage, xManifest, s_manifest, baseURI);
} catch (const uno::RuntimeException &) {
throw;
- } catch (const io::IOException & e) {
+ } catch (const io::IOException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetException(
- "storeMetadataToStorage: IO exception", *this, uno::makeAny(e));
- } catch (const uno::Exception & e) {
+ "storeMetadataToStorage: IO exception", *this, anyEx);
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
- "storeMetadataToStorage: exception", *this, uno::makeAny(e));
+ "storeMetadataToStorage: exception", *this, anyEx);
}
// export metadata streams
@@ -1175,19 +1189,22 @@ void SAL_CALL DocumentMetadataAccess::storeMetadataToStorage(
writeStream(*m_pImpl, i_xStorage, xName, relName, baseURI);
} catch (const uno::RuntimeException &) {
throw;
- } catch (const io::IOException & e) {
+ } catch (const io::IOException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetException(
"storeMetadataToStorage: IO exception",
- *this, uno::makeAny(e));
- } catch (const uno::Exception & e) {
+ *this, anyEx);
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"storeMetadataToStorage: exception",
- *this, uno::makeAny(e));
+ *this, anyEx);
}
}
- } catch (const rdf::RepositoryException & e) {
+ } catch (const rdf::RepositoryException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
- "storeMetadataToStorage: exception", *this, uno::makeAny(e));
+ "storeMetadataToStorage: exception", *this, anyEx);
}
}
@@ -1222,10 +1239,11 @@ DocumentMetadataAccess::loadMetadataFromMedium(
throw;
} catch (const io::IOException &) {
throw;
- } catch (const uno::Exception & e) {
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetException(
"DocumentMetadataAccess::loadMetadataFromMedium: "
- "exception", *this, uno::makeAny(e));
+ "exception", *this, anyEx);
}
if (!xStorage.is()) {
throw uno::RuntimeException(
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 7e696129ad78..1d808f67c5c3 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -20,6 +20,7 @@
#include <sal/config.h>
#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
@@ -677,11 +678,11 @@ SfxDocumentMetaData::setMetaText(const char* i_name,
xNode->appendChild(xTextNode);
return true;
}
- } catch (const css::xml::dom::DOMException & e) {
- css::uno::Any a(e);
+ } catch (const css::xml::dom::DOMException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"SfxDocumentMetaData::setMetaText: DOM exception",
- css::uno::Reference<css::uno::XInterface>(*this), a);
+ css::uno::Reference<css::uno::XInterface>(*this), anyEx);
}
}
@@ -808,11 +809,11 @@ SfxDocumentMetaData::setMetaList(const char* i_name,
}
return true;
- } catch (const css::xml::dom::DOMException & e) {
- css::uno::Any a(e);
+ } catch (const css::xml::dom::DOMException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"SfxDocumentMetaData::setMetaList: DOM exception",
- css::uno::Reference<css::uno::XInterface>(*this), a);
+ css::uno::Reference<css::uno::XInterface>(*this), anyEx);
}
}
@@ -947,11 +948,11 @@ SfxDocumentMetaData::updateElement(const char *i_name,
m_xParent->appendChild(xNode);
}
m_meta[name] = xNode;
- } catch (const css::xml::dom::DOMException & e) {
- css::uno::Any a(e);
+ } catch (const css::xml::dom::DOMException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"SfxDocumentMetaData::updateElement: DOM exception",
- css::uno::Reference<css::uno::XInterface>(*this), a);
+ css::uno::Reference<css::uno::XInterface>(*this), anyEx);
}
}
@@ -1104,11 +1105,11 @@ void SfxDocumentMetaData::init(
css::uno::UNO_QUERY_THROW);
xRElem->appendChild(xParent);
m_xParent = xParent;
- } catch (const css::xml::dom::DOMException & e) {
- css::uno::Any a(e);
+ } catch (const css::xml::dom::DOMException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"SfxDocumentMetaData::init: DOM exception",
- css::uno::Reference<css::uno::XInterface>(*this), a);
+ css::uno::Reference<css::uno::XInterface>(*this), anyEx);
}
}
@@ -1886,11 +1887,12 @@ SfxDocumentMetaData::loadFromMedium(const OUString & URL,
throw;
} catch (const css::io::IOException &) {
throw;
- } catch (const css::uno::Exception & e) {
+ } catch (const css::uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetException(
"SfxDocumentMetaData::loadFromMedium: exception",
css::uno::Reference<css::uno::XInterface>(*this),
- css::uno::makeAny(e));
+ anyEx);
}
if (!xStorage.is()) {
throw css::uno::RuntimeException(
@@ -2001,11 +2003,11 @@ SfxDocumentMetaData::createClone()
pNew->init(xDoc);
} catch (const css::uno::RuntimeException &) {
throw;
- } catch (const css::uno::Exception & e) {
- css::uno::Any a(e);
+ } catch (const css::uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"SfxDocumentMetaData::createClone: exception",
- css::uno::Reference<css::uno::XInterface>(*this), a);
+ css::uno::Reference<css::uno::XInterface>(*this), anyEx);
}
return css::uno::Reference<css::util::XCloneable> (pNew);
}
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 752bec0ebc07..524b4f0b5b3d 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -2373,7 +2373,9 @@ void SAL_CALL SfxBaseModel::updateCmisProperties( const Sequence< document::Cmis
}
catch (const Exception & e)
{
- throw RuntimeException( e.Message, e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
}
@@ -2406,7 +2408,9 @@ void SAL_CALL SfxBaseModel::checkOut( )
}
catch ( const Exception & e )
{
- throw RuntimeException( e.Message, e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
}
}
@@ -2430,7 +2434,9 @@ void SAL_CALL SfxBaseModel::cancelCheckOut( )
}
catch ( const Exception & e )
{
- throw RuntimeException( e.Message, e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
}
}
@@ -2471,7 +2477,9 @@ void SAL_CALL SfxBaseModel::checkIn( sal_Bool bIsMajor, const OUString& rMessage
}
catch ( const Exception & e )
{
- throw RuntimeException( e.Message, e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
}
}
@@ -2493,7 +2501,9 @@ uno::Sequence< document::CmisVersion > SAL_CALL SfxBaseModel::getAllVersions( )
}
catch ( const Exception & e )
{
- throw RuntimeException( e.Message, e.Context );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException( e.Message,
+ e.Context, anyEx );
}
}
return aVersions;
diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx
index 81d93b38f55b..d12c1ea3e109 100644
--- a/sfx2/source/view/ipclient.cxx
+++ b/sfx2/source/view/ipclient.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/embed/XStateChangeListener.hpp>
#include <com/sun/star/embed/StateChangeInProgressException.hpp>
#include <com/sun/star/embed/XLinkageSupport.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/task/ErrorCodeIOException.hpp>
#include <com/sun/star/task/StatusIndicatorFactory.hpp>
@@ -63,6 +64,7 @@
#include <svl/rectitem.hxx>
#include <svtools/soerr.hxx>
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <sfx2/lokhelper.hxx>
@@ -371,9 +373,11 @@ uno::Reference< css::frame::XLayoutManager > SAL_CALL SfxInPlaceClient_Impl::get
uno::Any aAny = xFrame->getPropertyValue( "LayoutManager" );
aAny >>= xMan;
}
- catch ( uno::Exception& )
+ catch ( uno::Exception& ex )
{
- throw uno::RuntimeException();
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ nullptr, anyEx );
}
return xMan;
diff --git a/sot/source/unoolestorage/xolesimplestorage.cxx b/sot/source/unoolestorage/xolesimplestorage.cxx
index 947d3d132f1f..f8b554cb04bb 100644
--- a/sot/source/unoolestorage/xolesimplestorage.cxx
+++ b/sot/source/unoolestorage/xolesimplestorage.cxx
@@ -22,6 +22,7 @@
#include <com/sun/star/embed/OLESimpleStorage.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/lang/NoSupportException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XInputStream.hpp>
@@ -306,11 +307,12 @@ void SAL_CALL OLESimpleStorage::insertByName( const OUString& aName, const uno::
{
throw;
}
- catch( const uno::Exception& e )
+ catch( const uno::Exception& )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetException("Insert has failed!",
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ anyEx );
}
}
@@ -453,10 +455,12 @@ uno::Any SAL_CALL OLESimpleStorage::getByName( const OUString& aName )
DELETEZ( pStream );
throw;
}
- catch (const uno::Exception&)
+ catch (const uno::Exception& ex)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
DELETEZ( pStream );
- throw lang::WrappedTargetException(); // TODO:
+ throw css::lang::WrappedTargetException( ex.Message,
+ nullptr, anyEx );
}
DELETEZ( pStream );
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index fd24918dd06d..7dff88085b57 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -21,6 +21,7 @@
#include <string.h>
#include <vector>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/queryinterface.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase.hxx>
@@ -36,6 +37,7 @@
#include <rtl/ustrbuf.hxx>
#include <osl/process.h>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/loader/XImplementationLoader.hpp>
@@ -962,8 +964,10 @@ void insert_singletons(
}
catch (const container::NoSuchElementException & exc)
{
- throw RuntimeException(
- "cannot get service type description: " + exc.Message );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "cannot get service type description: " + exc.Message,
+ nullptr, anyEx );
}
}
}
diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index 82dfbac5a417..1e4e54b297d5 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -19,6 +19,7 @@
#include <osl/mutex.hxx>
#include <cppuhelper/queryinterface.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/weak.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implementationentry.hxx>
@@ -562,9 +563,10 @@ void Invocation_Impl::setValue( const OUString& PropertyName, const Any& Value )
}
catch (const Exception & exc)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw InvocationTargetException(
"exception occurred in setValue(): " + exc.Message,
- Reference< XInterface >(), makeAny( exc /* though sliced */ ) );
+ Reference< XInterface >(), anyEx );
}
}
}
diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx
index b51446c639fa..28aefc9fddf4 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -29,6 +29,8 @@
#include <uno/lbnames.h>
#include <uno/mapping.hxx>
#include <com/sun/star/uno/RuntimeException.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#ifdef LINUX
#undef minor
@@ -252,7 +254,10 @@ const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaL
}
catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &)
{
- throw RuntimeException("jvmaccess::VirtualMachine::AttachGuard::CreationException");
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
+ "jvmaccess::VirtualMachine::AttachGuard::CreationException",
+ static_cast< cppu::OWeakObject * >(this), anyEx );
}
// set the service manager at the javaloader
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index 6a6652390683..97167891c3e2 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -642,9 +642,10 @@ JavaVirtualMachine::initialize(css::uno::Sequence< css::uno::Any > const &
try {
m_xUnoVirtualMachine = new jvmaccess::UnoVirtualMachine(vm, nullptr);
} catch (jvmaccess::UnoVirtualMachine::CreationException &) {
- throw css::uno::RuntimeException(
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
"jvmaccess::UnoVirtualMachine::CreationException",
- static_cast< cppu::OWeakObject * >(this));
+ static_cast< cppu::OWeakObject * >(this), anyEx );
}
}
}
@@ -870,9 +871,10 @@ JavaVirtualMachine::getJavaVM(css::uno::Sequence< sal_Int8 > const & rProcessId)
jvmaccess::VirtualMachine::AttachGuard guard(m_xVirtualMachine);
setUpUnoVirtualMachine(guard.getEnvironment());
} catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &) {
- throw css::uno::RuntimeException(
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
"jvmaccess::VirtualMachine::AttachGuard::CreationException occurred",
- static_cast< cppu::OWeakObject * >(this));
+ static_cast< cppu::OWeakObject * >(this), anyEx );
}
}
switch (returnType) {
@@ -961,10 +963,11 @@ void SAL_CALL JavaVirtualMachine::registerThread()
}
catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &)
{
- throw css::uno::RuntimeException(
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
"JavaVirtualMachine::registerThread: jvmaccess::"
"VirtualMachine::AttachGuard::CreationException",
- static_cast< cppu::OWeakObject * >(this));
+ static_cast< cppu::OWeakObject * >(this), anyEx );
}
}
@@ -1234,9 +1237,10 @@ void SAL_CALL JavaVirtualMachine::elementReplaced(
}
catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &)
{
- throw css::uno::RuntimeException(
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
"jvmaccess::VirtualMachine::AttachGuard::CreationException",
- nullptr);
+ static_cast< cppu::OWeakObject * >(this), anyEx );
}
}
}
@@ -1476,9 +1480,10 @@ void JavaVirtualMachine::setUpUnoVirtualMachine(JNIEnv * environment) {
try {
baseUrl = exp->expandMacros("$URE_INTERNAL_JAVA_DIR/");
} catch (css::lang::IllegalArgumentException &) {
- throw css::uno::RuntimeException(
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
"css::lang::IllegalArgumentException",
- static_cast< cppu::OWeakObject * >(this));
+ static_cast< cppu::OWeakObject * >(this), anyEx );
}
OUString classPath;
try {
@@ -1576,9 +1581,10 @@ void JavaVirtualMachine::setUpUnoVirtualMachine(JNIEnv * environment) {
m_xUnoVirtualMachine = new jvmaccess::UnoVirtualMachine(
m_xVirtualMachine, cl2);
} catch (jvmaccess::UnoVirtualMachine::CreationException &) {
- throw css::uno::RuntimeException(
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
"jvmaccess::UnoVirtualMachine::CreationException",
- static_cast< cppu::OWeakObject * >(this));
+ static_cast< cppu::OWeakObject * >(this), anyEx );
}
}
diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx
index dc96323c1bb4..ac1178bb491d 100644
--- a/stoc/source/uriproc/UriReferenceFactory.cxx
+++ b/stoc/source/uriproc/UriReferenceFactory.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/uri/XUriReference.hpp>
#include <com/sun/star/uri/XUriReferenceFactory.hpp>
#include <com/sun/star/uri/XUriSchemeParser.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weak.hxx>
@@ -350,11 +351,12 @@ css::uno::Reference< css::uri::XUriReference > Factory::parse(
serviceName, m_context);
} catch (css::uno::RuntimeException &) {
throw;
- } catch (const css::uno::Exception & e) {
+ } catch (const css::uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"creating service " + serviceName,
static_cast< cppu::OWeakObject * >(this),
- css::uno::makeAny(e)); //TODO: preserve type of e
+ anyEx);
}
if (service.is()) {
parser.set( service, css::uno::UNO_QUERY_THROW);
diff --git a/svl/source/fsstor/fsstorage.cxx b/svl/source/fsstor/fsstorage.cxx
index c1350f86270a..3d21e23c3b0c 100644
--- a/svl/source/fsstor/fsstorage.cxx
+++ b/svl/source/fsstor/fsstorage.cxx
@@ -1015,9 +1015,11 @@ sal_Bool SAL_CALL FSStorage::hasElements()
{
throw;
}
- catch (const uno::Exception&)
+ catch (const uno::Exception& ex)
{
- throw uno::RuntimeException();
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException( ex.Message,
+ nullptr, anyEx );
}
}
diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx
index cddbd3285444..9618c0bab20c 100644
--- a/svx/source/svdraw/svdoole2.cxx
+++ b/svx/source/svdraw/svdoole2.cxx
@@ -36,6 +36,7 @@
#include <com/sun/star/document/XEventListener.hpp>
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <cppuhelper/exc_hlp.hxx>
@@ -423,9 +424,11 @@ uno::Reference< css::frame::XLayoutManager > SAL_CALL SdrLightEmbeddedClient_Imp
{
xMan.set(xFrame->getPropertyValue("LayoutManager"),uno::UNO_QUERY);
}
- catch ( uno::Exception& )
+ catch ( uno::Exception& ex )
{
- throw uno::RuntimeException();
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ nullptr, anyEx );
}
return xMan;
diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx
index 008be0731645..e584504026bf 100644
--- a/svx/source/unodraw/unoshap4.cxx
+++ b/svx/source/unodraw/unoshap4.cxx
@@ -30,6 +30,7 @@
#include <svx/svdpool.hxx>
#include <comphelper/classids.hxx>
#include <comphelper/propertysequence.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <sfx2/frmdescr.hxx>
#include <vcl/svapp.hxx>
@@ -879,19 +880,21 @@ bool SvxMediaShape::setPropertyValueImpl( const OUString& rName, const SfxItemPr
pMedia->SetInputStream(xStream);
}
}
- catch (const css::ucb::ContentCreationException& e)
+ catch (const css::ucb::ContentCreationException&)
{
+ css::uno::Any exc = cppu::getCaughtException();
throw css::lang::WrappedTargetException(
"ContentCreationException Setting InputStream!",
static_cast<OWeakObject *>(this),
- makeAny(e));
+ exc);
}
- catch (const css::ucb::CommandFailedException& e)
+ catch (const css::ucb::CommandFailedException&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetException(
"CommandFailedException Setting InputStream!",
static_cast<OWeakObject *>(this),
- makeAny(e));
+ anyEx);
}
#endif
break;
@@ -964,19 +967,19 @@ bool SvxMediaShape::getPropertyValueImpl( const OUString& rName, const SfxItemPr
{
rValue <<= pMedia->GetInputStream();
}
- catch (const css::ucb::ContentCreationException& e)
+ catch (const css::ucb::ContentCreationException&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetException(
"ContentCreationException Getting InputStream!",
- static_cast < OWeakObject * > ( this ),
- makeAny( e ) );
+ static_cast < OWeakObject * > ( this ), anyEx );
}
- catch (const css::ucb::CommandFailedException& e)
+ catch (const css::ucb::CommandFailedException&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetException(
"CommandFailedException Getting InputStream!",
- static_cast < OWeakObject * > ( this ),
- makeAny( e ) );
+ static_cast < OWeakObject * > ( this ), anyEx );
}
break;
diff --git a/svx/source/xml/xmleohlp.cxx b/svx/source/xml/xmleohlp.cxx
index c3f61476440e..a5058f1e7610 100644
--- a/svx/source/xml/xmleohlp.cxx
+++ b/svx/source/xml/xmleohlp.cxx
@@ -42,6 +42,7 @@
#include <comphelper/fileformat.h>
#include <comphelper/classids.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <svx/xmleohlp.hxx>
#include <map>
@@ -564,11 +565,12 @@ OUString SAL_CALL SvXMLEmbeddedObjectHelper::resolveEmbeddedObjectURL(const OUSt
{
throw;
}
- catch (const Exception& e)
+ catch (const Exception&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw WrappedTargetRuntimeException(
"SvXMLEmbeddedObjectHelper::resolveEmbeddedObjectURL non-RuntimeException",
- static_cast<uno::XWeak*>(this), uno::makeAny(e));
+ static_cast<uno::XWeak*>(this), anyEx);
}
return sRet;
}
diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx
index f7a76e902013..c097d53481c0 100644
--- a/sw/source/core/unocore/unoparagraph.cxx
+++ b/sw/source/core/unocore/unoparagraph.cxx
@@ -20,6 +20,7 @@
#include <unoparagraph.hxx>
#include <comphelper/interfacecontainer2.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cmdid.h>
@@ -43,6 +44,7 @@
#include <com/sun/star/beans/GetPropertyTolerantResult.hpp>
#include <com/sun/star/beans/TolerantPropertySetResultType.hpp>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/text/WrapTextMode.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
@@ -577,13 +579,15 @@ SwXParagraph::getPropertyValues(const uno::Sequence< OUString >& rPropertyNames)
}
catch (beans::UnknownPropertyException &)
{
- throw uno::RuntimeException("Unknown property exception caught",
- static_cast<cppu::OWeakObject *>(this));
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException("Unknown property exception caught",
+ static_cast < cppu::OWeakObject * > ( this ), anyEx );
}
catch (lang::WrappedTargetException &)
{
- throw uno::RuntimeException("WrappedTargetException caught",
- static_cast<cppu::OWeakObject *>(this));
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException("WrappedTargetException caught",
+ static_cast < cppu::OWeakObject * > ( this ), anyEx );
}
return aValues;
diff --git a/sw/source/core/unocore/unoport.cxx b/sw/source/core/unocore/unoport.cxx
index 80f707ef2526..6275e317caf9 100644
--- a/sw/source/core/unocore/unoport.cxx
+++ b/sw/source/core/unocore/unoport.cxx
@@ -467,11 +467,15 @@ uno::Sequence< uno::Any > SwXTextPortion::getPropertyValues(
}
catch (beans::UnknownPropertyException &)
{
- throw uno::RuntimeException("Unknown property exception caught", static_cast < cppu::OWeakObject * > ( this ) );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException("Unknown property exception caught",
+ static_cast < cppu::OWeakObject * > ( this ), anyEx );
}
catch (lang::WrappedTargetException &)
{
- throw uno::RuntimeException("WrappedTargetException caught", static_cast < cppu::OWeakObject * > ( this ) );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException("WrappedTargetException caught",
+ static_cast < cppu::OWeakObject * > ( this ), anyEx );
}
return aValues;
diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx
index 162cb004cd45..b989ad8a28fe 100644
--- a/sw/source/core/unocore/unorefmk.cxx
+++ b/sw/source/core/unocore/unorefmk.cxx
@@ -23,6 +23,7 @@
#include <comphelper/interfacecontainer2.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cppuhelper/weak.hxx>
#include <osl/mutex.hxx>
@@ -1505,10 +1506,9 @@ getPrefixAndSuffix(
}
} catch (uno::RuntimeException &) {
throw;
- } catch (const uno::Exception & e) {
- throw lang::WrappedTargetRuntimeException(
- "getPrefixAndSuffix: exception",
- nullptr, uno::makeAny(e));
+ } catch (const uno::Exception &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException("getPrefixAndSuffix: exception", nullptr, anyEx);
}
}
diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx
index 188299134f04..e7a2ca50481e 100644
--- a/sw/source/core/unocore/unosect.cxx
+++ b/sw/source/core/unocore/unosect.cxx
@@ -21,9 +21,11 @@
#include <unosection.hxx>
#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/text/SectionFileLink.hpp>
#include <comphelper/interfacecontainer2.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cmdid.h>
@@ -1261,13 +1263,15 @@ SwXTextSection::getPropertyValues(
}
catch (beans::UnknownPropertyException &)
{
- throw uno::RuntimeException("Unknown property exception caught",
- static_cast<cppu::OWeakObject *>(this));
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException("Unknown property exception caught",
+ static_cast < cppu::OWeakObject * > ( this ), anyEx );
}
catch (lang::WrappedTargetException &)
{
- throw uno::RuntimeException("WrappedTargetException caught",
- static_cast<cppu::OWeakObject *>(this));
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException("WrappedTargetException caught",
+ static_cast < cppu::OWeakObject * > ( this ), anyEx );
}
return aValues;
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 6fe6857b72d1..e126864d756d 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -67,6 +67,7 @@
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
#include <istyleaccess.hxx>
#include <GetMetricVal.hxx>
@@ -76,6 +77,7 @@
#include <fmtautofmt.hxx>
#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <comphelper/sequence.hxx>
#include <o3tl/make_unique.hxx>
@@ -2427,11 +2429,15 @@ uno::Sequence<uno::Any> SwXStyle::getPropertyValues(const uno::Sequence<OUString
}
catch(beans::UnknownPropertyException&)
{
- throw uno::RuntimeException("Unknown property exception caught", static_cast<cppu::OWeakObject*>(this));
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException("Unknown property exception caught",
+ static_cast < cppu::OWeakObject * > ( this ), anyEx );
}
catch(lang::WrappedTargetException&)
{
- throw uno::RuntimeException("WrappedTargetException caught", static_cast<cppu::OWeakObject*>(this));
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException("WrappedTargetException caught",
+ static_cast < cppu::OWeakObject * > ( this ), anyEx );
}
return aValues;
}
@@ -3259,11 +3265,15 @@ uno::Sequence<uno::Any> SwXPageStyle::getPropertyValues(const uno::Sequence<OUSt
}
catch(beans::UnknownPropertyException &)
{
- throw uno::RuntimeException("Unknown property exception caught", static_cast<cppu::OWeakObject*>(this));
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException("Unknown property exception caught",
+ static_cast < cppu::OWeakObject * > ( this ), anyEx );
}
catch(lang::WrappedTargetException &)
{
- throw uno::RuntimeException("WrappedTargetException caught", static_cast<cppu::OWeakObject*>(this));
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException("WrappedTargetException caught",
+ static_cast < cppu::OWeakObject * > ( this ), anyEx );
}
return aValues;
@@ -4063,11 +4073,13 @@ uno::Sequence< uno::Any > SwXAutoStyle::getPropertyValues (
}
catch (beans::UnknownPropertyException &)
{
- throw uno::RuntimeException("Unknown property exception caught", static_cast < cppu::OWeakObject * > ( this ) );
+ css::uno::Any exc = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException("Unknown property exception caught", static_cast < cppu::OWeakObject * > ( this ), exc );
}
catch (lang::WrappedTargetException &)
{
- throw uno::RuntimeException("WrappedTargetException caught", static_cast < cppu::OWeakObject * > ( this ) );
+ css::uno::Any exc = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException("WrappedTargetException caught", static_cast < cppu::OWeakObject * > ( this ), exc );
}
return aValues;
diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx
index b16ea0ab3d92..5fd149373e0a 100644
--- a/sw/source/core/unocore/unotext.cxx
+++ b/sw/source/core/unocore/unotext.cxx
@@ -35,6 +35,7 @@
#include <comphelper/profilezone.hxx>
#include <comphelper/sequence.hxx>
#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <cmdid.h>
@@ -345,7 +346,9 @@ SwXText::insertString(const uno::Reference< text::XTextRange >& xTextRange,
catch (const lang::IllegalArgumentException& iae)
{
// stupid method not allowed to throw iae
- throw uno::RuntimeException(iae.Message, nullptr);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException( iae.Message,
+ uno::Reference< uno::XInterface >(), anyEx );
}
}
if (bAbsorb)
@@ -1461,10 +1464,10 @@ SwXText::insertTextContentWithProperties(
}
catch (const uno::Exception& e)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
- lang::WrappedTargetRuntimeException wrapped;
- wrapped.TargetException <<= e;
- throw wrapped;
+ throw lang::WrappedTargetRuntimeException( e.Message,
+ uno::Reference< uno::XInterface >(), anyEx );
}
}
m_pImpl->m_pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr);
diff --git a/sw/source/uibase/uno/unoatxt.cxx b/sw/source/uibase/uno/unoatxt.cxx
index 5b37293c7805..b618f19bf2b4 100644
--- a/sw/source/uibase/uno/unoatxt.cxx
+++ b/sw/source/uibase/uno/unoatxt.cxx
@@ -54,6 +54,7 @@
#include <svl/macitem.hxx>
#include <editeng/acorrcfg.hxx>
#include <comphelper/servicehelper.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <memory>
@@ -417,12 +418,13 @@ uno::Reference< text::XAutoTextEntry > SwXAutoTextGroup::insertNewByName(const
{
throw;
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
"Error Getting AutoText!",
static_cast < OWeakObject * > ( this ),
- makeAny( e ) );
+ anyEx );
}
return xEntry;
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx
index 0c7bc5ef2a76..77d897007076 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -302,9 +302,12 @@ OUString const & CachedContentResultSet::CCRS_Cache
}
return *o3tl::doAccess<OUString>(getRowAny(nRow));
}
- catch(const SQLException&)
+ catch(const SQLException& ex)
{
- throw RuntimeException();
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ css::uno::Reference< css::uno::XInterface >(),
+ anyEx );
}
}
@@ -323,9 +326,12 @@ Reference< XContentIdentifier > CachedContentResultSet::CCRS_Cache
}
return *o3tl::doAccess<Reference<XContentIdentifier>>(getRowAny(nRow));
}
- catch(const SQLException&)
+ catch(const SQLException& ex)
{
- throw RuntimeException();
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ css::uno::Reference< css::uno::XInterface >(),
+ anyEx );
}
}
@@ -344,9 +350,12 @@ Reference< XContent > CachedContentResultSet::CCRS_Cache
}
return *o3tl::doAccess<Reference<XContent>>(getRowAny(nRow));
}
- catch (const SQLException&)
+ catch (const SQLException& ex)
{
- throw RuntimeException();
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ css::uno::Reference< css::uno::XInterface >(),
+ anyEx );
}
}
diff --git a/ucb/source/core/FileAccess.cxx b/ucb/source/core/FileAccess.cxx
index a581ff4f226f..9d7de62bfc56 100644
--- a/ucb/source/core/FileAccess.cxx
+++ b/ucb/source/core/FileAccess.cxx
@@ -18,6 +18,7 @@
*/
#include <uno/mapping.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/factory.hxx>
#include <cppuhelper/implbase.hxx>
@@ -33,6 +34,7 @@
#include <com/sun/star/io/XActiveDataSink.hpp>
#include <com/sun/star/io/XActiveDataSource.hpp>
#include <com/sun/star/io/XActiveDataStreamer.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/sdbc/XResultSet.hpp>
#include <com/sun/star/ucb/CommandFailedException.hpp>
@@ -238,9 +240,10 @@ void OFileAccess::transferImpl( const OUString& rSource,
}
catch ( Exception const & )
{
- throw RuntimeException(
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException(
"OFileAccess::transferrImpl - Unable to obtain destination folder URL!",
- static_cast< cppu::OWeakObject * >( this ) );
+ static_cast< cppu::OWeakObject * >( this ), anyEx );
}
transferImpl( rSource, aDestURL, bMoveData );
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index 80dffdce8659..04dc472bb055 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -19,9 +19,11 @@
#include <sal/config.h>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/ucb/IllegalIdentifierException.hpp>
#include <com/sun/star/ucb/UniversalContentBroker.hpp>
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <osl/socket.hxx>
#include "ftpcontentprovider.hxx"
#include "ftpcontent.hxx"
@@ -162,6 +164,11 @@ Reference<XContent> SAL_CALL FTPContentProvider::queryContent(
{
try {
init();
+ } catch (css::uno::Exception const & ex) {
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ css::uno::Reference< css::uno::XInterface >(),
+ anyEx );
} catch( ... ) {
throw RuntimeException();
}
diff --git a/ucb/source/ucp/package/pkgprovider.cxx b/ucb/source/ucp/package/pkgprovider.cxx
index ddc3ba5d8210..5c1b6d263785 100644
--- a/ucb/source/ucp/package/pkgprovider.cxx
+++ b/ucb/source/ucp/package/pkgprovider.cxx
@@ -25,6 +25,7 @@
*************************************************************************/
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/weak.hxx>
#include <ucbhelper/contentidentifier.hxx>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
@@ -238,8 +239,9 @@ ContentProvider::createPackage( const PackageUri & rURI )
}
catch ( uno::Exception const & e )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw css::lang::WrappedTargetRuntimeException(
- e.Message, e.Context, css::uno::makeAny(e));
+ e.Message, e.Context, anyEx);
}
rtl::Reference< Package> xPackage = new Package( rURL, xNameAccess, this );
diff --git a/ucb/source/ucp/tdoc/tdoc_storage.cxx b/ucb/source/ucp/tdoc/tdoc_storage.cxx
index c1f393eae31f..95a64428f57c 100644
--- a/ucb/source/ucp/tdoc/tdoc_storage.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_storage.cxx
@@ -26,6 +26,7 @@
#include <com/sun/star/embed/StorageWrappedTargetException.hpp>
#include <com/sun/star/io/IOException.hpp>
#include <com/sun/star/packages/NoEncryptionException.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <osl/diagnose.h>
#include "tdoc_uri.hxx"
@@ -425,23 +426,25 @@ uno::Reference< embed::XStorage > StorageElementFactory::queryStorage(
"Bug! Value of property OpenMode has wrong type!" );
}
}
- catch ( beans::UnknownPropertyException const & e )
+ catch ( beans::UnknownPropertyException const & )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
OSL_FAIL( "Property OpenMode not supported!" );
throw embed::StorageWrappedTargetException(
"Bug! Value of property OpenMode has wrong type!",
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ anyEx );
}
- catch ( lang::WrappedTargetException const & e )
+ catch ( lang::WrappedTargetException const & )
{
+ css::uno::Any anyEx = cppu::getCaughtException();
OSL_FAIL( "Caught WrappedTargetException!" );
throw embed::StorageWrappedTargetException(
"WrappedTargetException during getPropertyValue!",
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ anyEx );
}
}
else
diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx
index 57428c002823..cb85f43ec47b 100644
--- a/unoxml/source/rdf/librdf_repository.cxx
+++ b/unoxml/source/rdf/librdf_repository.cxx
@@ -55,6 +55,7 @@
#include <rtl/ref.hxx>
#include <rtl/ustring.hxx>
#include <osl/diagnose.h>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/basemutex.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -721,8 +722,10 @@ void SAL_CALL librdf_NamedGraph::clear()
const OUString contextU( m_xName->getStringValue() );
try {
m_pRep->clearGraph_NoLock(contextU);
- } catch (lang::IllegalArgumentException &) {
- throw uno::RuntimeException();
+ } catch (lang::IllegalArgumentException & ex) {
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw lang::WrappedTargetRuntimeException( ex.Message,
+ *this, anyEx );
}
}
@@ -850,10 +853,11 @@ uno::Reference< rdf::XBlankNode > SAL_CALL librdf_Repository::createBlankNode()
reinterpret_cast<const char *>(id)));
try {
return rdf::BlankNode::create(m_xContext, nodeID);
- } catch (const lang::IllegalArgumentException & iae) {
+ } catch (const lang::IllegalArgumentException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"librdf_Repository::createBlankNode: "
- "illegal blank node label", *this, uno::makeAny(iae));
+ "illegal blank node label", *this, anyEx);
}
}
@@ -1456,10 +1460,11 @@ void SAL_CALL librdf_Repository::setStatementRDFa(
xContent.set(rdf::Literal::create(m_xContext, content),
uno::UNO_QUERY_THROW);
}
- } catch (const lang::IllegalArgumentException & iae) {
+ } catch (const lang::IllegalArgumentException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"librdf_Repository::setStatementRDFa: "
- "cannot create literal", *this, uno::makeAny(iae));
+ "cannot create literal", *this, anyEx);
}
std::shared_ptr<librdf_TypeConverter::Resource> const pSubject(
@@ -1495,11 +1500,12 @@ void SAL_CALL librdf_Repository::setStatementRDFa(
sContext, true);
}
}
- catch (const container::NoSuchElementException& e)
+ catch (const container::NoSuchElementException&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"librdf_Repository::setStatementRDFa: "
- "cannot addStatementGraph", *this, uno::makeAny(e));
+ "cannot addStatementGraph", *this, anyEx);
}
}
@@ -1539,10 +1545,11 @@ librdf_Repository::getStatementRDFa(
try {
xXmlId.set( rdf::URI::create(m_xContext, s_nsOOo + sXmlId),
uno::UNO_QUERY_THROW);
- } catch (const lang::IllegalArgumentException & iae) {
+ } catch (const lang::IllegalArgumentException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"librdf_Repository::getStatementRDFa: "
- "cannot create URI for XML ID", *this, uno::makeAny(iae));
+ "cannot create URI for XML ID", *this, anyEx);
}
::std::vector< rdf::Statement > ret;
@@ -1561,11 +1568,12 @@ librdf_Repository::getStatementRDFa(
}
}
}
- catch (const container::NoSuchElementException& e)
+ catch (const container::NoSuchElementException&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"librdf_Repository::getStatementRDFa: "
- "cannot getStatementsGraph", *this, uno::makeAny(e));
+ "cannot getStatementsGraph", *this, anyEx);
}
::osl::MutexGuard g(m_aMutex); // don't call i_x* with mutex locked
@@ -2196,10 +2204,11 @@ librdf_TypeConverter::convertToXURI(librdf_uri* i_pURI) const
RTL_TEXTENCODING_UTF8) );
try {
return rdf::URI::create(m_xContext, uriU);
- } catch (const lang::IllegalArgumentException & iae) {
+ } catch (const lang::IllegalArgumentException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"librdf_TypeConverter::convertToXURI: "
- "illegal uri", m_rRep, uno::makeAny(iae));
+ "illegal uri", m_rRep, anyEx);
}
}
@@ -2238,10 +2247,11 @@ librdf_TypeConverter::convertToXResource(librdf_node* i_pNode) const
try {
return uno::Reference<rdf::XResource>(
rdf::BlankNode::create(m_xContext, labelU), uno::UNO_QUERY);
- } catch (const lang::IllegalArgumentException & iae) {
+ } catch (const lang::IllegalArgumentException &) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"librdf_TypeConverter::convertToXResource: "
- "illegal blank node label", m_rRep, uno::makeAny(iae));
+ "illegal blank node label", m_rRep, anyEx);
}
} else {
return uno::Reference<rdf::XResource>(convertToXURI(i_pNode),
diff --git a/uui/source/interactionhandler.cxx b/uui/source/interactionhandler.cxx
index 417a2e09fbbb..850eb59b0106 100644
--- a/uui/source/interactionhandler.cxx
+++ b/uui/source/interactionhandler.cxx
@@ -22,12 +22,14 @@
#include <osl/diagnose.h>
#include <com/sun/star/awt/XWindow.hpp>
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/task/XInteractionHandler2.hpp>
#include "iahndl.hxx"
#include <comphelper/namedvaluecollection.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/supportsservice.hxx>
@@ -139,7 +141,9 @@ UUIInteractionHandler::handle(
}
catch (uno::RuntimeException const & ex)
{
- throw uno::RuntimeException(ex.Message, *this);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ *this, anyEx );
}
}
@@ -152,7 +156,9 @@ sal_Bool SAL_CALL UUIInteractionHandler::handleInteractionRequest(
}
catch (uno::RuntimeException const & ex)
{
- throw uno::RuntimeException( ex.Message, *this );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ *this, anyEx );
}
}
diff --git a/uui/source/requeststringresolver.cxx b/uui/source/requeststringresolver.cxx
index 7fddd59a1270..98a4fdb23983 100644
--- a/uui/source/requeststringresolver.cxx
+++ b/uui/source/requeststringresolver.cxx
@@ -19,6 +19,8 @@
#include "requeststringresolver.hxx"
#include "iahndl.hxx"
+#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
using namespace css;
@@ -65,7 +67,9 @@ UUIInteractionRequestStringResolver::getStringFromInformationalRequest(
}
catch (uno::RuntimeException const & ex)
{
- throw uno::RuntimeException(ex.Message, *this);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ throw css::lang::WrappedTargetRuntimeException( ex.Message,
+ *this, anyEx );
}
}
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index 683f2fc81ffe..928d6d5a6632 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -31,6 +31,7 @@
#include "vbacontrols.hxx"
#include "vbacontrol.hxx"
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/implbase.hxx>
#include <ooo/vba/XControlProvider.hpp>
#include <unordered_map>
@@ -410,11 +411,12 @@ uno::Any SAL_CALL ScVbaControls::Add( const uno::Any& Object, const uno::Any& St
{
throw;
}
- catch (const uno::Exception& e)
+ catch (const uno::Exception&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException( "Can not create AXControl!",
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ anyEx );
}
return aResult;
diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx
index bb8cea08ac95..f12d95bc2968 100644
--- a/writerfilter/source/filter/RtfFilter.cxx
+++ b/writerfilter/source/filter/RtfFilter.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <osl/file.hxx>
#include <unotools/mediadescriptor.hxx>
@@ -148,11 +149,12 @@ sal_Bool RtfFilter::filter(const uno::Sequence< beans::PropertyValue >& rDescrip
sal_uInt32 nEndTime = osl_getGlobalTimer();
SAL_INFO("writerfilter.profile", "RtfFilter::filter: finished in " << nEndTime - nStartTime << " ms");
}
- catch (const io::WrongFormatException& e)
+ catch (const io::WrongFormatException&)
{
+ css::uno::Any anyEx = cppu::getCaughtException();
// cannot throw WrongFormatException directly :(
throw lang::WrappedTargetRuntimeException("",
- static_cast<OWeakObject*>(this), uno::makeAny(e));
+ static_cast<OWeakObject*>(this), anyEx);
}
catch (const uno::Exception& e)
{
diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx
index 2953c6cc3f17..a78518522ae0 100644
--- a/writerfilter/source/filter/WriterFilter.cxx
+++ b/writerfilter/source/filter/WriterFilter.cxx
@@ -204,11 +204,12 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDesc
{
throw;
}
- catch (uno::Exception const& e)
+ catch (uno::Exception const&)
{
- SAL_WARN("writerfilter", "WriterFilter::filter(): failed with " << e);
+ css::uno::Any anyEx = cppu::getCaughtException();
+ SAL_WARN("writerfilter", "WriterFilter::filter(): failed with " << anyEx);
throw lang::WrappedTargetRuntimeException("",
- static_cast<OWeakObject*>(this), uno::makeAny(e));
+ static_cast<OWeakObject*>(this), anyEx);
}
// Adding some properties to the document's grab bag for interoperability purposes:
diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
index 4848d1d59aad..dd0e82d9dbb3 100644
--- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
+++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx
@@ -39,6 +39,7 @@
#include <svx/dialmgr.hxx>
#include <svx/strings.hrc>
#include <comphelper/sequence.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <unotools/mediadescriptor.hxx>
#include <iostream>
@@ -515,11 +516,11 @@ void OOXMLDocumentImpl::resolve(Stream & rStream)
throw;
}
// note: cannot throw anything other than SAXException out of here?
- catch (uno::Exception const& e)
+ catch (uno::Exception const&)
{
- SAL_WARN("writerfilter.ooxml", "OOXMLDocumentImpl::resolve(): " << e);
- throw lang::WrappedTargetRuntimeException("", nullptr,
- uno::makeAny(e));
+ css::uno::Any anyEx = cppu::getCaughtException();
+ SAL_WARN("writerfilter.ooxml", "OOXMLDocumentImpl::resolve(): " << anyEx);
+ throw lang::WrappedTargetRuntimeException("", nullptr, anyEx);
}
catch (...)
{
diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx
index 10f60b7717dd..3e459c661f7c 100644
--- a/xmloff/source/meta/xmlmetai.cxx
+++ b/xmloff/source/meta/xmlmetai.cxx
@@ -24,6 +24,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <comphelper/processfactory.hxx>
+#include <cppuhelper/exc_hlp.hxx>
#include <rtl/character.hxx>
#include <xmloff/xmlmetai.hxx>
#include <xmloff/xmlimp.hxx>
@@ -124,11 +125,12 @@ lcl_initDocumentProperties(SvXMLImport & rImport,
xDocProps->getGenerator(), rImport.getImportInfo());
} catch (const uno::RuntimeException&) {
throw;
- } catch (const uno::Exception& e) {
+ } catch (const uno::Exception&) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"SvXMLMetaDocumentContext::initDocumentProperties: "
"properties init exception",
- rImport, makeAny(e));
+ rImport, anyEx);
}
}
@@ -151,10 +153,11 @@ lcl_initGenerator(SvXMLImport & rImport,
SvXMLMetaDocumentContext::setBuildId(value, rImport.getImportInfo());
} catch (const uno::RuntimeException&) {
throw;
- } catch (const uno::Exception& e) {
+ } catch (const uno::Exception&) {
+ css::uno::Any anyEx = cppu::getCaughtException();
throw lang::WrappedTargetRuntimeException(
"SvXMLMetaDocumentContext::initGenerator: exception",
- rImport, makeAny(e));
+ rImport, anyEx);
}
}
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
index d78e9a55579e..344591d566ae 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -29,6 +29,7 @@
#include <com/sun/star/document/XStorageBasedDocument.hpp>
#include <com/sun/star/xml/sax/SAXException.hpp>
+#include <cppuhelper/exc_hlp.hxx>
#include <sal/log.hxx>
#include <i18nlangtag/languagetag.hxx>
@@ -539,9 +540,10 @@ void FormattedFieldElement::endElement()
}
catch (const util::MalformedNumberFormatException & exc)
{
- SAL_WARN( "xmlscript.xmldlg", "### util::MalformedNumberFormatException occurred!" );
+ css::uno::Any anyEx = cppu::getCaughtException();
+ SAL_WARN( "xmlscript.xmldlg", exc );
// rethrow
- throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), Any() );
+ throw xml::sax::SAXException( exc.Message, Reference< XInterface >(), anyEx );
}
}
ctx.importBooleanProperty("TreatAsNumber", "treat-as-number" , _xAttributes );