summaryrefslogtreecommitdiff
path: root/ure
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-17 16:56:19 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-17 16:59:53 +0200
commit543158edba6678d3d76eee983a9d4edd2a422fee (patch)
tree458133435b06afd5b50379c058a0f886fe9e82c1 /ure
parent6e78fd18c9ca2d70af93cad321f55f3d72172742 (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 'ure')
-rw-r--r--ure/source/uretest/JavaClient.java7
-rw-r--r--ure/source/uretest/cppmain.cc11
2 files changed, 3 insertions, 15 deletions
diff --git a/ure/source/uretest/JavaClient.java b/ure/source/uretest/JavaClient.java
index d37e6f8f5f74..f86d61af66cf 100644
--- a/ure/source/uretest/JavaClient.java
+++ b/ure/source/uretest/JavaClient.java
@@ -23,7 +23,6 @@ import com.sun.star.bridge.XBridgeFactory;
import com.sun.star.comp.helper.Bootstrap;
import com.sun.star.connection.Connector;
import com.sun.star.lang.XComponent;
-import com.sun.star.lang.XMultiComponentFactory;
import com.sun.star.lib.uno.helper.UnoUrl;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
@@ -34,13 +33,9 @@ public final class JavaClient {
public static void main(String[] arguments) throws Exception {
XComponentContext context = Bootstrap.createInitialComponentContext(
null);
- XMultiComponentFactory manager = context.getServiceManager();
- if (manager == null) {
- throw new NullPointerException("no service manager");
- }
XBridgeFactory factory = UnoRuntime.queryInterface(
XBridgeFactory.class,
- manager.createInstanceWithContext(
+ context.getServiceManager().createInstanceWithContext(
"com.sun.star.bridge.BridgeFactory", context));
if (factory == null) {
throw new NullPointerException("no bridge factory");
diff --git a/ure/source/uretest/cppmain.cc b/ure/source/uretest/cppmain.cc
index 3cc496c14496..54e6c6890018 100644
--- a/ure/source/uretest/cppmain.cc
+++ b/ure/source/uretest/cppmain.cc
@@ -26,7 +26,6 @@
#include <boost/unordered_map.hpp>
#include "com/sun/star/lang/XMain.hpp"
-#include "com/sun/star/lang/XMultiComponentFactory.hpp"
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
@@ -141,18 +140,12 @@ private:
"com.sun.star.uri.UriSchemeParser_vndDOTsunDOTstarDOTscript",
"com.sun.star.uri.VndSunStarPkgUrlReferenceFactory"
};
- ::css::uno::Reference< ::css::lang::XMultiComponentFactory > manager(
- context_->getServiceManager());
- if (!manager.is()) {
- throw ::css::uno::RuntimeException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("no service manager")),
- static_cast< ::cppu::OWeakObject * >(this));
- }
for (::std::size_t i = 0; i < SAL_N_ELEMENTS(services); ++i) {
::rtl::OUString name(::rtl::OUString::createFromAscii(services[i]));
::css::uno::Reference< ::css::uno::XInterface > instance;
try {
- instance = manager->createInstanceWithContext(name, context_);
+ instance = context_->getServiceManager()->createInstanceWithContext(
+ name, context_);
} catch (::css::uno::RuntimeException &) {
throw;
} catch (::css::uno::Exception &) {