]> source.dussan.org Git - jgit.git/commitdiff
ConcurrentRepackTest: Open RevWalk in try-with-resource 50/64950/1
authorDavid Pursehouse <david.pursehouse@sonymobile.com>
Fri, 22 Jan 2016 05:59:54 +0000 (14:59 +0900)
committerDavid Pursehouse <david.pursehouse@sonymobile.com>
Fri, 22 Jan 2016 05:59:54 +0000 (14:59 +0900)
Change-Id: Idc7b7bbdc1df05372b873cbe4c495474f3ffd64b
Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java

index 514e00f356a06d66cbe4e0c28f90547f7c6d5f91..1b973ea814bd365b526533dea2a2dd5b08e20b71 100644 (file)
@@ -211,7 +211,9 @@ public class ConcurrentRepackTest extends RepositoryTestCase {
 
        private RevObject parse(final AnyObjectId id)
                        throws MissingObjectException, IOException {
-               return new RevWalk(db).parseAny(id);
+               try (RevWalk rw = new RevWalk(db)) {
+                       return rw.parseAny(id);
+               }
        }
 
        private File[] pack(final Repository src, final RevObject... list)
@@ -280,7 +282,6 @@ public class ConcurrentRepackTest extends RepositoryTestCase {
 
        private RevObject writeBlob(final Repository repo, final String data)
                        throws IOException {
-               final RevWalk revWalk = new RevWalk(repo);
                final byte[] bytes = Constants.encode(data);
                final ObjectId id;
                try (ObjectInserter inserter = repo.newObjectInserter()) {
@@ -293,6 +294,8 @@ public class ConcurrentRepackTest extends RepositoryTestCase {
                } catch (MissingObjectException e) {
                        // Ok
                }
-               return revWalk.lookupBlob(id);
+               try (RevWalk revWalk = new RevWalk(repo)) {
+                       return revWalk.lookupBlob(id);
+               }
        }
 }