summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-27 09:11:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-27 11:02:56 +0200
commitcc1ed7fbce20f90650f96acc2846b6f232c8ab0f (patch)
treefcd441cdf9568861363894f63107967adf571f81 /stoc
parentb50f595b34585f2927adfd44b4eaaafb8f600972 (diff)
loplugin:flatten in various
Change-Id: I42dca691ffadbddad38a7e8f978b1da9d5d9a7b0 Reviewed-on: https://gerrit.libreoffice.org/42842 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/implementationregistration/implreg.cxx107
-rw-r--r--stoc/source/servicemanager/servicemanager.cxx39
2 files changed, 69 insertions, 77 deletions
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index 3a08defbb377..4dae09f124f5 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -1408,61 +1408,59 @@ void ImplementationRegistration::prepareRegister(
// set implLoaderUrl
}
- if( m_xSMgr.is() ) {
- try
+ if( !m_xSMgr.is() ) {
+ throw CannotRegisterImplementationException(
+ "ImplementationRegistration::registerImplementation() "
+ "no componentcontext available to instantiate loader" );
+ }
+
+ try
+ {
+ Reference < XImplementationLoader > xAct(
+ m_xSMgr->createInstanceWithContext(activatorName, m_xCtx) , UNO_QUERY );
+ if (!xAct.is())
{
- Reference < XImplementationLoader > xAct(
- m_xSMgr->createInstanceWithContext(activatorName, m_xCtx) , UNO_QUERY );
- if (xAct.is())
- {
- Reference < XSimpleRegistry > xRegistry;
+ throw CannotRegisterImplementationException(
+ "ImplementationRegistration::registerImplementation() - The service "
+ + activatorName + " cannot be instantiated" );
+ }
- if (xReg.is())
- {
- // registry supplied by user
- xRegistry = xReg;
- }
- else
- {
- xRegistry = getRegistryFromServiceManager();
- }
+ Reference < XSimpleRegistry > xRegistry;
- if ( xRegistry.is())
- {
- doRegister(m_xSMgr, m_xCtx, xAct, xRegistry, implementationLoaderUrl,
- locationUrl, registeredLocationUrl);
- }
- }
- else
- {
- throw CannotRegisterImplementationException(
- "ImplementationRegistration::registerImplementation() - The service "
- + activatorName + " cannot be instantiated" );
- }
- }
- catch( CannotRegisterImplementationException & )
+ if (xReg.is())
{
- throw;
+ // registry supplied by user
+ xRegistry = xReg;
}
- catch( const InvalidRegistryException & e )
+ else
{
- throw CannotRegisterImplementationException(
- "ImplementationRegistration::registerImplementation() "
- "InvalidRegistryException during registration (" + e.Message + ")" );
+ xRegistry = getRegistryFromServiceManager();
}
- catch( const MergeConflictException & e )
+
+ if ( xRegistry.is())
{
- throw CannotRegisterImplementationException(
- "ImplementationRegistration::registerImplementation() "
- "MergeConflictException during registration (" + e.Message + ")" );
+ doRegister(m_xSMgr, m_xCtx, xAct, xRegistry, implementationLoaderUrl,
+ locationUrl, registeredLocationUrl);
}
+
}
- else
+ catch( CannotRegisterImplementationException & )
+ {
+ throw;
+ }
+ catch( const InvalidRegistryException & e )
{
throw CannotRegisterImplementationException(
- "ImplementationRegistration::registerImplementation() "
- "no componentcontext available to instantiate loader" );
+ "ImplementationRegistration::registerImplementation() "
+ "InvalidRegistryException during registration (" + e.Message + ")" );
}
+ catch( const MergeConflictException & e )
+ {
+ throw CannotRegisterImplementationException(
+ "ImplementationRegistration::registerImplementation() "
+ "MergeConflictException during registration (" + e.Message + ")" );
+ }
+
}
@@ -1677,24 +1675,23 @@ void ImplementationRegistration::doRegister(
bool bSuccess =
xAct->writeRegistryInfo(xSourceKey, implementationLoaderUrl, locationUrl);
- if ( bSuccess )
- {
- prepareRegistry(xDest, xSourceKey, implementationLoaderUrl, registeredLocationUrl, xCtx);
-
- xSourceKey->closeKey();
-
- xSourceKey = xReg->getRootKey();
- Reference < XRegistryKey > xDestKey = xDest->getRootKey();
- stoc_impreg::mergeKeys( xDestKey, xSourceKey );
- xDestKey->closeKey();
- xSourceKey->closeKey();
- }
- else
+ if ( !bSuccess )
{
throw CannotRegisterImplementationException(
"ImplementationRegistration::doRegistration() component registration signaled failure" );
}
+ prepareRegistry(xDest, xSourceKey, implementationLoaderUrl, registeredLocationUrl, xCtx);
+
+ xSourceKey->closeKey();
+
+ xSourceKey = xReg->getRootKey();
+ Reference < XRegistryKey > xDestKey = xDest->getRootKey();
+ stoc_impreg::mergeKeys( xDestKey, xSourceKey );
+ xDestKey->closeKey();
+ xSourceKey->closeKey();
+
+
// Cleanup Source registry.
if ( xSourceKey->isValid() )
xSourceKey->closeKey();
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index a6d31551b7a1..6186ad209bf8 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -558,17 +558,16 @@ void SAL_CALL OServiceManagerWrapper::setPropertyValue(
if ( PropertyName == "DefaultContext" )
{
Reference< XComponentContext > xContext;
- if (aValue >>= xContext)
- {
- MutexGuard aGuard( m_mutex );
- m_xContext = xContext;
- }
- else
+ if (!(aValue >>= xContext))
{
throw IllegalArgumentException(
"no XComponentContext given!",
static_cast<OWeakObject *>(this), 1 );
}
+
+ MutexGuard aGuard( m_mutex );
+ m_xContext = xContext;
+
}
else
{
@@ -698,27 +697,23 @@ void OServiceManager::setPropertyValue(
const OUString& PropertyName, const Any& aValue )
{
check_undisposed();
- if ( PropertyName == "DefaultContext" )
- {
- Reference< XComponentContext > xContext;
- if (aValue >>= xContext)
- {
- MutexGuard aGuard( m_mutex );
- m_xContext = xContext;
- }
- else
- {
- throw IllegalArgumentException(
- "no XComponentContext given!",
- static_cast<OWeakObject *>(this), 1 );
- }
- }
- else
+ if ( PropertyName != "DefaultContext" )
{
throw UnknownPropertyException(
"unknown property " + PropertyName,
static_cast<OWeakObject *>(this) );
}
+
+ Reference< XComponentContext > xContext;
+ if (!(aValue >>= xContext))
+ {
+ throw IllegalArgumentException(
+ "no XComponentContext given!",
+ static_cast<OWeakObject *>(this), 1 );
+ }
+
+ MutexGuard aGuard( m_mutex );
+ m_xContext = xContext;
}
Any OServiceManager::getPropertyValue(const OUString& PropertyName)