]> source.dussan.org Git - jgit.git/commitdiff
HttpClientTests: Open OutputStream in try-with-resource 72/127972/2
authorDavid Pursehouse <david.pursehouse@gmail.com>
Fri, 24 Aug 2018 02:20:59 +0000 (11:20 +0900)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Sat, 25 Aug 2018 05:16:30 +0000 (14:16 +0900)
Change-Id: Ib690b0af6d562765f43ad54d3855200a17eaa90b
Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
org.eclipse.jgit.http.test/tst/org/eclipse/jgit/http/test/HttpClientTests.java

index ed3860ed65b0c299ee87df9d329e6ae65c273f73..53626b1b2e19c624ed59218dcb4d94963036b150 100644 (file)
@@ -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());