summaryrefslogtreecommitdiff
path: root/testtools
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 /testtools
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 'testtools')
-rw-r--r--testtools/source/bridgetest/bridgetest.cxx29
-rw-r--r--testtools/source/performance/ubtest.cxx22
2 files changed, 19 insertions, 32 deletions
diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx
index c0be052df2e0..25f4aac65442 100644
--- a/testtools/source/bridgetest/bridgetest.cxx
+++ b/testtools/source/bridgetest/bridgetest.cxx
@@ -1112,9 +1112,7 @@ inline bool makeSurrogate(
Mapping uno2cpp( aUnoEnv_ano.get(), aCppEnv_ano.get() );
if (!cpp2uno.is() || !uno2cpp.is())
{
- throw RuntimeException(
- "cannot get C++-UNO mappings!",
- Reference< XInterface >() );
+ throw RuntimeException("cannot get C++-UNO mappings!" );
}
cpp2uno.mapInterface(
reinterpret_cast< void ** >( &unoI.m_pUnoI ),
@@ -1122,8 +1120,7 @@ inline bool makeSurrogate(
if (! unoI.is())
{
throw RuntimeException(
- "mapping C++ to binary UNO failed!",
- Reference< XInterface >() );
+ "mapping C++ to binary UNO failed!" );
}
uno2cpp.mapInterface(
reinterpret_cast< void ** >( &rOut ),
@@ -1131,8 +1128,7 @@ inline bool makeSurrogate(
if (! rOut.is())
{
throw RuntimeException(
- "mapping binary UNO to C++ failed!",
- Reference< XInterface >() );
+ "mapping binary UNO to C++ failed!" );
}
return rOut.is();
@@ -1147,10 +1143,8 @@ sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs )
{
if (! rArgs.getLength())
{
- throw RuntimeException( OUString(
- "no test object specified!\n"
- "usage : ServiceName of test object | -u unourl of test object\n" ),
- Reference< XInterface >() );
+ throw RuntimeException( "no test object specified!\n"
+ "usage : ServiceName of test object | -u unourl of test object" );
}
Reference< XInterface > xOriginal;
@@ -1195,17 +1189,12 @@ sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs )
if (! xOriginal.is())
{
- throw RuntimeException(
- OUString(
- "cannot get test object!"),
- Reference< XInterface >() );
+ throw RuntimeException( "cannot get test object!" );
}
Reference< XBridgeTest > xTest( xOriginal, UNO_QUERY );
if (! xTest.is())
{
- throw RuntimeException(
- OUString("test object does not implement XBridgeTest!"),
- Reference< XInterface >() );
+ throw RuntimeException( "test object does not implement XBridgeTest!" );
}
Reference<XBridgeTest > xLBT;
@@ -1218,9 +1207,7 @@ sal_Int32 TestBridgeImpl::run( const Sequence< OUString > & rArgs )
"oneway exception test" ) && bRet;
if (! bRet)
{
- throw RuntimeException(
- OUString("error: test failed!"),
- Reference< XInterface >() );
+ throw RuntimeException( "error: test failed!" );
}
}
catch (const Exception & exc)
diff --git a/testtools/source/performance/ubtest.cxx b/testtools/source/performance/ubtest.cxx
index a1a641b89e6b..688a84102210 100644
--- a/testtools/source/performance/ubtest.cxx
+++ b/testtools/source/performance/ubtest.cxx
@@ -375,7 +375,7 @@ static void createInstance( Reference< T > & rxOut,
buf.append( "cannot get service instance \"" );
buf.append( rServiceName );
buf.append( "\"!" );
- throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+ throw RuntimeException( buf.makeStringAndClear() );
}
rxOut = Reference< T >::query( x );
@@ -388,7 +388,7 @@ static void createInstance( Reference< T > & rxOut,
const Type & rType = ::getCppuType( (const Reference< T > *)0 );
buf.append( rType.getTypeName() );
buf.append( "\"!" );
- throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+ throw RuntimeException( buf.makeStringAndClear() );
}
}
@@ -473,7 +473,7 @@ Reference< XInterface > TestImpl::getDirect()
OUString("com.sun.star.comp.performance.PerformanceTestObject"),
_xSMgr, Reference< XRegistryKey >() ) );
if (! xFac.is())
- throw RuntimeException("no test object available!", Reference< XInterface >() );
+ throw RuntimeException("no test object available!" );
_xDirect = xFac->createInstance();
}
}
@@ -496,7 +496,7 @@ Reference< XInterface > TestImpl::resolveObject( const OUString & rUnoUrl )
buf.append( "cannot resolve object \"" );
buf.append( rUnoUrl );
buf.append( "\"!" );
- throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+ throw RuntimeException( buf.makeStringAndClear() );
}
return xResolvedObject;
@@ -560,7 +560,7 @@ static void benchmark(
{
Reference< XPerformanceTest > xBench( xInstance, UNO_QUERY );
if (! xBench.is())
- throw RuntimeException("illegal test object!", Reference< XInterface >() );
+ throw RuntimeException("illegal test object!" );
sal_Int64 i;
sal_uInt32 tStart, tEnd;
@@ -997,7 +997,7 @@ sal_Int32 TestImpl::run( const Sequence< OUString > & rArgs )
buf.append( "cannot open file for writing: \"" );
buf.append( aLogStr );
buf.append( "\"!" );
- throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+ throw RuntimeException( buf.makeStringAndClear() );
}
}
}
@@ -1054,14 +1054,14 @@ sal_Int32 TestImpl::run( const Sequence< OUString > & rArgs )
// pseudo mapping uno<->uno: does nothing!
Mapping aMapping( aCppEnv.get(), aAnoCppEnv.get(), OUString("pseudo") );
if (! aMapping.is())
- throw RuntimeException("no pseudo mapping available!", Reference< XInterface >() );
+ throw RuntimeException("no pseudo mapping available!" );
Reference< XInterface > xMapped;
Reference< XInterface > xDirect( getDirect() );
aMapping.mapInterface( reinterpret_cast< void ** >( &xMapped ), xDirect.get(),
::getCppuType( &xDirect ) );
if (! xMapped.is())
- throw RuntimeException("mapping object failed!", Reference< XInterface >() );
+ throw RuntimeException("mapping object failed!" );
sal_uInt32 nStart = getSystemTicks();
benchmark( aSheets[ "mapped in process" ], xMapped, nLoop / 100 );
@@ -1076,7 +1076,7 @@ sal_Int32 TestImpl::run( const Sequence< OUString > & rArgs )
// start server process
oslSecurity hSecurity = osl_getCurrentSecurity();
if (! hSecurity)
- throw RuntimeException("cannot get current security handle!", Reference< XInterface >() );
+ throw RuntimeException("cannot get current security handle!" );
OUString aArgs[] = {
OUString("-c"),
@@ -1123,7 +1123,7 @@ sal_Int32 TestImpl::run( const Sequence< OUString > & rArgs )
osl_freeSecurityHandle( hSecurity );
if (! hProcess)
- throw RuntimeException("cannot start server process!", Reference< XInterface >() );
+ throw RuntimeException("cannot start server process!" );
osl_freeProcessHandle( hProcess );
// wait three seconds
@@ -1144,7 +1144,7 @@ sal_Int32 TestImpl::run( const Sequence< OUString > & rArgs )
// remote
OUString aUnoUrl( extractParam( rArgs, OUString("url") ) );
if (! aUnoUrl.getLength())
- throw RuntimeException( OUString( "performance test r(emote) needs additional uno url!" ), Reference< XInterface >() );
+ throw RuntimeException( "performance test r(emote) needs additional uno url!" );
// connect and resolve outer process object
Reference< XInterface > xResolvedObject( resolveObject( aUnoUrl ) );