Browse Source

Fixed generateETagHeaderValue's IOException handling

Issue: SPR-12081
pull/869/head
Juergen Hoeller 9 years ago
parent
commit
eeab7f38a2
  1. 11
      spring-web/src/main/java/org/springframework/web/filter/ShallowEtagHeaderFilter.java

11
spring-web/src/main/java/org/springframework/web/filter/ShallowEtagHeaderFilter.java

@ -163,14 +163,9 @@ public class ShallowEtagHeaderFilter extends OncePerRequestFilter { @@ -163,14 +163,9 @@ public class ShallowEtagHeaderFilter extends OncePerRequestFilter {
* @return the ETag header value
* @see org.springframework.util.DigestUtils
*/
protected String generateETagHeaderValue(InputStream inputStream) {
protected String generateETagHeaderValue(InputStream inputStream) throws IOException {
StringBuilder builder = new StringBuilder("\"0");
try {
DigestUtils.appendMd5DigestAsHex(inputStream, builder);
}
catch (IOException e) {
throw new RuntimeException(e);
}
DigestUtils.appendMd5DigestAsHex(inputStream, builder);
builder.append('"');
return builder.toString();
}
@ -184,7 +179,7 @@ public class ShallowEtagHeaderFilter extends OncePerRequestFilter { @@ -184,7 +179,7 @@ public class ShallowEtagHeaderFilter extends OncePerRequestFilter {
* @since 4.2
*/
public static void disableContentCaching(ServletRequest request) {
Assert.notNull(request);
Assert.notNull(request, "ServletRequest must not be null");
request.setAttribute(STREAMING_ATTRIBUTE, true);
}

Loading…
Cancel
Save