diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-06 17:42:50 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-06 17:42:50 +0900 |
commit | b5115f6897a70329abe81cad87098f467c6e09fd (patch) | |
tree | 03db9c3ece30d25f644b0614dcd311444dfdedf8 /org.eclipse.jgit.http.test | |
parent | 6722f6927a9f5312f8872b6bd1cd73ba129b1bb3 (diff) | |
download | jgit-b5115f6897a70329abe81cad87098f467c6e09fd.tar.gz jgit-b5115f6897a70329abe81cad87098f467c6e09fd.zip |
HookMessageTest: Open Transport in try-with-resource
Change-Id: Ie58b01a8a78e4f42a3b913708a545687c5c9f96b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.http.test')
-rw-r--r-- | org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java index adb69ec279..7795658eac 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HookMessageTest.java @@ -149,11 +149,9 @@ public class HookMessageTest extends HttpTestCase { final RevCommit Q = src.commit().add("Q", Q_txt).create(); final Repository db = src.getRepository(); final String dstName = Constants.R_HEADS + "new.branch"; - Transport t; PushResult result; - t = Transport.open(db, remoteURI); - try { + try (Transport t = Transport.open(db, remoteURI)) { final String srcExpr = Q.name(); final boolean forceUpdate = false; final String localName = null; @@ -163,8 +161,6 @@ public class HookMessageTest extends HttpTestCase { srcExpr, dstName, forceUpdate, localName, oldId); result = t.push(NullProgressMonitor.INSTANCE, Collections .singleton(update)); - } finally { - t.close(); } assertTrue(remoteRepository.hasObject(Q_txt)); @@ -193,12 +189,10 @@ public class HookMessageTest extends HttpTestCase { final RevCommit Q = src.commit().add("Q", Q_txt).create(); final Repository db = src.getRepository(); final String dstName = Constants.R_HEADS + "new.branch"; - Transport t; PushResult result; - t = Transport.open(db, remoteURI); OutputStream out = new ByteArrayOutputStream(); - try { + try (Transport t = Transport.open(db, remoteURI)) { final String srcExpr = Q.name(); final boolean forceUpdate = false; final String localName = null; @@ -208,8 +202,6 @@ public class HookMessageTest extends HttpTestCase { srcExpr, dstName, forceUpdate, localName, oldId); result = t.push(NullProgressMonitor.INSTANCE, Collections.singleton(update), out); - } finally { - t.close(); } String expectedMessage = "message line 1\n" // |