idok-commit AT lists.psi.ch
Subject: Commit emails of the iDok project
List archive
[idok-commit] idok commit r355 - trunk/java/ch/idok/dmsd/impl/extractor/microsoft
Chronological Thread
- From: "AFS account Stadler Hans Christian" <stadler_h AT savannah.psi.ch>
- To: idok-commit AT lists.psi.ch
- Subject: [idok-commit] idok commit r355 - trunk/java/ch/idok/dmsd/impl/extractor/microsoft
- Date: Tue, 31 Mar 2009 16:25:19 +0200
- List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
- List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>
Author: stadler_h
Date: Tue Mar 31 16:25:18 2009
New Revision: 355
Log:
Dispose document object after text extraction
Modified:
trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSExtractorProcess.java
Modified:
trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSExtractorProcess.java
==============================================================================
--- trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSExtractorProcess.java
(original)
+++ trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSExtractorProcess.java
Tue Mar 31 16:25:18 2009
@@ -50,6 +50,7 @@
import com.sun.star.text.XTextDocument;
import com.sun.star.uno.UnoRuntime;
import com.sun.star.uno.XComponentContext;
+import com.sun.star.util.XCloseable;
/**
* @brief This class implements the process that talks to the OpenOffice
Daemon
@@ -252,6 +253,7 @@
*/
private void printText(XDesktop desktop, String tmpFileName,
int type) throws DmsException {
+ XComponent component = null;
try {
XComponentLoader loader = (XComponentLoader)
UnoRuntime.queryInterface(XComponentLoader.class, desktop);
if (loader == null)
@@ -260,7 +262,7 @@
String url = uri.getScheme() + "://" + uri.getPath();
PropertyValue invisible = new PropertyValue("Hidden", -1, true,
PropertyState.DIRECT_VALUE);
- XComponent component = loader.loadComponentFromURL(url,
"_blank", 0,
+ component = loader.loadComponentFromURL(url, "_blank", 0,
new PropertyValue[] { invisible });
Object doc = UnoRuntime.queryInterface(getDesc(type).docClass,
component);
if (doc == null)
@@ -278,6 +280,21 @@
throw new DmsException(ErrorType.CONTENT_EXTRACTION, this,
"Cannot extract the document text.",
"Runtime exception.", th);
+ } finally {
+ if (component != null) {
+ try {
+ XCloseable closeable =
(XCloseable)UnoRuntime.queryInterface(XCloseable.class, component);
+ closeable.close(true);
+ logger.finest("Document has been closed");
+ } catch (Throwable th) {
+ /* ignore */
+ } finally {
+ try {
+ component.dispose();
+ logger.finest("Document has been disposed");
+ } catch (Throwable th) {/*ignore*/}
+ }
+ }
}
}
- [idok-commit] idok commit r355 - trunk/java/ch/idok/dmsd/impl/extractor/microsoft, AFS account Stadler Hans Christian, 03/31/2009
Archive powered by MHonArc 2.6.19.