protected Long getContentLength(Resource resource, MediaType contentType) throws IOException {
if (InputStreamResource.class == resource.getClass()) {
return null;
}
long contentLength = resource.contentLength();
<BUG>if (contentLength > Integer.MAX_VALUE) {
throw new IOException("Resource content too long (beyond Integer.MAX_VALUE): " + resource);
}</BUG>
return (contentLength < 0 ? null : contentLength);
}

protected Long getContentLength(Resource resource, MediaType contentType) throws IOException {
if (InputStreamResource.class == resource.getClass()) {
return null;
}
long contentLength = resource.contentLength();
return (contentLength < 0 ? null : contentLength);
}
