]> source.dussan.org Git - jgit.git/commitdiff
SmartClientSmartServerTest: Open TestRepository in try-with-resource 97/135397/1
authorDavid Pursehouse <david.pursehouse@gmail.com>
Sun, 20 Jan 2019 08:02:34 +0000 (17:02 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Sun, 20 Jan 2019 08:02:34 +0000 (17:02 +0900)
Change-Id: If1351920398f574b5b93be55868c157c3cd15290
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/SmartClientSmartServerTest.java

index 83083f8a4eb31a0edc5ffa9734c28241df06b5ac..fbc12e0c32bf7dd77a0aeb3222e2aceb32416811 100644 (file)
@@ -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<Repository> 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<Repository> tr = new TestRepository<>(
+                               remoteRepository)) {
+                       b = tr.branch(master);
+                       Z = b.commit().message("Z").create();
+               }
 
                // Now incrementally update.
                //