From 3151bc33ea0b48eb222aebac1164f69105cc4b22 Mon Sep 17 00:00:00 2001 From: David Pursehouse Date: Fri, 24 Aug 2018 11:20:59 +0900 Subject: [PATCH] HttpClientTests: Open OutputStream in try-with-resource Change-Id: Ib690b0af6d562765f43ad54d3855200a17eaa90b Signed-off-by: David Pursehouse --- .../org/eclipse/jgit/http/test/HttpClientTests.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) 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()); -- 2.39.5