diff --git a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/FileSender.java b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/FileSender.java index 91e749e04..0d935fc98 100644 --- a/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/FileSender.java +++ b/org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/FileSender.java @@ -137,8 +137,7 @@ final class FileSender { rsp.setHeader(HDR_CONTENT_LENGTH, Long.toString(end - pos)); if (sendBody) { - final OutputStream out = rsp.getOutputStream(); - try { + try (OutputStream out = rsp.getOutputStream()) { final byte[] buf = new byte[4096]; source.seek(pos); while (pos < end) { @@ -151,8 +150,6 @@ final class FileSender { pos += n; } out.flush(); - } finally { - out.close(); } } }