log.println("ERROR: Can't close the connection: " + e.toString());
}
log.println("closing data source...");
try {
XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
XCloseable.class, m_dbSrc);
if ( closer == null )
{
XDocumentDataSource dataSource = (XDocumentDataSource)UnoRuntime.queryInterface(
XDocumentDataSource.class, m_dbSrc);
if ( dataSource != null )
closer = (XCloseable) UnoRuntime.queryInterface(
XCloseable.class, dataSource.getDatabaseDocument() );
}
if (debug && closer==null){
log.println("ERROR: couldn't get 'XCloseable' from DataSource");
}
closer.close(true);
} catch (com.sun.star.util.CloseVetoException e) {
log.println("ERROR: couldn't close data source: " + e.toString());
} catch (com.sun.star.lang.DisposedException e) {
log.println("ERROR: couldn't close data source: " + e.toString());
} catch (Exception e) {
log.println("ERROR: couldn't close data source: " + e.toString());
}
log.println("disposing data source...");
try {
XComponent dataSourceComp = (XComponent)UnoRuntime.queryInterface(
XComponent.class, m_dbSrc);
dataSourceComp.dispose();
}
catch (Exception e) {
log.println("couldn't dispose the data source");
}
log.println("closing document...");
try {
XCloseable closer = (XCloseable) UnoRuntime.queryInterface(
XCloseable.class, m_xTextDoc);
closer.close(true);
} catch (com.sun.star.util.CloseVetoException e) {
log.println("ERROR: couldn't close document: " + e.toString());
} catch (com.sun.star.lang.DisposedException e) {
log.println("ERROR: couldn't close document: " + e.toString());
} catch (Exception e) {