forked from amazingfate/loongoffice
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
This commit is contained in:
@ -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");
|
||||
|
||||
Reference in New Issue
Block a user