XConnection connection = null;
try {
connection = xConnector.connect("socket,host=" + host + ",port=" + port);
if (connection == null) {
logger.error("Cannot connect to open office using host " + host + " and port " + port);
throw new OpenOfficeConnectionException("Cannot connect to open office using host " + host
+ " and port " + port);
}
} catch (Exception e) {
logger.error("Cannot connect to open office using host " + host + " and port " + port, e);
throw new OpenOfficeConnectionException("Cannot connect to open office using host " + host + " and port " + port);
}
logger.debug("XConnection retrieved: " + connection);
x = xRemoteContext.getServiceManager().createInstanceWithContext("com.sun.star.bridge.BridgeFactory",
xRemoteContext);
XBridgeFactory xBridgeFactory = (XBridgeFactory) UnoRuntime.queryInterface(XBridgeFactory.class, x);