From ae5870a1f2d032ed7bb914b2e1e9c8d05e404213 Mon Sep 17 00:00:00 2001 From: Shawn Pearce Date: Tue, 5 Jul 2016 12:32:24 -0700 Subject: [PATCH] PushConnectionTest: Use Java 7 try-with-resources Change-Id: I429066d2af9c5fb8bf8bc038b99ebe5a7dc09170 --- .../eclipse/jgit/transport/PushConnectionTest.java | 13 +++---------- 1 file changed, 3 insertions(+), 10 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 a3b4134aea..9e78921b79 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 @@ -125,16 +125,9 @@ public class PushConnectionTest { Map updates = new HashMap<>(); updates.put(rru.getRemoteName(), rru); - Transport tn = testProtocol.open(uri, client, "server"); - try { - PushConnection connection = tn.openPush(); - try { - connection.push(NullProgressMonitor.INSTANCE, updates); - } finally { - connection.close(); - } - } finally { - tn.close(); + try (Transport tn = testProtocol.open(uri, client, "server"); + PushConnection connection = tn.openPush()) { + connection.push(NullProgressMonitor.INSTANCE, updates); } assertEquals(REJECTED_OTHER_REASON, rru.getStatus()); -- 2.39.5