summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2016-01-22 14:59:54 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2016-01-22 14:59:54 +0900
commit8bbd9077e476444589798f84a4a103c2e769d9a2 (patch)
treec6adbfff7d960db66cfd0a231942eca34fef8739
parent625a21f5f47c5fd4fa4453934843f2dee0c5cc78 (diff)
downloadjgit-8bbd9077e476444589798f84a4a103c2e769d9a2.tar.gz
jgit-8bbd9077e476444589798f84a4a103c2e769d9a2.zip
ConcurrentRepackTest: Open RevWalk in try-with-resource
Change-Id: Idc7b7bbdc1df05372b873cbe4c495474f3ffd64b Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java
index 514e00f356..1b973ea814 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/ConcurrentRepackTest.java
@@ -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);
+ }
}
}