summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.http.server/src
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 17:19:07 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 17:19:07 +0900
commit07341b2947f92f26c660a013bfb0ff0a5d5e2ecf (patch)
tree807d2be80577814b2beaf1291881112a9e47cbb7 /org.eclipse.jgit.http.server/src
parentd1356bf2380761c0f3926b86aa54812b384b0168 (diff)
downloadjgit-07341b2947f92f26c660a013bfb0ff0a5d5e2ecf.tar.gz
jgit-07341b2947f92f26c660a013bfb0ff0a5d5e2ecf.zip
FileSender: Open OutputStream in try-with-resource
Change-Id: I2278950998dffc2b5730a91a5bb3bcc38f4d446b Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.http.server/src')
-rw-r--r--org.eclipse.jgit.http.server/src/org/eclipse/jgit/http/server/FileSender.java5
1 files changed, 1 insertions, 4 deletions
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 91e749e046..0d935fc98b 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();
}
}
}