diff options
author | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-06 17:15:04 +0900 |
---|---|---|
committer | David Pursehouse <david.pursehouse@gmail.com> | 2018-03-06 17:15:04 +0900 |
commit | 03536cc2d04f66e2167e4e9d068aa515c4286ff0 (patch) | |
tree | d8ad2483ff95cd51efb5818a073b51dc2071a3c3 /org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs | |
parent | 336add10c125bfc987ad20269147c30da4a86d7d (diff) | |
download | jgit-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/src/org/eclipse/jgit/lfs')
-rw-r--r-- | org.eclipse.jgit.lfs.server/src/org/eclipse/jgit/lfs/server/fs/FileLfsServlet.java | 8 |
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(); } } |