summaryrefslogtreecommitdiff
path: root/stoc
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 /stoc
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 'stoc')
-rw-r--r--stoc/source/corereflection/crefl.cxx2
-rw-r--r--stoc/source/defaultregistry/defaultregistry.cxx9
-rw-r--r--stoc/source/implementationregistration/implreg.cxx29
-rw-r--r--stoc/source/implementationregistration/mergekeys.cxx13
-rw-r--r--stoc/source/invocation/invocation.cxx15
-rw-r--r--stoc/source/invocation_adapterfactory/iafactory.cxx15
-rw-r--r--stoc/source/javaloader/javaloader.cxx62
-rw-r--r--stoc/source/javavm/javavm.cxx2
-rw-r--r--stoc/source/security/file_policy.cxx4
-rw-r--r--stoc/source/security/permissions.cxx6
-rw-r--r--stoc/source/servicemanager/servicemanager.cxx12
11 files changed, 61 insertions, 108 deletions
diff --git a/stoc/source/corereflection/crefl.cxx b/stoc/source/corereflection/crefl.cxx
index b1a35d5985d5..dcf74a4a3f8b 100644
--- a/stoc/source/corereflection/crefl.cxx
+++ b/stoc/source/corereflection/crefl.cxx
@@ -300,7 +300,7 @@ Any IdlReflectionServiceImpl::getByHierarchicalName( const OUString & rName )
_aElements.setValue( rName, aRet );
else
{
- throw container::NoSuchElementException( rName, Reference< XInterface >() );
+ throw container::NoSuchElementException( rName );
}
}
return aRet;
diff --git a/stoc/source/defaultregistry/defaultregistry.cxx b/stoc/source/defaultregistry/defaultregistry.cxx
index c67cc621971f..37ff4a47b8b4 100644
--- a/stoc/source/defaultregistry/defaultregistry.cxx
+++ b/stoc/source/defaultregistry/defaultregistry.cxx
@@ -1158,8 +1158,7 @@ Any RegistryEnumueration::nextElement( )
}
else
{
- throw NoSuchElementException( OUString(
- "NestedRegistry: no nextElement() !" ),Reference< XInterface > () );
+ throw NoSuchElementException( "NestedRegistry: no nextElement() !" );
}
return a;
}
@@ -1242,8 +1241,7 @@ void SAL_CALL NestedRegistryImpl::open( const OUString&, sal_Bool, sal_Bool )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
throw InvalidRegistryException(
- OUString("the 'open' method is not specified for a nested registry"),
- Reference< XInterface >() );
+ "the 'open' method is not specified for a nested registry" );
}
@@ -1283,8 +1281,7 @@ void SAL_CALL NestedRegistryImpl::destroy( )
throw(InvalidRegistryException, RuntimeException, std::exception)
{
throw InvalidRegistryException(
- OUString("the 'destroy' method is not specified for a nested registry"),
- Reference< XInterface >() );
+ "the 'destroy' method is not specified for a nested registry" );
}
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index 1aa67f63a172..d0627d2cda3a 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -949,9 +949,7 @@ static void insert_singletons(
xContext->getValueByName( the_tdmgr ) >>= xTDMgr;
if (! xTDMgr.is())
{
- throw RuntimeException(
- "cannot get singleton " + the_tdmgr,
- Reference< XInterface >() );
+ throw RuntimeException( "cannot get singleton " + the_tdmgr );
}
try
{
@@ -959,9 +957,7 @@ static void insert_singletons(
xTDMgr->getByHierarchicalName( existing_name ) >>= xExistingService_td;
if (! xExistingService_td.is())
{
- throw RuntimeException(
- "cannot get service type description: " + existing_name,
- Reference< XInterface >() );
+ throw RuntimeException( "cannot get service type description: " + existing_name );
}
// everything's fine if existing service entry supports the one
@@ -976,14 +972,13 @@ static void insert_singletons(
buf.append( ") does not support given one: " );
buf.append( service_name );
throw registry::CannotRegisterImplementationException(
- buf.makeStringAndClear(), Reference< XInterface >() );
+ buf.makeStringAndClear() );
}
}
catch (const container::NoSuchElementException & exc)
{
throw RuntimeException(
- "cannot get service type description: " + exc.Message,
- Reference< XInterface >() );
+ "cannot get service type description: " + exc.Message );
}
}
}
@@ -1052,8 +1047,7 @@ static void prepareRegistry(
if (!subKeys.getLength())
{
throw InvalidRegistryException(
- OUString( "prepareRegistry(): source registry is empty" ),
- Reference< XInterface > () );
+ "prepareRegistry(): source registry is empty" );
}
const StringPool & pool = spool();
@@ -1497,7 +1491,7 @@ void ImplementationRegistration::prepareRegister(
buf.append( activatorName );
buf.appendAscii( " cannot be instantiated\n" );
throw CannotRegisterImplementationException(
- buf.makeStringAndClear(), Reference< XInterface > () );
+ buf.makeStringAndClear() );
}
}
catch( CannotRegisterImplementationException & )
@@ -1512,7 +1506,7 @@ void ImplementationRegistration::prepareRegister(
buf.append( e.Message );
buf.append( ")" );
throw CannotRegisterImplementationException(
- buf.makeStringAndClear(), Reference< XInterface > () );
+ buf.makeStringAndClear() );
}
catch( const MergeConflictException & e )
{
@@ -1522,16 +1516,14 @@ void ImplementationRegistration::prepareRegister(
buf.append( e.Message );
buf.append( ")" );
throw CannotRegisterImplementationException(
- buf.makeStringAndClear(), Reference< XInterface > () );
+ buf.makeStringAndClear() );
}
}
else
{
throw CannotRegisterImplementationException(
- OUString(
"ImplementationRegistration::registerImplementation() "
- "no componentcontext available to instantiate loader"),
- Reference< XInterface > () );
+ "no componentcontext available to instantiate loader" );
}
}
@@ -1780,8 +1772,7 @@ void ImplementationRegistration::doRegister(
else
{
throw CannotRegisterImplementationException(
- OUString( "ImplementationRegistration::doRegistration() component registration signaled failure" ),
- Reference< XInterface > () );
+ "ImplementationRegistration::doRegistration() component registration signaled failure" );
}
// Cleanup Source registry.
diff --git a/stoc/source/implementationregistration/mergekeys.cxx b/stoc/source/implementationregistration/mergekeys.cxx
index b2101b36e527..c44a44d9e8df 100644
--- a/stoc/source/implementationregistration/mergekeys.cxx
+++ b/stoc/source/implementationregistration/mergekeys.cxx
@@ -54,13 +54,11 @@ static void mergeKeys(
{
if (!xSource.is() || !xSource->isValid()) {
throw registry::InvalidRegistryException(
- "source key is null or invalid!",
- Reference<XInterface>() );
+ "source key is null or invalid!" );
}
if (!xDest.is() || !xDest->isValid()) {
throw registry::InvalidRegistryException(
- "destination key is null or invalid!",
- Reference<XInterface>() );
+ "destination key is null or invalid!" );
}
// write value
@@ -149,15 +147,12 @@ void mergeKeys(
{
if (!xDest.is() || !xDest->isValid()) {
throw registry::InvalidRegistryException(
- "destination key is null or invalid!",
- Reference<XInterface>() );
+ "destination key is null or invalid!" );
}
if (xDest->isReadOnly())
{
throw registry::InvalidRegistryException(
- OUString(
- "destination registry is read-only! cannot merge!"),
- Reference< XInterface >() );
+ "destination registry is read-only! cannot merge!" );
}
t_links links;
diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx
index b4765d2dc711..7d65f7df7269 100644
--- a/stoc/source/invocation/invocation.cxx
+++ b/stoc/source/invocation/invocation.cxx
@@ -524,8 +524,7 @@ Any Invocation_Impl::getValue( const OUString& PropertyName )
}
throw UnknownPropertyException(
- OUString("cannot get value ") + PropertyName,
- Reference< XInterface >() );
+ OUString("cannot get value ") + PropertyName );
}
@@ -552,9 +551,7 @@ void Invocation_Impl::setValue( const OUString& PropertyName, const Any& Value )
_xPropertySet->setPropertyValue(
PropertyName, xTypeConverter->convertTo( Value, aProp.Type ) );
else
- throw RuntimeException(
- OUString("no type converter service!"),
- Reference< XInterface >() );
+ throw RuntimeException( "no type converter service!" );
}
// NameContainer
else if( _xNameContainer.is() )
@@ -567,9 +564,7 @@ void Invocation_Impl::setValue( const OUString& PropertyName, const Any& Value )
else if( xTypeConverter.is() )
aConv = xTypeConverter->convertTo( Value, _xNameContainer->getElementType() );
else
- throw RuntimeException(
- OUString("no type converter service!"),
- Reference< XInterface >() );
+ throw RuntimeException( "no type converter service!" );
// bei Vorhandensein ersetzen, ansonsten einfuegen
if (_xNameContainer->hasByName( PropertyName ))
@@ -578,9 +573,7 @@ void Invocation_Impl::setValue( const OUString& PropertyName, const Any& Value )
_xNameContainer->insertByName( PropertyName, aConv );
}
else
- throw UnknownPropertyException(
- OUString("no introspection nor name container!"),
- Reference< XInterface >() );
+ throw UnknownPropertyException( "no introspection nor name container!" );
}
catch (UnknownPropertyException &)
{
diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx
index f6378f005a81..216ee96b8562 100644
--- a/stoc/source/invocation_adapterfactory/iafactory.cxx
+++ b/stoc/source/invocation_adapterfactory/iafactory.cxx
@@ -224,7 +224,7 @@ inline void AdapterImpl::release()
static inline void constructRuntimeException(
uno_Any * pExc, const OUString & rMsg )
{
- RuntimeException exc( rMsg, Reference< XInterface >() );
+ RuntimeException exc( rMsg );
// no conversion needed due to binary compatibility + no convertible type
::uno_type_any_construct(
pExc, &exc, ::getCppuType( &exc ).getTypeLibType(), 0 );
@@ -677,8 +677,7 @@ AdapterImpl::AdapterImpl(
}
delete [] m_pInterfaces;
throw RuntimeException(
- "cannot retrieve all interface type infos!",
- Reference< XInterface >() );
+ "cannot retrieve all interface type infos!" );
}
}
@@ -688,8 +687,7 @@ AdapterImpl::AdapterImpl(
OSL_ASSERT( 0 != m_pReceiver );
if (! m_pReceiver)
{
- throw RuntimeException(
- "cannot map receiver!", Reference< XInterface >() );
+ throw RuntimeException( "cannot map receiver!" );
}
m_pFactory->acquire();
@@ -759,8 +757,7 @@ FactoryImpl::FactoryImpl( Reference< XComponentContext > const & xContext )
!m_pConvertToTD ||
!m_pAnySeqTD || !m_pShortSeqTD)
{
- throw RuntimeException(
- "missing type descriptions!", Reference< XInterface >() );
+ throw RuntimeException( "missing type descriptions!" );
}
}
@@ -881,9 +878,7 @@ Reference< XInterface > FactoryImpl::createAdapter(
OSL_ASSERT( xRet.is() );
if (! xRet.is())
{
- throw RuntimeException(
- "mapping UNO to C++ failed!",
- Reference< XInterface >() );
+ throw RuntimeException( "mapping UNO to C++ failed!" );
}
}
return xRet;
diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx
index 826bdb502be5..c985dbbe7948 100644
--- a/stoc/source/javaloader/javaloader.cxx
+++ b/stoc/source/javaloader/javaloader.cxx
@@ -184,61 +184,55 @@ const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaL
// instantiate the java JavaLoader
jclass jcClassLoader = pJNIEnv->FindClass("java/lang/ClassLoader");
if(pJNIEnv->ExceptionOccurred())
- throw RuntimeException(OUString(
- "javaloader error - could not find class java/lang/ClassLoader"),
- css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - could not find class java/lang/ClassLoader");
jmethodID jmLoadClass = pJNIEnv->GetMethodID(
jcClassLoader, "loadClass",
"(Ljava/lang/String;)Ljava/lang/Class;");
if(pJNIEnv->ExceptionOccurred())
- throw RuntimeException(OUString(
- "javaloader error - could not find method java/lang/ClassLoader.loadClass"),
- css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - could not find method java/lang/ClassLoader.loadClass");
jvalue arg;
arg.l = pJNIEnv->NewStringUTF(
"com.sun.star.comp.loader.JavaLoader");
if(pJNIEnv->ExceptionOccurred())
- throw RuntimeException(OUString(
- "javaloader error - could not create string"),
- css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - could not create string");
jclass jcJavaLoader = static_cast< jclass >(
pJNIEnv->CallObjectMethodA(
static_cast< jobject >(xVirtualMachine->getClassLoader()),
jmLoadClass, &arg));
if(pJNIEnv->ExceptionOccurred())
- throw RuntimeException(OUString(
- "javaloader error - could not find class com/sun/star/comp/loader/JavaLoader"),
- css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - could not find class com/sun/star/comp/loader/JavaLoader");
jmethodID jmJavaLoader_init = pJNIEnv->GetMethodID(jcJavaLoader, "<init>", "()V");
if(pJNIEnv->ExceptionOccurred())
- throw RuntimeException(OUString(
- "javaloader error - instantiation of com.sun.star.comp.loader.JavaLoader failed"),
- css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - instantiation of com.sun.star.comp.loader.JavaLoader failed");
jobject joJavaLoader = pJNIEnv->NewObject(jcJavaLoader, jmJavaLoader_init);
if(pJNIEnv->ExceptionOccurred())
- throw RuntimeException(OUString(
- "javaloader error - instantiation of com.sun.star.comp.loader.JavaLoader failed"),
- css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - instantiation of com.sun.star.comp.loader.JavaLoader failed");
// map the java JavaLoader to this environment
OUString sJava("java");
uno_getEnvironment(&pJava_environment, sJava.pData,
xVirtualMachine.get());
if(!pJava_environment)
- throw RuntimeException(OUString(
- "javaloader error - no Java environment available"), css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - no Java environment available");
// why is there no convinient contructor?
OUString sCppu_current_lb_name(CPPU_CURRENT_LANGUAGE_BINDING_NAME);
uno_getEnvironment(&pUno_environment, sCppu_current_lb_name.pData, NULL);
if(!pUno_environment)
- throw RuntimeException(OUString(
- "javaloader error - no C++ environment available"), css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - no C++ environment available");
Mapping java_curr(pJava_environment, pUno_environment);
if(!java_curr.is())
- throw RuntimeException(OUString(
- "javaloader error - no mapping from java to C++ "), css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - no mapping from java to C++ ");
// release java environment
pJava_environment->release(pJava_environment);
@@ -251,35 +245,29 @@ const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaL
getCppuType((css::uno::Reference<XImplementationLoader> *) 0).
getDescription((typelib_TypeDescription **) & pType_XImplementationLoader);
if(!pType_XImplementationLoader)
- throw RuntimeException(OUString(
- "javaloader error - no type information for XImplementationLoader"),
- css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - no type information for XImplementationLoader");
m_javaLoader = css::uno::Reference<XImplementationLoader>(reinterpret_cast<XImplementationLoader *>(
java_curr.mapInterface(joJavaLoader, pType_XImplementationLoader)));
pJNIEnv->DeleteLocalRef( joJavaLoader );
if(!m_javaLoader.is())
- throw RuntimeException(OUString(
- "javaloader error - mapping of java XImplementationLoader to c++ failed"),
- css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - mapping of java XImplementationLoader to c++ failed");
typelib_typedescription_release(reinterpret_cast<typelib_TypeDescription *>(pType_XImplementationLoader));
pType_XImplementationLoader = NULL;
}
catch (jvmaccess::VirtualMachine::AttachGuard::CreationException &)
{
- throw RuntimeException(
- OUString(
- "jvmaccess::VirtualMachine::AttachGuard"
- "::CreationException"),0);
+ throw RuntimeException("jvmaccess::VirtualMachine::AttachGuard::CreationException");
}
// set the service manager at the javaloader
css::uno::Reference<XInitialization> javaLoader_XInitialization(m_javaLoader, UNO_QUERY);
if(!javaLoader_XInitialization.is())
- throw RuntimeException(OUString(
- "javaloader error - initialization of java javaloader failed, no XInitialization"),
- css::uno::Reference<XInterface>());
+ throw RuntimeException(
+ "javaloader error - initialization of java javaloader failed, no XInitialization");
Any any;
any <<= css::uno::Reference<XMultiComponentFactory>(
diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx
index cbad43fcf151..8107315e55af 100644
--- a/stoc/source/javavm/javavm.cxx
+++ b/stoc/source/javavm/javavm.cxx
@@ -1238,7 +1238,7 @@ void SAL_CALL JavaVirtualMachine::elementReplaced(
// this code was executed. Maybe it is a security feature. However, all attempts to debug the
// SandboxSecurity class (maybe the VM invokes checkPackageAccess) failed.
// jclass jcSandboxSec= pJNIEnv->FindClass("com.sun.star.lib.sandbox.SandboxSecurity");
-// if(pJNIEnv->ExceptionOccurred()) throw RuntimeException("JNI:FindClass com.sun.star.lib.sandbox.SandboxSecurity", Reference<XInterface>());
+// if(pJNIEnv->ExceptionOccurred()) throw RuntimeException("JNI:FindClass com.sun.star.lib.sandbox.SandboxSecurity");
// jboolean bIsSand= pJNIEnv->IsInstanceOf( joSecur, jcSandboxSec);
// The SecurityManagers class Name must be com.sun.star.lib.sandbox.SandboxSecurity
jclass jcSec= pJNIEnv->GetObjectClass( joSecur);
diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx
index 18713f1a6b32..bf1fdacdca9d 100644
--- a/stoc/source/security/file_policy.cxx
+++ b/stoc/source/security/file_policy.cxx
@@ -371,7 +371,7 @@ void PolicyReader::error( OUString const & msg )
buf.append( m_pos );
buf.append( "] " );
buf.append( msg );
- throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+ throw RuntimeException( buf.makeStringAndClear() );
}
PolicyReader::PolicyReader( OUString const & fileName, AccessControl & ac )
@@ -388,7 +388,7 @@ PolicyReader::PolicyReader( OUString const & fileName, AccessControl & ac )
buf.append( "cannot open file \"" );
buf.append( m_fileName );
buf.append( "\"!" );
- throw RuntimeException( buf.makeStringAndClear(), Reference< XInterface >() );
+ throw RuntimeException( buf.makeStringAndClear() );
}
}
diff --git a/stoc/source/security/permissions.cxx b/stoc/source/security/permissions.cxx
index d429c5f163cd..d39bb2283b3c 100644
--- a/stoc/source/security/permissions.cxx
+++ b/stoc/source/security/permissions.cxx
@@ -519,8 +519,7 @@ PermissionCollection::PermissionCollection(
OUStringBuffer buf( 48 );
buf.append( "checking for unsupported permission type: " );
buf.append( perm_type.getTypeName() );
- throw RuntimeException(
- buf.makeStringAndClear(), Reference< XInterface >() );
+ throw RuntimeException( buf.makeStringAndClear() );
}
}
}
@@ -641,8 +640,7 @@ void PermissionCollection::checkPermission( Any const & perm ) const
OUStringBuffer buf( 48 );
buf.append( "checking for unsupported permission type: " );
buf.append( demanded_type.getTypeName() );
- throw RuntimeException(
- buf.makeStringAndClear(), Reference< XInterface >() );
+ throw RuntimeException( buf.makeStringAndClear() );
}
}
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index edc2b57b3239..80746280e0b2 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -223,7 +223,7 @@ beans::Property PropertySetInfo_Impl::getPropertyByName( OUString const & name )
return p[ nPos ];
}
throw beans::UnknownPropertyException(
- "unknown property: " + name, Reference< XInterface >() );
+ "unknown property: " + name );
}
sal_Bool PropertySetInfo_Impl::hasPropertyByName( OUString const & name )
@@ -519,8 +519,7 @@ class OServiceManagerWrapper : public OServiceManagerMutex, public t_OServiceMan
if (! m_root.is())
{
throw lang::DisposedException(
- "service manager instance has already been disposed!",
- Reference< XInterface >() );
+ "service manager instance has already been disposed!" );
}
return m_root;
}
@@ -674,8 +673,7 @@ OServiceManagerWrapper::OServiceManagerWrapper(
if (! m_root.is())
{
throw RuntimeException(
- OUString("no service manager to wrap"),
- Reference< XInterface >() );
+ "no service manager to wrap" );
}
}
@@ -1199,9 +1197,7 @@ void OServiceManager::insert( const Any & Element )
HashSet_Ref::iterator aIt = m_ImplementationMap.find( xEle );
if( aIt != m_ImplementationMap.end() )
{
- throw ElementExistException(
- OUString("element already exists!"),
- Reference< XInterface >() );
+ throw ElementExistException( "element already exists!" );
}
// put into the implementation hashmap