Skip to Content.
Sympa Menu

idok-commit - [idok-commit] idok commit r275 - trunk/java/ch/idok/dmsd/impl/extractor/microsoft

idok-commit AT lists.psi.ch

Subject: Commit emails of the iDok project

List archive

[idok-commit] idok commit r275 - 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 r275 - trunk/java/ch/idok/dmsd/impl/extractor/microsoft
  • Date: Mon, 13 Oct 2008 14:24: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: Mon Oct 13 14:24:19 2008
New Revision: 275

Log:
Fixed bug causing timeout while extracting text from MS Office Documents

Modified:
trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSExtractorProcess.java

trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSOfficeExtractorFactory.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
Mon Oct 13 14:24:19 2008
@@ -218,6 +218,7 @@
* - args[2]: Log level
*/
public static void main(String[] args) {
+ int retval = 1;
try {
Level level = Level.parse(args[2]);
logger = Logger.getLogger("dmsd.impl.extractor.microsoft");
@@ -233,13 +234,13 @@
logger.finest("Retrieved desktop object from Open Office");
msep.printText(desktop, args[0], type);
logger.finest("Printed document text to stdout, exiting with
status 0");
- System.exit(0);
+ retval = 0;
} catch (DmsException ex) {
logger.warning(Util.mergeMessages(ex.getUserMessage(),
ex.getDetailedMessage()+"\n"+ex));
} catch (Throwable th) {
logger.warning("Failed to extract and print document text,
exiting with status 1:\n"+th);
}
- System.exit(1);
+ System.exit(retval);
}

/**

Modified:
trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSOfficeExtractorFactory.java
==============================================================================
---
trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSOfficeExtractorFactory.java
(original)
+++
trunk/java/ch/idok/dmsd/impl/extractor/microsoft/MSOfficeExtractorFactory.java
Mon Oct 13 14:24:19 2008
@@ -245,22 +245,25 @@
// Read the stdout output of the extraction process
is = proc.getInputStream();
int length = readLength(is)+1; // allow for 1 character of
slack
+ int offset = 0;
logger.finest("length is "+length);
byte[] buf = new byte[0];
if (length > 0) {
buf = new byte[length];
- int offset = 0;
do {
int len = is.read(buf, offset, length);
if (len < 0) {
- logger.finest("Finished reading the input
stream, nchars="+offset);
break;
+ } else if (len == 0) {
+ Thread.sleep(1000);
+ } else {
+ length -= len;
+ offset += len;
}
- length -= len;
- offset += len;
- } while (true);
+ } while (length > 0);
}
is.close(); is = null;
+ logger.finest("Finished reading the input stream,
nchars="+offset);
// Log the stderr output, if any, of the extraction process
errThread.join(interruptDelay);
String errStr = errOut.getErrorOutput();



  • [idok-commit] idok commit r275 - trunk/java/ch/idok/dmsd/impl/extractor/microsoft, AFS account Stadler Hans Christian, 10/13/2008

Archive powered by MHonArc 2.6.19.

Top of Page