Skip to content

Commit 85fe9bb

Browse files
committed
JAVA-1769: Allocate exact buffer size for outgoing requests
1 parent e999158 commit 85fe9bb

3 files changed

Lines changed: 3 additions & 2 deletions

File tree

changelog/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### 4.0.0-alpha4 (in progress)
66

7+
- [improvement] JAVA-1769: Allocate exact buffer size for outgoing requests
78
- [improvement] JAVA-1772: Revisit multi-response callbacks
89
- [new feature] JAVA-1537: Add remaining socket options
910
- [bug] JAVA-1756: Propagate custom payload when preparing a statement

core/src/main/java/com/datastax/oss/driver/internal/core/protocol/ByteBufPrimitiveCodec.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public ByteBufPrimitiveCodec(ByteBufAllocator allocator) {
3535

3636
@Override
3737
public ByteBuf allocate(int size) {
38-
return allocator.ioBuffer();
38+
return allocator.ioBuffer(size, size);
3939
}
4040

4141
@Override

core/src/test/java/com/datastax/oss/driver/internal/core/protocol/ByteBufPrimitiveCodecTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ public void should_fail_to_read_long_string_if_not_enough_characters() {
240240
expectedException.expect(IllegalArgumentException.class);
241241
expectedException.expectMessage(
242242
"Not enough bytes to read an UTF-8 serialized string of size 4");
243-
ByteBuf source = codec.allocate(2);
243+
ByteBuf source = codec.allocate(4);
244244
source.writeInt(4);
245245

246246
codec.readLongString(source);

0 commit comments

Comments
 (0)