summaryrefslogtreecommitdiff
path: root/extensions/source
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-05-23 12:03:21 +0200
committerNoel Grandin <noel@peralex.com>2014-05-23 15:06:00 +0200
commite7bc3cab019fbf040f9fb8b53ae2cf3f977d200b (patch)
treebc507bccee9fb71134e362b72d22991561e32aa0 /extensions/source
parentc5d47c327a57df55fa3dac0fff6b65888d0345e4 (diff)
remove boilerplate in UNO Exception constructor calls
Now that we have default values for Exception constructor params, remove lots of boilerplate code. Change-Id: I620bd641eecfed38e6123873b3b94aaf47922e74
Diffstat (limited to 'extensions/source')
-rw-r--r--extensions/source/ole/oleobjw.cxx112
-rw-r--r--extensions/source/resource/ResourceIndexAccess.cxx20
-rw-r--r--extensions/source/update/check/updateprotocol.cxx3
-rw-r--r--extensions/source/update/ui/updatecheckui.cxx3
4 files changed, 40 insertions, 98 deletions
diff --git a/extensions/source/ole/oleobjw.cxx b/extensions/source/ole/oleobjw.cxx
index 2b0c14792b01..fe87fedce028 100644
--- a/extensions/source/ole/oleobjw.cxx
+++ b/extensions/source/ole/oleobjw.cxx
@@ -177,7 +177,7 @@ Any SAL_CALL IUnknownWrapper_Impl::invokeGetProperty( const OUString& aPropertyN
{
OUString msg("[automation bridge]Property \"" + aPropertyName +
"\" is not supported");
- throw UnknownPropertyException(msg, Reference<XInterface>());
+ throw UnknownPropertyException(msg);
}
aResult = invokeWithDispIdComTlb( aDescGet, aPropertyName, aParams, aOutParamIndex, aOutParam );
}
@@ -185,7 +185,7 @@ Any SAL_CALL IUnknownWrapper_Impl::invokeGetProperty( const OUString& aPropertyN
{
throw RuntimeException("[automation bridge] unexpected exception in "
"IUnknownWrapper_Impl::invokeGetProperty ! Message : \n" +
- e.Message, Reference<XInterface>());
+ e.Message);
}
return aResult;
}
@@ -205,7 +205,7 @@ Any SAL_CALL IUnknownWrapper_Impl::invokePutProperty( const OUString& aPropertyN
{
OUString msg("[automation bridge]Property \"" + aPropertyName +
"\" is not supported");
- throw UnknownPropertyException(msg, Reference<XInterface>());
+ throw UnknownPropertyException(msg);
}
aResult = invokeWithDispIdComTlb( aDescPut, aPropertyName, aParams, aOutParamIndex, aOutParam );
}
@@ -213,7 +213,7 @@ Any SAL_CALL IUnknownWrapper_Impl::invokePutProperty( const OUString& aPropertyN
{
throw RuntimeException("[automation bridge] unexpected exception in "
"IUnknownWrapper_Impl::invokePutProperty ! Message : \n" +
- e.Message, Reference<XInterface>());
+ e.Message);
}
return aResult;
}
@@ -228,8 +228,7 @@ Any SAL_CALL IUnknownWrapper_Impl::invoke( const OUString& aFunctionName,
if ( ! m_spDispatch )
{
throw RuntimeException(
- "[automation bridge] The object does not have an IDispatch interface",
- Reference<XInterface>());
+ "[automation bridge] The object does not have an IDispatch interface");
}
Any ret;
@@ -265,19 +264,19 @@ Any SAL_CALL IUnknownWrapper_Impl::invoke( const OUString& aFunctionName,
}
catch (const BridgeRuntimeError & e)
{
- throw RuntimeException(e.message, Reference<XInterface>());
+ throw RuntimeException(e.message);
}
catch (const Exception & e)
{
throw RuntimeException("[automation bridge] unexpected exception in "
"IUnknownWrapper_Impl::invoke ! Message : \n" +
- e.Message, Reference<XInterface>());
+ e.Message);
}
catch(...)
{
throw RuntimeException("[automation bridge] unexpected exception in "
- "IUnknownWrapper_Impl::Invoke !", Reference<XInterface>());
+ "IUnknownWrapper_Impl::Invoke !");
}
return ret;
}
@@ -290,8 +289,7 @@ void SAL_CALL IUnknownWrapper_Impl::setValue( const OUString& aPropertyName,
if ( ! m_spDispatch )
{
throw RuntimeException(
- "[automation bridge] The object does not have an IDispatch interface",
- Reference<XInterface>());
+ "[automation bridge] The object does not have an IDispatch interface");
}
try
{
@@ -307,7 +305,7 @@ void SAL_CALL IUnknownWrapper_Impl::setValue( const OUString& aPropertyName,
{
OUString msg("[automation bridge]Property \"" + aPropertyName +
"\" is not supported");
- throw UnknownPropertyException(msg, Reference<XInterface>());
+ throw UnknownPropertyException(msg);
}
if ( (! aDescPut && aDescGet) || aVarDesc
@@ -438,21 +436,20 @@ void SAL_CALL IUnknownWrapper_Impl::setValue( const OUString& aPropertyName,
}
catch (const BridgeRuntimeError& e)
{
- throw RuntimeException(
- e.message, Reference<XInterface>());
+ throw RuntimeException(e.message);
}
catch (const Exception & e)
{
throw RuntimeException("[automation bridge] unexpected exception in "
"IUnknownWrapper_Impl::setValue ! Message : \n" +
- e.Message, Reference<XInterface>());
+ e.Message);
}
catch (...)
{
throw RuntimeException(
"[automation bridge] unexpected exception in "
- "IUnknownWrapper_Impl::setValue !", Reference<XInterface>());
+ "IUnknownWrapper_Impl::setValue !");
}
}
@@ -462,8 +459,7 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
if ( ! m_spDispatch )
{
throw RuntimeException(
- "[automation bridge] The object does not have an IDispatch interface",
- Reference<XInterface>());
+ "[automation bridge] The object does not have an IDispatch interface");
}
Any ret;
try
@@ -519,7 +515,7 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
//property not found
OUString msg("[automation bridge]Property \"" + aPropertyName +
"\" is not supported");
- throw UnknownPropertyException(msg, Reference<XInterface>());
+ throw UnknownPropertyException(msg);
}
// write-only should not be possible
OSL_ASSERT( aDescGet || ! aDescPut);
@@ -565,52 +561,15 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
case S_OK:
break;
case DISP_E_BADPARAMCOUNT:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
- break;
case DISP_E_BADVARTYPE:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
- break;
case DISP_E_EXCEPTION:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
+ throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)));
break;
case DISP_E_MEMBERNOTFOUND:
- throw UnknownPropertyException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
- break;
- case DISP_E_NONAMEDARGS:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
- break;
- case DISP_E_OVERFLOW:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
- break;
- case DISP_E_PARAMNOTFOUND:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
- break;
- case DISP_E_TYPEMISMATCH:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
- break;
- case DISP_E_UNKNOWNINTERFACE:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
- break;
- case DISP_E_UNKNOWNLCID:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
- break;
- case DISP_E_PARAMNOTOPTIONAL:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
+ throw UnknownPropertyException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)));
break;
default:
- throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)),
- Reference<XInterface>());
+ throw RuntimeException(OUString(reinterpret_cast<const sal_Unicode*>(excepinfo.bstrDescription)));
break;
}
}
@@ -620,20 +579,19 @@ Any SAL_CALL IUnknownWrapper_Impl::getValue( const OUString& aPropertyName )
}
catch (const BridgeRuntimeError& e)
{
- throw RuntimeException(
- e.message, Reference<XInterface>());
+ throw RuntimeException(e.message);
}
catch (const Exception & e)
{
throw RuntimeException("[automation bridge] unexpected exception in "
"IUnknownWrapper_Impl::getValue ! Message : \n" +
- e.Message, Reference<XInterface>());
+ e.Message);
}
catch (...)
{
throw RuntimeException(
"[automation bridge] unexpected exception in "
- "IUnknownWrapper_Impl::getValue !", Reference<XInterface>());
+ "IUnknownWrapper_Impl::getValue !");
}
return ret;
}
@@ -644,8 +602,7 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMethod( const OUString& aName )
if ( ! m_spDispatch )
{
throw RuntimeException(
- "[automation bridge] The object does not have an IDispatch interface",
- Reference<XInterface>());
+ "[automation bridge] The object does not have an IDispatch interface");
}
sal_Bool ret = sal_False;
@@ -672,18 +629,18 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMethod( const OUString& aName )
}
catch (const BridgeRuntimeError& e)
{
- throw RuntimeException(e.message, Reference<XInterface>());
+ throw RuntimeException(e.message);
}
catch (const Exception & e)
{
throw RuntimeException("[automation bridge] unexpected exception in "
"IUnknownWrapper_Impl::hasMethod ! Message : \n" +
- e.Message, Reference<XInterface>());
+ e.Message);
}
catch (...)
{
throw RuntimeException("[automation bridge] unexpected exception in "
- "IUnknownWrapper_Impl::hasMethod !", Reference<XInterface>());
+ "IUnknownWrapper_Impl::hasMethod !");
}
return ret;
}
@@ -694,7 +651,7 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasProperty( const OUString& aName )
if ( ! m_spDispatch )
{
throw RuntimeException("[automation bridge] The object does not have an "
- "IDispatch interface", Reference<XInterface>());
+ "IDispatch interface");
}
sal_Bool ret = sal_False;
try
@@ -722,19 +679,19 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasProperty( const OUString& aName )
}
catch (const BridgeRuntimeError& e)
{
- throw RuntimeException(e.message, Reference<XInterface>());
+ throw RuntimeException(e.message);
}
catch (const Exception & e)
{
throw RuntimeException("[automation bridge] unexpected exception in "
"IUnknownWrapper_Impl::hasProperty ! Message : \n" +
- e.Message, Reference<XInterface>());
+ e.Message);
}
catch (...)
{
throw RuntimeException("[automation bridge] unexpected exception in "
- "IUnknownWrapper_Impl::hasProperty !", Reference<XInterface>());
+ "IUnknownWrapper_Impl::hasProperty !");
}
return ret;
}
@@ -1298,13 +1255,12 @@ void SAL_CALL IUnknownWrapper_Impl::initialize( const Sequence< Any >& aArgument
}
catch ( const BridgeRuntimeError & e )
{
- throw RuntimeException( e.message, Reference<XInterface>() );
+ throw RuntimeException( e.message );
}
catch( const Exception& e )
{
throw RuntimeException(
- "[automation bridge] unexpected exception in IUnknownWrapper_Impl::initialiase() error message: \n" + e.Message,
- Reference<XInterface>() );
+ "[automation bridge] unexpected exception in IUnknownWrapper_Impl::initialiase() error message: \n" + e.Message );
}
}
}
@@ -1319,8 +1275,7 @@ uno::Any SAL_CALL IUnknownWrapper_Impl::directInvoke( const OUString& aName, con
if ( !m_spDispatch )
{
throw RuntimeException(
- "[automation bridge] The object does not have an IDispatch interface",
- Reference<XInterface>());
+ "[automation bridge] The object does not have an IDispatch interface");
}
o2u_attachCurrentThread();
@@ -1566,8 +1521,7 @@ sal_Bool SAL_CALL IUnknownWrapper_Impl::hasMember( const OUString& aName )
if ( ! m_spDispatch )
{
throw RuntimeException(
- "[automation bridge] The object does not have an IDispatch interface",
- Reference<XInterface>());
+ "[automation bridge] The object does not have an IDispatch interface");
}
o2u_attachCurrentThread();
diff --git a/extensions/source/resource/ResourceIndexAccess.cxx b/extensions/source/resource/ResourceIndexAccess.cxx
index 10bb0bc5fc1b..0d1a69d81b12 100644
--- a/extensions/source/resource/ResourceIndexAccess.cxx
+++ b/extensions/source/resource/ResourceIndexAccess.cxx
@@ -93,9 +93,7 @@ Reference<XInterface> initResourceIndexAccess(ResourceIndexAccess* pResourceInde
// xResult does not help the client to analyse the problem
// and will crash on getByIndex calls, better just give back an empty Reference
// so that such ResourceStringIndexAccess instances are never release into the wild
- throw RuntimeException(
- OUString("resource manager could not get initialized"),
- /* xResult */ Reference<XInterface>());
+ throw RuntimeException("resource manager could not get initialized");
return xResult;
}
@@ -145,17 +143,13 @@ Any SAL_CALL ResourceStringIndexAccess::getByIndex(sal_Int32 nIdx)
throw IndexOutOfBoundsException();
SolarMutexGuard aGuard;
if(!m_pResMgr.get())
- throw RuntimeException(
- OUString("resource manager not available"),
- Reference<XInterface>());
+ throw RuntimeException("resource manager not available");
const ResId aId(static_cast<sal_uInt16>(nIdx), *m_pResMgr);
aId.SetRT(RSC_STRING);
if(!m_pResMgr->IsAvailable(aId))
- throw RuntimeException(
- OUString("string resource for id not available"),
- Reference<XInterface>());
+ throw RuntimeException("string resource for id not available");
return makeAny(aId.toString());
}
@@ -168,16 +162,12 @@ Any SAL_CALL ResourceStringListIndexAccess::getByIndex(sal_Int32 nIdx)
SolarMutexGuard aGuard;
if(!m_pResMgr.get())
- throw RuntimeException(
- OUString("resource manager not available"),
- Reference<XInterface>());
+ throw RuntimeException("resource manager not available");
const ResId aId(static_cast<sal_uInt16>(nIdx), *m_pResMgr);
aId.SetRT(RSC_STRINGARRAY);
if(!m_pResMgr->IsAvailable(aId))
- throw RuntimeException(
- OUString("string list resource for id not available"),
- Reference<XInterface>());
+ throw RuntimeException("string list resource for id not available");
const ResStringArray aStringList(aId);
Sequence<PropertyValue> aPropList(aStringList.Count());
for(sal_Int32 nCount = 0; nCount != aPropList.getLength(); ++nCount)
diff --git a/extensions/source/update/check/updateprotocol.cxx b/extensions/source/update/check/updateprotocol.cxx
index ddf58590675c..6287c9c19e3f 100644
--- a/extensions/source/update/check/updateprotocol.cxx
+++ b/extensions/source/update/check/updateprotocol.cxx
@@ -117,8 +117,7 @@ checkForUpdates(
const OUString &rInstallSetID )
{
if( !rxContext.is() )
- throw uno::RuntimeException(
- "checkForUpdates: empty component context", uno::Reference< uno::XInterface >() );
+ throw uno::RuntimeException( "checkForUpdates: empty component context" );
OSL_ASSERT( rxContext->getServiceManager().is() );
diff --git a/extensions/source/update/ui/updatecheckui.cxx b/extensions/source/update/ui/updatecheckui.cxx
index ef8a814a3e2f..1f2b1c7f8885 100644
--- a/extensions/source/update/ui/updatecheckui.cxx
+++ b/extensions/source/update/ui/updatecheckui.cxx
@@ -283,8 +283,7 @@ Image UpdateCheckUI::GetBubbleImage( OUString &rURL )
if( !xContext.is() )
throw uno::RuntimeException(
- "UpdateCheckUI: unable to obtain service manager from component context",
- uno::Reference< uno::XInterface >() );
+ "UpdateCheckUI: unable to obtain service manager from component context" );
try
{