catch exception by constant reference

This commit is contained in:
Takeshi Abe
2011-12-25 15:08:11 +09:00
parent 8b18c70b99
commit 8cc98837d3
33 changed files with 134 additions and 214 deletions

View File

@@ -299,7 +299,7 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification(
{
xListener->dispatchFinished( aEvent ) ;
}
catch(RuntimeException & e)
catch(const RuntimeException & e)
{
OSL_TRACE(
"ScriptProtocolHandler::dispatchWithNotification: caught RuntimeException"
@@ -413,12 +413,12 @@ void ScriptProtocolHandler::createScriptProvider()
xFac->createScriptProvider( aContext ), UNO_QUERY_THROW );
}
}
catch ( RuntimeException & e )
catch ( const RuntimeException & e )
{
::rtl::OUString temp = OUSTR( "ScriptProtocolHandler::createScriptProvider(), " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
}
catch ( Exception & e )
catch ( const Exception & e )
{
::rtl::OUString temp = OUSTR( "ScriptProtocolHandler::createScriptProvider: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );

View File

@@ -327,7 +327,7 @@ Sequence< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference<
locnBNs[ mspIndex++ ] = Reference< browse::XBrowseNode >( xFac->createScriptProvider( makeAny( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("share")) ) ), UNO_QUERY_THROW );
}
// TODO proper exception handling, should throw
catch( Exception& e )
catch( const Exception& e )
{
(void)e;
OSL_TRACE("Caught Exception %s",

View File

@@ -243,7 +243,7 @@ void MasterScriptProvider::createPkgProvider()
xFac->createScriptProvider( location ), UNO_QUERY_THROW );
}
catch ( Exception& e )
catch ( const Exception& e )
{
(void)e;
OSL_TRACE("Exception creating MasterScriptProvider for uno_packages in context %s: %s",

View File

@@ -122,13 +122,9 @@ ProviderCache::getAllProviders() throw ( RuntimeException )
xScriptProvider = createProvider( h_it->second );
providers[ providerIndex++ ] = xScriptProvider;
}
catch ( Exception& e )
catch ( const Exception& )
{
::rtl::OUString temp = OUSTR( "ProviderCache::getAllProviders: failed to create provider, " );
temp.concat( e.Message );
DBG_UNHANDLED_EXCEPTION();
//throw RuntimeException( temp.concat( e.Message ),
// Reference< XInterface >() );
}
}
}
@@ -187,7 +183,7 @@ ProviderCache::populateCache() throw ( RuntimeException )
}
}
}
catch ( Exception &e )
catch ( const Exception &e )
{
::rtl::OUString temp = OUSTR(
"ProviderCache::populateCache: couldn't obtain XSingleComponentFactory for " );
@@ -204,7 +200,7 @@ ProviderCache::createProvider( ProviderDetails& details ) throw ( RuntimeExcepti
details.provider.set(
details.factory->createInstanceWithArgumentsAndContext( m_Sctx, m_xContext ), UNO_QUERY_THROW );
}
catch ( RuntimeException& e )
catch ( const RuntimeException& e )
{
::rtl::OUString temp(RTL_CONSTASCII_USTRINGPARAM("ProviderCache::createProvider() Error creating provider from factory!!!\n"));
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );

View File

@@ -75,14 +75,14 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException,
result = m_RunTimeManager->invoke( m_ScriptURI, anyScriptingContext, aParams,
aOutParamIndex, aOutParam );
}
catch ( lang::IllegalArgumentException & iae )
catch ( const lang::IllegalArgumentException & iae )
{
::rtl::OUString temp = OUSTR( "ScriptImpl::invoke IllegalArgumentException : " );
throw lang::IllegalArgumentException( temp.concat( iae.Message ),
Reference< XInterface > (),
iae.ArgumentPosition );
}
catch ( script::CannotConvertException & cce )
catch ( const script::CannotConvertException & cce )
{
::rtl::OUString temp = OUSTR( "ScriptImpl::invoke CannotConvertException : " );
throw script::CannotConvertException( temp.concat( cce.Message ),
@@ -91,14 +91,14 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException,
cce.Reason,
cce.ArgumentIndex );
}
catch ( reflection::InvocationTargetException & ite )
catch ( const reflection::InvocationTargetException & ite )
{
::rtl::OUString temp = OUSTR( "ScriptImpl::invoke InvocationTargetException : " );
throw reflection::InvocationTargetException( temp.concat( ite.Message ),
Reference< XInterface > (),
ite.TargetException );
}
catch ( RuntimeException & re )
catch ( const RuntimeException & re )
{
::rtl::OUString temp = OUSTR( "ScriptImpl::invoke RuntimeException : " );
throw RuntimeException( temp.concat( re.Message ),

View File

@@ -144,7 +144,7 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException, RuntimeE
Reference< XInterface > () );
}
}
catch ( Exception & e )
catch ( const Exception & e )
{
OUString temp = OUSTR(
"ScriptNameResolverImpl::resolve : problem with getPropertyValue" );
@@ -212,7 +212,7 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException, RuntimeE
{
filesysURL = getFilesysURL( scriptURI );
}
catch ( lang::IllegalArgumentException & e )
catch ( const lang::IllegalArgumentException & e )
{
OUString temp = OUSTR( "ScriptNameResolverImpl::resolve: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
@@ -245,7 +245,7 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException, RuntimeE
filesysScriptStorageID, ::rtl::OUStringToOString(
filesysURL, RTL_TEXTENCODING_ASCII_US ).pData->buffer );
}
catch ( RuntimeException & e )
catch ( const RuntimeException & e )
{
OUString temp = OUSTR( "ScriptNameResolverImpl::resolve: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
@@ -292,41 +292,41 @@ throw ( lang::IllegalArgumentException, script::CannotConvertException, RuntimeE
}
}
catch ( css::security::AccessControlException & e )
catch ( css::security::AccessControlException & )
{
// no execute permission
OSL_TRACE( "ScriptNameResolverImpl::resolve : AccessControlException " );
continue;
}
catch ( beans::UnknownPropertyException & e )
catch ( const beans::UnknownPropertyException & e )
{
OUString temp = OUSTR(
"ScriptNameResolverImpl::resolve : UnknownPropertyException" );
throw RuntimeException( temp.concat( e.Message ),
Reference< XInterface > () );
}
catch ( beans::PropertyVetoException & e )
catch ( const beans::PropertyVetoException & e )
{
OUString temp = OUSTR(
"ScriptNameResolverImpl::resolve : PropertyVetoException " );
throw RuntimeException( temp.concat( e.Message ),
Reference< XInterface > () );
}
catch ( lang::IllegalArgumentException & e )
catch ( const lang::IllegalArgumentException & e )
{
OUString temp = OUSTR(
"ScriptNameResolverImpl::resolve : IllegalArgumentException " );
throw lang::IllegalArgumentException( temp.concat( e.Message ),
Reference< XInterface > (), e.ArgumentPosition );
}
catch ( lang::WrappedTargetException & e )
catch ( const lang::WrappedTargetException & e )
{
OUString temp = OUSTR(
"ScriptNameResolverImpl::resolve : WrappedTargetException " );
throw RuntimeException( temp.concat( e.Message ),
Reference< XInterface > () );
}
catch ( Exception & e )
catch ( const Exception & e )
{
OSL_TRACE(
"Exception thrown by storage %d, failed to match uri: %s",
@@ -426,7 +426,7 @@ SAL_THROW ( ( lang::IllegalArgumentException, css::security::AccessControlExcept
{
permissionURI = getFilesysURL( scriptURI );
}
catch ( lang::IllegalArgumentException & e )
catch ( const lang::IllegalArgumentException & e )
{
OUString temp = OUSTR( "ScriptNameResolverImpl::resolveFromURI: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
@@ -449,7 +449,7 @@ SAL_THROW ( ( lang::IllegalArgumentException, css::security::AccessControlExcept
// that information was in the uri
resolvedScriptInfo = results[ 0 ];
}
catch ( css::security::AccessControlException & ace )
catch ( const css::security::AccessControlException & ace )
{
OUString temp = OUSTR(
"ScriptRuntimeManager::resolveURIFromStorageID AccessControlException: " );
@@ -457,7 +457,7 @@ SAL_THROW ( ( lang::IllegalArgumentException, css::security::AccessControlExcept
Reference< XInterface > (),
ace.LackingPermission );
}
catch ( lang::IllegalArgumentException & iae )
catch ( const lang::IllegalArgumentException & iae )
{
OUString temp = OUSTR(
"ScriptRuntimeManager::resolveURIFromStorageID IllegalArgumentException: " );
@@ -465,14 +465,14 @@ SAL_THROW ( ( lang::IllegalArgumentException, css::security::AccessControlExcept
Reference< XInterface > (),
iae.ArgumentPosition );
}
catch ( RuntimeException & re )
catch ( const RuntimeException & re )
{
OUString temp = OUSTR(
"ScriptRuntimeManager::resolveURIFromStorageID RuntimeException: " );
throw RuntimeException( temp.concat( re.Message ),
Reference< XInterface > () );
}
catch ( Exception & e )
catch ( const Exception & e )
{
OUString temp = OUSTR(
"ScriptNameResolverImpl::resolveURIFromStorageID : Exception caught - RuntimeException rethrown" );
@@ -520,23 +520,23 @@ const ::rtl::OUString & permissionURI ) SAL_THROW ( ( RuntimeException, css::sec
Reference< XInterface > xScriptStorage( ScriptStorageManager->getScriptStorage( sid ), UNO_SET_THROW );
xScriptInfoAccess.set( xScriptStorage, UNO_QUERY_THROW );
}
catch ( lang::IllegalArgumentException & e )
catch ( const lang::IllegalArgumentException & e )
{
OUString temp = OUSTR( "ScriptNameResolverImpl::getStorageInstance: " );
throw lang::IllegalArgumentException( temp.concat( e.Message ),
Reference< XInterface >(), e.ArgumentPosition );
}
catch ( css::security::AccessControlException & e )
catch ( const css::security::AccessControlException & e )
{
OUString temp = OUSTR( "ScriptNameResolverImpl::getStorageInstance: AccessControlException " );
throw css::security::AccessControlException( temp.concat( e.Message ), Reference< XInterface >(), e.LackingPermission );
}
catch ( RuntimeException & re )
catch ( const RuntimeException & re )
{
OUString temp = OUSTR( "ScriptNameResolverImpl::getStorageInstance: " );
throw RuntimeException( temp.concat( re.Message ), Reference< XInterface >() );
}
catch ( Exception & e )
catch ( const Exception & e )
{
OUString temp = OUSTR( "ScriptNameResolverImpl::getStorageInstance: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );

View File

@@ -107,7 +107,7 @@ throw( RuntimeException )
xInterface.set( m_xContext->getValueByName( buf.makeStringAndClear() ), UNO_QUERY_THROW );
xScriptInvocation.set( xInterface, UNO_QUERY_THROW );
}
catch ( Exception & e )
catch ( const Exception & e )
{
OUString temp = OUSTR( "ScriptRuntimeManager::GetScriptRuntime: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
@@ -137,7 +137,7 @@ throw( RuntimeException )
);
xScriptNameResolver.set( xInterface, UNO_QUERY_THROW );
}
catch ( Exception & e )
catch ( const Exception & e )
{
OUString temp = OUSTR( "ScriptRuntimeManager::GetScriptNameResolver: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
@@ -222,14 +222,14 @@ Any SAL_CALL ScriptRuntimeManager::invoke(
xEL_ScriptStorageManager->disposing( event );
}
}
catch ( lang::IllegalArgumentException & iae )
catch ( const lang::IllegalArgumentException & iae )
{
OUString temp = OUSTR( "ScriptRuntimeManager::invoke IllegalArgumentException: " );
throw lang::IllegalArgumentException( temp.concat( iae.Message ),
Reference< XInterface > (),
iae.ArgumentPosition );
}
catch ( script::CannotConvertException & cce )
catch ( const script::CannotConvertException & cce )
{
OUString temp = OUSTR( "ScriptRuntimeManager::invoke CannotConvertException: " );
throw script::CannotConvertException( temp.concat( cce.Message ),
@@ -237,31 +237,31 @@ Any SAL_CALL ScriptRuntimeManager::invoke(
cce.DestinationTypeClass, cce.Reason,
cce.ArgumentIndex );
}
catch ( reflection::InvocationTargetException & ite )
catch ( const reflection::InvocationTargetException & ite )
{
OUString temp = OUSTR( "ScriptRuntimeManager::invoke InvocationTargetException: " );
throw reflection::InvocationTargetException( temp.concat( ite.Message ),
Reference< XInterface > (), ite.TargetException );
}
catch ( beans::UnknownPropertyException & e )
catch ( const beans::UnknownPropertyException & e )
{
OUString temp = OUSTR( "ScriptRuntimeManager::invoke UnknownPropertyException: " );
throw RuntimeException( temp.concat( e.Message ),
Reference< XInterface > () );
}
catch ( lang::WrappedTargetException & e )
catch ( const lang::WrappedTargetException & e )
{
OUString temp = OUSTR( "ScriptRuntimeManager::invoke WrappedTargetException : " );
throw RuntimeException( temp.concat( e.Message ),
Reference< XInterface > () );
}
catch ( RuntimeException & re )
catch ( const RuntimeException & re )
{
OUString temp = OUSTR( "ScriptRuntimeManager::invoke RuntimeException: " );
throw RuntimeException( temp.concat( re.Message ),
Reference< XInterface > () );
}
catch ( Exception & e )
catch ( const Exception & e )
{
OUString temp = OUSTR( "ScriptRuntimeManager::invoke Exception: " );
throw RuntimeException( temp.concat( e.Message ),
@@ -296,7 +296,7 @@ throw( lang::IllegalArgumentException, script::CannotConvertException, RuntimeEx
{
resolvedURI = xScriptNameResolver->resolve( scriptURI, invocationCtx );
}
catch ( lang::IllegalArgumentException & iae )
catch ( const lang::IllegalArgumentException & iae )
{
OUString temp =
OUSTR( "ScriptRuntimeManager::resolve IllegalArgumentException: " );
@@ -304,7 +304,7 @@ throw( lang::IllegalArgumentException, script::CannotConvertException, RuntimeEx
Reference< XInterface > (),
iae.ArgumentPosition );
}
catch ( script::CannotConvertException & cce )
catch ( const script::CannotConvertException & cce )
{
OUString temp = OUSTR( "ScriptRuntimeManager::resolve CannotConvertException: " );
throw script::CannotConvertException( temp.concat( cce.Message ),
@@ -312,7 +312,7 @@ throw( lang::IllegalArgumentException, script::CannotConvertException, RuntimeEx
cce.DestinationTypeClass, cce.Reason,
cce.ArgumentIndex );
}
catch ( RuntimeException & re )
catch ( const RuntimeException & re )
{
OUString temp = OUSTR( "ScriptRuntimeManager::resolve RuntimeException: " );
throw RuntimeException( temp.concat( re.Message ),

View File

@@ -59,7 +59,7 @@ StorageBridge::StorageBridge( const Reference< XComponentContext >& xContext,
{
initStorage();
}
catch ( RuntimeException & re )
catch ( const RuntimeException & re )
{
OUString temp = OUSTR( "StorageBridge::StorageBridge(salIn32&): " );
throw RuntimeException( temp.concat( re.Message ), Reference< XInterface >() );
@@ -79,12 +79,12 @@ StorageBridge::initStorage() throw ( ::com::sun::star::uno::RuntimeException )
Reference< XInterface > xScriptStorage( xScriptStorageManager->getScriptStorage( m_sid ), UNO_SET_THROW );
m_xScriptInfoAccess.set( xScriptStorage, UNO_QUERY_THROW );
}
catch ( RuntimeException & re )
catch ( const RuntimeException & re )
{
OUString temp = OUSTR( "StorageBridge::StorageBridge: " );
throw RuntimeException( temp.concat( re.Message ), Reference< XInterface >() );
}
catch ( Exception & e )
catch ( const Exception & e )
{
OUString temp = OUSTR( "StorageBridge::StorageBridge: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
@@ -102,7 +102,7 @@ throw ( lang::IllegalArgumentException,
{
results = m_xScriptInfoAccess->getScriptLogicalNames();
}
catch ( Exception &e )
catch ( const Exception &e )
{
OUString temp = OUSTR( "StorageBridge::getScriptLogicalNames: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );
@@ -121,7 +121,7 @@ throw ( lang::IllegalArgumentException, RuntimeException )
{
results = m_xScriptInfoAccess->getImplementations( queryURI );
}
catch ( Exception &e )
catch ( const Exception &e )
{
OUString temp = OUSTR( "StorageBridge::getImplementations: " );
throw RuntimeException( temp.concat( e.Message ), Reference< XInterface >() );