]> source.dussan.org Git - jgit.git/commitdiff
Fix GcConcurrentTest#testInterruptGc 18/200118/2
authorMatthias Sohn <matthias.sohn@sap.com>
Wed, 22 Feb 2023 19:35:01 +0000 (20:35 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Wed, 22 Feb 2023 19:38:29 +0000 (20:38 +0100)
With the new GC.PidLock interrupting a running GC throws a
ClosedByInterruptException.

Change-Id: I7ccea1ae9a43d4edfdab2fcfd1324c64cc22b38f

org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/GcConcurrentTest.java

index 5cac1e3429882b8fb84907919f0ee08f29d53021..d53d5eb4b8c8a71089232ca6a80b4e69f981d4e5 100644 (file)
@@ -14,10 +14,10 @@ import static java.lang.Integer.valueOf;
 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 class GcConcurrentTest extends GcTestCase {
                        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);
                        }