diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-09-17 16:56:19 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-09-17 16:59:53 +0200 |
commit | 543158edba6678d3d76eee983a9d4edd2a422fee (patch) | |
tree | 458133435b06afd5b50379c058a0f886fe9e82c1 /configmgr | |
parent | 6e78fd18c9ca2d70af93cad321f55f3d72172742 (diff) |
Require XComponentContext.getServiceManager to throw instead of returning null
This is such a fatal error that there is probably no point in trying to handle
it, so allow to simplify client code by removing the requirement to check for a
null return value.
Simplified some client code accordingly (modules configmgr and ure, and the code
generated by cppumaker and javamaker).
Change-Id: I51c0b270ec73409374f7439a47ee061407a46e31
Diffstat (limited to 'configmgr')
-rw-r--r-- | configmgr/source/components.cxx | 6 | ||||
-rw-r--r-- | configmgr/source/configurationregistry.cxx | 13 |
2 files changed, 7 insertions, 12 deletions
diff --git a/configmgr/source/components.cxx b/configmgr/source/components.cxx index e42fb48352e2..c08744e99a8e 100644 --- a/configmgr/source/components.cxx +++ b/configmgr/source/components.cxx @@ -29,7 +29,6 @@ #include "com/sun/star/beans/XPropertySet.hpp" #include "com/sun/star/container/NoSuchElementException.hpp" #include "com/sun/star/lang/WrappedTargetException.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.hpp" #include "com/sun/star/uno/Any.hxx" #include "com/sun/star/uno/Exception.hpp" #include "com/sun/star/uno/Reference.hxx" @@ -431,9 +430,8 @@ css::beans::Optional< css::uno::Any > Components::getExternalValue( if (j == externalServices_.end()) { css::uno::Reference< css::uno::XInterface > service; try { - service = css::uno::Reference< css::lang::XMultiComponentFactory >( - context_->getServiceManager(), css::uno::UNO_SET_THROW)-> - createInstanceWithContext(name, context_); + service = context_->getServiceManager()->createInstanceWithContext( + name, context_); } catch (css::uno::RuntimeException &) { // Assuming these exceptions are real errors: throw; diff --git a/configmgr/source/configurationregistry.cxx b/configmgr/source/configurationregistry.cxx index b70d5d3701e8..40b694109da3 100644 --- a/configmgr/source/configurationregistry.cxx +++ b/configmgr/source/configurationregistry.cxx @@ -28,7 +28,6 @@ #include "com/sun/star/container/NoSuchElementException.hpp" #include "com/sun/star/container/XHierarchicalNameAccess.hpp" #include "com/sun/star/container/XNamed.hpp" -#include "com/sun/star/lang/XMultiComponentFactory.hpp" #include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/registry/InvalidRegistryException.hpp" @@ -323,13 +322,11 @@ Service::Service( assert(context.is()); try { provider_ = css::uno::Reference< css::lang::XMultiServiceFactory >( - (css::uno::Reference< css::lang::XMultiComponentFactory >( - context->getServiceManager(), css::uno::UNO_SET_THROW)-> - createInstanceWithContext( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.DefaultProvider")), - context)), + context->getServiceManager()->createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.DefaultProvider")), + context), css::uno::UNO_QUERY_THROW); } catch (css::uno::RuntimeException &) { throw; |