changed contentLength() from int to long

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@3550 50f2f4bb-b051-0410-bef5-90022cba6387
This commit is contained in:
Juergen Hoeller
2010-08-09 15:58:07 +00:00
parent 1e389ddcc7
commit 385b21fc27
4 changed files with 9 additions and 5 deletions
@@ -148,7 +148,11 @@ public class ResourceHttpRequestHandler extends WebContentGenerator implements H
if (mediaType != null) {
response.setContentType(mediaType.toString());
}
response.setContentLength(resource.contentLength());
long length = resource.contentLength();
if (length > Integer.MAX_VALUE) {
throw new IOException("Resource content too long (beyond Integer.MAX_VALUE): " + resource);
}
response.setContentLength((int) length);
FileCopyUtils.copy(resource.getInputStream(), response.getOutputStream());
}