]> source.dussan.org Git - jgit.git/commitdiff
PushConnectionTest: Use Java 7 try-with-resources 48/76648/1
authorShawn Pearce <spearce@spearce.org>
Tue, 5 Jul 2016 19:32:24 +0000 (12:32 -0700)
committerShawn Pearce <spearce@spearce.org>
Tue, 5 Jul 2016 19:32:24 +0000 (12:32 -0700)
Change-Id: I429066d2af9c5fb8bf8bc038b99ebe5a7dc09170

org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/PushConnectionTest.java

index a3b4134aeaf0fbbde8c90e024469bd5b05758ac7..9e78921b7907db2a0c3270b529432e3b3d2c0c8e 100644 (file)
@@ -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());