]> source.dussan.org Git - jgit.git/commitdiff
CommitCommandTest: Open Repository in try-with-resource 27/118727/1
authorDavid Pursehouse <david.pursehouse@gmail.com>
Mon, 5 Mar 2018 23:24:28 +0000 (08:24 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Mon, 5 Mar 2018 23:24:28 +0000 (08:24 +0900)
Change-Id: Id9961a120ef9f949f04fc95455fae06ba95d8031
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CommitCommandTest.java

index a0834e7e85ba61cda88e0f82f40293b30ca94baa..0dd37493372ddccae15d52ae41056a45bc534eaf 100644 (file)
@@ -223,9 +223,9 @@ public class CommitCommandTest extends RepositoryTestCase {
                        assertEquals(uri, generator.getModulesUrl());
                        assertEquals(path, generator.getModulesPath());
                        assertEquals(uri, generator.getConfigUrl());
-                       Repository subModRepo = generator.getRepository();
-                       assertNotNull(subModRepo);
-                       subModRepo.close();
+                       try (Repository subModRepo = generator.getRepository()) {
+                               assertNotNull(subModRepo);
+                       }
                        assertEquals(commit, repo.resolve(Constants.HEAD));
 
                        RevCommit submoduleCommit = git.commit().setMessage("submodule add")
@@ -273,9 +273,9 @@ public class CommitCommandTest extends RepositoryTestCase {
                        assertEquals(uri, generator.getModulesUrl());
                        assertEquals(path, generator.getModulesPath());
                        assertEquals(uri, generator.getConfigUrl());
-                       Repository subModRepo = generator.getRepository();
-                       assertNotNull(subModRepo);
-                       subModRepo.close();
+                       try (Repository subModRepo = generator.getRepository()) {
+                               assertNotNull(subModRepo);
+                       }
                        assertEquals(commit2, repo.resolve(Constants.HEAD));
 
                        RevCommit submoduleAddCommit = git.commit().setMessage("submodule add")