Skip to content

Commit 0dbb0f5

Browse files
committed
Merge pull request #31731 from kilink
* pr/31731: Avoid byte array copy in getContentAsString Closes gh-31731
2 parents 6ea9fdb + e452c2e commit 0dbb0f5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-web/src/main/java/org/springframework/web/util/ContentCachingRequestWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ public byte[] getContentAsByteArray() {
205205
* @see #getContentAsByteArray()
206206
*/
207207
public String getContentAsString() {
208-
return new String(this.cachedContent.toByteArray(), Charset.forName(getCharacterEncoding()));
208+
return new String(this.cachedContent.toByteArrayUnsafe(), Charset.forName(getCharacterEncoding()));
209209
}
210210

211211
/**

0 commit comments

Comments
 (0)