- InputStream fileInputStream = new FileInputStream(new File(filesystemPath, filename));
- if (fileInputStream == null) {
- return response.setStatusCode(404).setStatusText("Not found.");
- }
- OutputStream contentOutputStream = response.getContent();
- try {
+ try (InputStream fileInputStream = new FileInputStream(new File(filesystemPath, filename));
+ OutputStream contentOutputStream = response.getContent()) {