From: David Pursehouse Date: Fri, 24 Aug 2018 02:20:59 +0000 (+0900) Subject: HttpClientTests: Open OutputStream in try-with-resource X-Git-Tag: v5.1.0.201808281540-m3~12 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3151bc33ea0b48eb222aebac1164f69105cc4b22;p=jgit.git HttpClientTests: Open OutputStream in try-with-resource Change-Id: Ib690b0af6d562765f43ad54d3855200a17eaa90b Signed-off-by: David Pursehouse --- diff --git a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java index ed3860ed65..53626b1b2e 100644 --- a/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java +++ b/org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java @@ -419,12 +419,12 @@ public class HttpClientTests extends HttpTestCase { // properly. Tests for other commands go in // UploadPackTest.java. - OutputStream os = c.getOutputStream(); - PacketLineOut pckOut = new PacketLineOut(os); - pckOut.writeString("command=ls-refs"); - pckOut.writeDelim(); - pckOut.end(); - os.close(); + try (OutputStream os = c.getOutputStream()) { + PacketLineOut pckOut = new PacketLineOut(os); + pckOut.writeString("command=ls-refs"); + pckOut.writeDelim(); + pckOut.end(); + } PacketLineIn pckIn = new PacketLineIn(c.getInputStream());