diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2023-11-09 00:06:19 +0100 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2023-11-09 00:08:42 +0100 |
commit | b761a0fc3eb68bafcde576419f51ef7bf10de663 (patch) | |
tree | 4ddcf013f41ab2de554c6cfe6a223a22e920981f | |
parent | 32f7db784d0cf4a4c5917fda4243e450810affe7 (diff) | |
download | jgit-b761a0fc3eb68bafcde576419f51ef7bf10de663.tar.gz jgit-b761a0fc3eb68bafcde576419f51ef7bf10de663.zip |
Use try-with-resource to ensure UploadPack is closed
Change-Id: I0d10aeac959a49b3bf2e83b0c104699d1d21f5e9
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java index 3a1fa24009..026492f7b6 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java @@ -3015,12 +3015,13 @@ public class UploadPackTest { String version = TransferConfig.ProtocolVersion.V2.version(); server.getConfig().setString(ConfigConstants.CONFIG_PROTOCOL_SECTION, null, ConfigConstants.CONFIG_KEY_VERSION, version); - UploadPack up = new UploadPack(server); - up.setExtraParameters(Sets.of("version=".concat(version))); + try (UploadPack up = new UploadPack(server)) { + up.setExtraParameters(Sets.of("version=".concat(version))); - ByteArrayOutputStream recv = new ByteArrayOutputStream(); - up.upload(send, recv, null); - return up.getStatistics(); + ByteArrayOutputStream recv = new ByteArrayOutputStream(); + up.upload(send, recv, null); + return up.getStatistics(); + } } @Test |