ResourceHttpRequestHandler explicitly closes a Resource's InputStream

Issue: SPR-11644
(cherry picked from commit 3a96f16)
This commit is contained in:
Juergen Hoeller
2014-04-02 20:54:12 +02:00
parent b80dc9d642
commit f93bfa8f84

View File

@@ -249,7 +249,17 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
* @throws IOException in case of errors while writing the content
*/
protected void writeContent(HttpServletResponse response, Resource resource) throws IOException {
StreamUtils.copy(resource.getInputStream(), response.getOutputStream());
InputStream in = resource.getInputStream();
try {
StreamUtils.copy(in, response.getOutputStream());
}
finally {
try {
in.close();
}
catch (IOException ex) {
}
}
}