diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java index 83083f8a4..fbc12e0c3 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java @@ -1008,8 +1008,12 @@ public class SmartClientSmartServerTest extends HttpTestCase { // Create a new commit on the remote. // - b = new TestRepository<>(remoteRepository).branch(master); - RevCommit Z = b.commit().message("Z").create(); + RevCommit Z; + try (TestRepository tr = new TestRepository<>( + remoteRepository)) { + b = tr.branch(master); + Z = b.commit().message("Z").create(); + } // Now incrementally update. // @@ -1068,8 +1072,12 @@ public class SmartClientSmartServerTest extends HttpTestCase { // Create a new commit on the remote. // - b = new TestRepository<>(remoteRepository).branch(master); - RevCommit Z = b.commit().message("Z").create(); + RevCommit Z; + try (TestRepository tr = new TestRepository<>( + remoteRepository)) { + b = tr.branch(master); + Z = b.commit().message("Z").create(); + } // Now incrementally update. //