Restored capacity check before trying output stream resize

Issue: SPR-13671
This commit is contained in:
Juergen Hoeller 2015-11-12 00:47:33 +01:00
parent e707347474
commit 43d72e2079
1 changed files with 9 additions and 3 deletions

View File

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