diff options
author | Shawn Pearce <spearce@spearce.org> | 2016-07-05 12:32:24 -0700 |
---|---|---|
committer | Shawn Pearce <spearce@spearce.org> | 2016-07-05 12:32:24 -0700 |
commit | ae5870a1f2d032ed7bb914b2e1e9c8d05e404213 (patch) | |
tree | 761dc444e0b26945a1d58aa93a197ed65683b2bf | |
parent | b57d060408bcc58b2afbce671b2e68a07e90d7d9 (diff) | |
download | jgit-ae5870a1f2d032ed7bb914b2e1e9c8d05e404213.tar.gz jgit-ae5870a1f2d032ed7bb914b2e1e9c8d05e404213.zip |
PushConnectionTest: Use Java 7 try-with-resources
Change-Id: I429066d2af9c5fb8bf8bc038b99ebe5a7dc09170
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushConnectionTest.java | 13 |
1 files 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<String, RemoteRefUpdate> 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()); |