Fix GcConcurrentTest#testInterruptGc

With the new GC.PidLock interrupting a running GC throws a
ClosedByInterruptException.

Change-Id: I7ccea1ae9a43d4edfdab2fcfd1324c64cc22b38f
This commit is contained in:
Matthias Sohn 2023-02-22 20:35:01 +01:00
parent 49f5273867
commit 1691e38779
1 changed files with 3 additions and 5 deletions

View File

@ -14,10 +14,10 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.io.IOException;
import java.nio.channels.ClosedByInterruptException;
import java.util.Collection;
import java.util.Collections;
import java.util.concurrent.BrokenBarrierException;
@ -226,10 +226,8 @@ public void testInterruptGc() throws Exception {
if (cause instanceof CancelledException) {
assertEquals(JGitText.get().operationCanceled,
cause.getMessage());
} else if (cause instanceof IOException) {
Throwable cause2 = cause.getCause();
assertTrue(cause2 instanceof InterruptedException
|| cause2 instanceof ExecutionException);
} else if (cause instanceof ClosedByInterruptException) {
// thread was interrupted
} else {
fail("unexpected exception " + e);
}