Browse Source

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.

See gh-31848
Closes gh-31859
pull/32145/head
Arjen Poutsma 2 years ago
parent
commit
b272f4e615
  1. 2
      spring-core/src/main/java/org/springframework/core/io/buffer/DefaultDataBuffer.java

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

@ -371,7 +371,7 @@ public class DefaultDataBuffer implements DataBuffer { @@ -371,7 +371,7 @@ public class DefaultDataBuffer implements DataBuffer {
.slice();
this.writePosition = Math.max(this.writePosition, index) - index;
this.readPosition = Math.max(this.readPosition, index) - index;
capacity(this.byteBuffer.capacity());
this.capacity = this.byteBuffer.capacity();
return result;
}

Loading…
Cancel
Save