aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShawn Pearce <spearce@spearce.org>2016-07-05 12:32:24 -0700
committerShawn Pearce <spearce@spearce.org>2016-07-05 12:32:24 -0700
commitae5870a1f2d032ed7bb914b2e1e9c8d05e404213 (patch)
tree761dc444e0b26945a1d58aa93a197ed65683b2bf
parentb57d060408bcc58b2afbce671b2e68a07e90d7d9 (diff)
downloadjgit-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.java13
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());