Use try-with-resources statements
- instead of finally blocks - in cases of missing try-finally Change-Id: I94f481a33d8e6a3180c436245d6e95e4d525280c
This commit is contained in:
@@ -319,11 +319,8 @@ class LoginForm extends HttpServlet {
|
||||
res.setContentType("text/html");
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
res.setContentLength(bin.length);
|
||||
ServletOutputStream out = res.getOutputStream();
|
||||
try {
|
||||
try (ServletOutputStream out = res.getOutputStream()) {
|
||||
out.write(bin);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,11 +63,8 @@ class XrdsServlet extends HttpServlet {
|
||||
rsp.setContentType("application/xrds+xml");
|
||||
rsp.setCharacterEncoding(ENC);
|
||||
|
||||
final ServletOutputStream out = rsp.getOutputStream();
|
||||
try {
|
||||
try (ServletOutputStream out = rsp.getOutputStream()) {
|
||||
out.write(raw);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user