Browse Source

Restored capacity check before trying output stream resize

Issue: SPR-13671
pull/913/merge
Juergen Hoeller 9 years ago
parent
commit
43d72e2079
  1. 12
      spring-web/src/main/java/org/springframework/web/util/ContentCachingResponseWrapper.java

12
spring-web/src/main/java/org/springframework/web/util/ContentCachingResponseWrapper.java

@ -123,7 +123,9 @@ public class ContentCachingResponseWrapper extends HttpServletResponseWrapper { @@ -123,7 +123,9 @@ public class ContentCachingResponseWrapper extends HttpServletResponseWrapper {
@Override
public void setContentLength(int len) {
this.content.resize(len);
if (len > this.content.size()) {
this.content.resize(len);
}
this.contentLength = len;
}
@ -134,13 +136,17 @@ public class ContentCachingResponseWrapper extends HttpServletResponseWrapper { @@ -134,13 +136,17 @@ public class ContentCachingResponseWrapper extends HttpServletResponseWrapper {
Integer.MAX_VALUE + "): " + len);
}
int lenInt = (int) len;
this.content.resize(lenInt);
if (lenInt > this.content.size()) {
this.content.resize(lenInt);
}
this.contentLength = lenInt;
}
@Override
public void setBufferSize(int size) {
this.content.resize(size);
if (size > this.content.size()) {
this.content.resize(size);
}
}
@Override

Loading…
Cancel
Save