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>
This commit is contained in:
Noel Grandin 2018-05-24 15:47:30 +02:00
parent ff3bdde252
commit 3a51daeace
102 changed files with 793 additions and 413 deletions

View file

@ -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 );
}
}

View file

@ -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);
}
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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);
}
}
}

View file

@ -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)

View file

@ -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 );

View file

@ -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;

View file

@ -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;

View file

@ -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 );
}
}
}

View file

@ -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!" );

View file

@ -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& )
{

View file

@ -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 );
}
}

View file

@ -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 ) );
}

View file

@ -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 ) );

View file

@ -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 ) );

View file

@ -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 ) );

View file

@ -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 ) );

View file

@ -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 ) );

View file

@ -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 ) );

View file

@ -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 ) );
}

View file

@ -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);
}

View file

@ -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

View file

@ -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 );
}
}
}

View file

@ -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;
}

View file

@ -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() )

View file

@ -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 );
}
}

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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 );

View file

@ -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);

View file

@ -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

View file

@ -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 )

View file

@ -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));

View file

@ -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 );
}

View file

@ -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);
}

View file

@ -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 );
}
}

View file

@ -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 {

View file

@ -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;

View file

@ -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;

View file

@ -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 );
}
}
}

View file

@ -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:

View file

@ -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 );
}
}

View file

@ -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 )

View file

@ -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.

View file

@ -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 );
}
}

View file

@ -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);
}
}

View file

@ -19,6 +19,7 @@ $(eval $(call gb_Library_use_api,jvmaccess,\
$(eval $(call gb_Library_use_libraries,jvmaccess,\
cppu \
cppuhelper \
sal \
salhelper \
))

View file

@ -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;

View file

@ -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 );
}
}

View file

@ -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 );
}
}

View file

@ -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 );
}
}

View file

@ -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 );
}
}
}

View file

@ -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() )

View file

@ -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 );
}
}

View file

@ -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);
}
}

View file

@ -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
);
}
}
}

View file

@ -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 );
}
}

View file

@ -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;

View file

@ -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 );
}
}
}

View file

@ -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

View file

@ -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;
}

View file

@ -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 );
}
}

View file

@ -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 );
}
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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 );
}
}
}

View file

@ -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(

View file

@ -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);
}

View file

@ -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;

View file

@ -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;

View file

@ -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 );

View file

@ -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 );
}
}
}

View file

@ -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 );
}
}
}

View file

@ -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

View file

@ -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 );
}
}

View file

@ -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);

View file

@ -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 );
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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;
}

View file

@ -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;

View file

@ -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;

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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 );
}
}

View file

@ -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 );

View file

@ -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();
}

View file

@ -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 );

View file

@ -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

View file

@ -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),

View file

@ -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 );
}
}

View file

@ -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 );
}
}

View file

@ -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;

View file

@ -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)
{

View file

@ -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:

View file

@ -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 (...)
{

Some files were not shown because too many files have changed in this diff Show more