aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.lfs.server
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 17:15:04 +0900
committerDavid Pursehouse <david.pursehouse@gmail.com>2018-03-06 17:15:04 +0900
commit03536cc2d04f66e2167e4e9d068aa515c4286ff0 (patch)
treed8ad2483ff95cd51efb5818a073b51dc2071a3c3 /org.eclipse.jgit.lfs.server
parent336add10c125bfc987ad20269147c30da4a86d7d (diff)
downloadjgit-03536cc2d04f66e2167e4e9d068aa515c4286ff0.tar.gz
jgit-03536cc2d04f66e2167e4e9d068aa515c4286ff0.zip
FileLfsServlet: Open PrintWriter in try-with-resource
Change-Id: I6fa225e541c6d5c3dbf3d852a502f4e9c4f7d77e Signed-off-by: David Pursehouse <david.pursehouse@gmail.com>
Diffstat (limited to 'org.eclipse.jgit.lfs.server')
-rw-r--r--org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java
index 018102f793..36dc7606b4 100644
--- a/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java
+++ b/org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java
@@ -178,10 +178,10 @@ public class FileLfsServlet extends HttpServlet {
protected static void sendError(HttpServletResponse rsp, int status, String message)
throws IOException {
rsp.setStatus(status);
- PrintWriter writer = rsp.getWriter();
- LfsGson.toJson(message, writer);
- writer.flush();
- writer.close();
+ try (PrintWriter writer = rsp.getWriter()) {
+ LfsGson.toJson(message, writer);
+ writer.flush();
+ }
rsp.flushBuffer();
}
}