OfficeConnection.java: don't wait forever if terminate() fails

This commit is contained in:
Michael Stahl
2012-03-02 13:49:19 +01:00
parent 56665a8a22
commit 90f7a3ada6

View File

@@ -128,6 +128,12 @@ public final class OfficeConnection {
context = null;
try {
desktopTerminated = desktop.terminate();
if (!desktopTerminated) {
// in case terminate() fails we would wait forever
// for the process to die, so kill it
process.destroy();
}
assertTrue(desktopTerminated);
} catch (DisposedException e) {}
// it appears that DisposedExceptions can already happen
// while receiving the response of the terminate call
@@ -142,7 +148,6 @@ public final class OfficeConnection {
}
boolean outTerminated = outForward == null || outForward.terminated();
boolean errTerminated = errForward == null || errForward.terminated();
assertTrue(desktopTerminated);
assertEquals(0, code);
assertTrue(outTerminated);
assertTrue(errTerminated);