From cc1ed7fbce20f90650f96acc2846b6f232c8ab0f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Wed, 27 Sep 2017 09:11:35 +0200 Subject: loplugin:flatten in various Change-Id: I42dca691ffadbddad38a7e8f978b1da9d5d9a7b0 Reviewed-on: https://gerrit.libreoffice.org/42842 Tested-by: Jenkins Reviewed-by: Noel Grandin --- stoc/source/servicemanager/servicemanager.cxx | 39 ++++++++++++--------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'stoc/source/servicemanager') 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(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(this), 1 ); - } - } - else + if ( PropertyName != "DefaultContext" ) { throw UnknownPropertyException( "unknown property " + PropertyName, static_cast(this) ); } + + Reference< XComponentContext > xContext; + if (!(aValue >>= xContext)) + { + throw IllegalArgumentException( + "no XComponentContext given!", + static_cast(this), 1 ); + } + + MutexGuard aGuard( m_mutex ); + m_xContext = xContext; } Any OServiceManager::getPropertyValue(const OUString& PropertyName) -- cgit