diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-06 17:40:23 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-06 17:40:23 +0900 |
commit | 462f04a47d48629e427c5666068f177979a8ee1a (patch) | |
tree | 0d12261edd2c238a323c765a0e6bc10380259502 /org.eclipse.jgit.http.test/tst/org | |
parent | c6ea82b9cc1d42f55d571e5f85c9572e09de30a4 (diff) | |
download | jgit-462f04a47d48629e427c5666068f177979a8ee1a.tar.gz jgit-462f04a47d48629e427c5666068f177979a8ee1a.zip |
GitServletResponseTests: Open Transport in try-with-resource
Change-Id: Ib74752c9185e38d0bfe9b4cef93b2427bf3afbd0
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.http.test/tst/org')
-rw-r--r-- | org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletResponseTests.java | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletResponseTests.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletResponseTests.java index de7891c445..8dce98beef 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletResponseTests.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletResponseTests.java @@ -176,7 +176,6 @@ public class GitServletResponseTests extends HttpTestCase { final RevCommit Q = client.commit().add("Q", Q_txt).create(); final Repository clientRepo = client.getRepository(); final String srvBranchName = Constants.R_HEADS + "new.branch"; - Transport t; maxPackSize = 0; postHook = null; @@ -188,8 +187,7 @@ public class GitServletResponseTests extends HttpTestCase { } }; - t = Transport.open(clientRepo, srvURI); - try { + try (Transport t = Transport.open(clientRepo, srvURI)) { RemoteRefUpdate update = new RemoteRefUpdate(clientRepo, Q.name(), srvBranchName, false, null, null); try { @@ -199,8 +197,6 @@ public class GitServletResponseTests extends HttpTestCase { } catch (Exception e) { assertTrue(e instanceof TransportException); } - } finally { - t.close(); } } @@ -218,7 +214,6 @@ public class GitServletResponseTests extends HttpTestCase { final RevCommit Q = client.commit().add("Q", Q_txt).create(); final Repository clientRepo = client.getRepository(); final String srvBranchName = Constants.R_HEADS + "new.branch"; - Transport t; maxPackSize = 0; postHook = null; @@ -231,8 +226,7 @@ public class GitServletResponseTests extends HttpTestCase { } }; - t = Transport.open(clientRepo, srvURI); - try { + try (Transport t = Transport.open(clientRepo, srvURI)) { RemoteRefUpdate update = new RemoteRefUpdate(clientRepo, Q.name(), srvBranchName, false, null, null); try { @@ -242,8 +236,6 @@ public class GitServletResponseTests extends HttpTestCase { } catch (Exception e) { assertTrue(e instanceof TransportException); } - } finally { - t.close(); } } @@ -266,7 +258,6 @@ public class GitServletResponseTests extends HttpTestCase { final RevCommit Q = client.commit().add("Q", Q_txt).create(); final Repository clientRepo = client.getRepository(); final String srvBranchName = Constants.R_HEADS + "new.branch"; - Transport t; // this maxPackSize leads to an unPackError maxPackSize = 100; @@ -283,8 +274,7 @@ public class GitServletResponseTests extends HttpTestCase { } }; - t = Transport.open(clientRepo, srvURI); - try { + try (Transport t = Transport.open(clientRepo, srvURI)) { RemoteRefUpdate update = new RemoteRefUpdate(clientRepo, Q.name(), srvBranchName, false, null, null); try { @@ -294,8 +284,6 @@ public class GitServletResponseTests extends HttpTestCase { } catch (Exception e) { assertTrue(e instanceof TooLargePackException); } - } finally { - t.close(); } } } |