Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse2018-03-06 08:40:23 +0000
committerDavid Pursehouse2018-03-06 08:40:23 +0000
commit462f04a47d48629e427c5666068f177979a8ee1a (patch)
tree0d12261edd2c238a323c765a0e6bc10380259502 /org.eclipse.jgit.http.test
parentc6ea82b9cc1d42f55d571e5f85c9572e09de30a4 (diff)
downloadjgit-462f04a47d48629e427c5666068f177979a8ee1a.tar.gz
jgit-462f04a47d48629e427c5666068f177979a8ee1a.tar.xz
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')
-rw-r--r--org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/GitServletResponseTests.java18
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();
}
}
}

Back to the top