Skip to content

Commit 1ff683b

Browse files
committed
Correctly set capacity of remainder in DefaultDataBuffer::split
This commit ensures that the capacity of the remainder buffer after a split operation is set directly on the field. Calling capacity(int) caused a new buffer to be allocated. Closes gh-31848
1 parent 22bf4df commit 1ff683b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-core/src/main/java/org/springframework/core/io/buffer/DefaultDataBuffer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ public DataBuffer split(int index) {
371371
.slice();
372372
this.writePosition = Math.max(this.writePosition, index) - index;
373373
this.readPosition = Math.max(this.readPosition, index) - index;
374-
capacity(this.byteBuffer.capacity());
374+
this.capacity = this.byteBuffer.capacity();
375375

376376
return result;
377377
}

0 commit comments

Comments
 (0)