diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2022-11-20 21:33:17 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2022-11-21 00:08:42 +0100 |
commit | 396508e283f9e5810569471b933cf76e7b3e3a58 (patch) | |
tree | 900fa3cbd5f0026c049fe733f8f3a5c01e50e65b /org.eclipse.jgit.junit.ssh/src/org/eclipse/jgit/junit/ssh | |
parent | bde09c185f41c2ee051a8b768fbf455a54a24e56 (diff) | |
download | jgit-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.java | 14 |
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); |