aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2024-08-28 17:12:41 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2024-08-28 21:46:37 +0200
commit4785d621fbe741c8fef9a3b47ed74024af2801a4 (patch)
treed4bb5f1b261ad57a537221c24befaa32f3186755 /org.eclipse.jgit.test
parent71eb7921485692e7520258a929b1b378c7a69691 (diff)
downloadjgit-4785d621fbe741c8fef9a3b47ed74024af2801a4.tar.gz
jgit-4785d621fbe741c8fef9a3b47ed74024af2801a4.zip
ObjectDirectoryTest: ensure WindowCursor is closed
Change-Id: I75b7d36181a0d404d4e3dca17b9e436892d97b42
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java
index 746a0a1ff3..d1342c0fbd 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ObjectDirectoryTest.java
@@ -243,17 +243,18 @@ public class ObjectDirectoryTest extends RepositoryTestCase {
db.getConfig().setBoolean(ConfigConstants.CONFIG_GC_SECTION, null,
ConfigConstants.CONFIG_KEY_WRITE_COMMIT_GRAPH, true);
- WindowCursor curs = new WindowCursor(db.getObjectDatabase());
- assertTrue(curs.getCommitGraph().isEmpty());
- commitFile("file.txt", "content", "master");
- GC gc = new GC(db);
- gc.gc().get();
- assertTrue(curs.getCommitGraph().isPresent());
+ try (WindowCursor curs = new WindowCursor(db.getObjectDatabase())) {
+ assertTrue(curs.getCommitGraph().isEmpty());
+ commitFile("file.txt", "content", "master");
+ GC gc = new GC(db);
+ gc.gc().get();
+ assertTrue(curs.getCommitGraph().isPresent());
- db.getConfig().setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
- ConfigConstants.CONFIG_COMMIT_GRAPH, false);
+ db.getConfig().setBoolean(ConfigConstants.CONFIG_CORE_SECTION, null,
+ ConfigConstants.CONFIG_COMMIT_GRAPH, false);
- assertTrue(curs.getCommitGraph().isEmpty());
+ assertTrue(curs.getCommitGraph().isEmpty());
+ }
}
@Test