From 9b2779925cc0dff7779f129e6661a046af7b19f3 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Sun, 20 Jan 2019 17:34:21 +0900 Subject: [PATCH] PushConnectionTest: Open TestRepository in try-with-resource Change-Id: I539b3acea8da914fc745e54b0bf104cf344c181c Signed-off-by: David Pursehouse --- .../jgit/transport/PushConnectionTest.java | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushConnectionTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushConnectionTest.java index 63478f6f9..cea432e34 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushConnectionTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushConnectionTest.java @@ -216,15 +216,16 @@ public class PushConnectionTest { @Test public void commandOrder() throws Exception { - TestRepository tr = new TestRepository<>(client); List updates = new ArrayList<>(); - // Arbitrary non-sorted order. - for (int i = 9; i >= 0; i--) { - String name = "refs/heads/b" + i; - tr.branch(name).commit().create(); - RemoteRefUpdate rru = new RemoteRefUpdate(client, name, name, false, null, - ObjectId.zeroId()); - updates.add(rru); + try (TestRepository tr = new TestRepository<>(client)) { + // Arbitrary non-sorted order. + for (int i = 9; i >= 0; i--) { + String name = "refs/heads/b" + i; + tr.branch(name).commit().create(); + RemoteRefUpdate rru = new RemoteRefUpdate(client, name, name, + false, null, ObjectId.zeroId()); + updates.add(rru); + } } PushResult result;