summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2016-02-12 14:09:02 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2016-02-12 14:09:02 +0900
commit101ac16e8d5874da9dacb99ecd72aa286128d6c9 (patch)
tree142fc970fbad7688cbc158f1b8c1bb38928b0b27
parent53b6bb9cca12aa872a6839f3ab9d129d2708735a (diff)
downloadjgit-101ac16e8d5874da9dacb99ecd72aa286128d6c9.tar.gz
jgit-101ac16e8d5874da9dacb99ecd72aa286128d6c9.zip
PackWriterTest: Open RevWalk in try-with-resource
Change-Id: Ic8ed941d096718e81c7ffeb166bcf7faaa2ff57d Signed-off-by: David Pursehouse <david.pursehouse@sonymobile.com>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
index 01d6ee68e8..63a3072859 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/internal/storage/file/PackWriterTest.java
@@ -342,12 +342,13 @@ public class PackWriterTest extends SampleDataRepositoryTestCase {
ObjectId.fromString("902d5476fa249b7abc9d84c611577a81381f0327"),
ObjectId.fromString("5b6e7c66c276e7610d4a73c70ec1a1f7c1003259"),
ObjectId.fromString("6ff87c4664981e4397625791c8ea3bbb5f2279a3") };
- final RevWalk parser = new RevWalk(db);
- final RevObject forcedOrderRevs[] = new RevObject[forcedOrder.length];
- for (int i = 0; i < forcedOrder.length; i++)
- forcedOrderRevs[i] = parser.parseAny(forcedOrder[i]);
+ try (final RevWalk parser = new RevWalk(db)) {
+ final RevObject forcedOrderRevs[] = new RevObject[forcedOrder.length];
+ for (int i = 0; i < forcedOrder.length; i++)
+ forcedOrderRevs[i] = parser.parseAny(forcedOrder[i]);
- createVerifyOpenPack(Arrays.asList(forcedOrderRevs));
+ createVerifyOpenPack(Arrays.asList(forcedOrderRevs));
+ }
assertEquals(forcedOrder.length, writer.getObjectCount());
verifyObjectsOrder(forcedOrder);