aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2022-11-20 21:33:17 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2022-11-21 00:08:42 +0100
commit396508e283f9e5810569471b933cf76e7b3e3a58 (patch)
tree900fa3cbd5f0026c049fe733f8f3a5c01e50e65b /org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh
parentbde09c185f41c2ee051a8b768fbf455a54a24e56 (diff)
downloadjgit-396508e283f9e5810569471b933cf76e7b3e3a58.tar.gz
jgit-396508e283f9e5810569471b933cf76e7b3e3a58.zip
SshTestGitServer: : ensure UploadPack is closed to fix resource leak
Change-Id: Ib766f1d56b3ca7940c593ebfe0ac68fc5028a11c
Diffstat (limited to 'org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh')
-rw-r--r--org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java14
1 files changed, 7 insertions, 7 deletions
diff --git a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java
index 4fe98f8683..5d043ffc3a 100644
--- a/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java
+++ b/org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh/SshTestGitServer.java
@@ -480,13 +480,13 @@ public class SshTestGitServer {
@Override
public void run() {
- UploadPack uploadPack = new UploadPack(repository);
- String gitProtocol = getEnvironment().getEnv().get("GIT_PROTOCOL");
- if (gitProtocol != null) {
- uploadPack
- .setExtraParameters(Collections.singleton(gitProtocol));
- }
- try {
+ try (UploadPack uploadPack = new UploadPack(repository)) {
+ String gitProtocol = getEnvironment().getEnv()
+ .get("GIT_PROTOCOL");
+ if (gitProtocol != null) {
+ uploadPack.setExtraParameters(
+ Collections.singleton(gitProtocol));
+ }
uploadPack.upload(getInputStream(), getOutputStream(),
getErrorStream());
onExit(0);