Skip to content

Commit e8a1c5a

Browse files
committed
Fix issue where the incorrect buffers are written (#27695)
This is a followup to #27551. That commit introduced a bug where the incorrect byte buffers would be returned when we attempted a write. This commit fixes the logic.
1 parent 5223651 commit e8a1c5a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/framework/src/main/java/org/elasticsearch/transport/nio/WriteOperation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ private ByteBuffer[] getBuffersToWrite() {
8181

8282
ByteBuffer[] postIndexBuffers = new ByteBuffer[buffers.length - offsetIndex];
8383

84-
ByteBuffer firstBuffer = buffers[0].duplicate();
84+
ByteBuffer firstBuffer = buffers[offsetIndex].duplicate();
8585
firstBuffer.position(internalIndex - offsets[offsetIndex]);
86-
postIndexBuffers[offsetIndex] = firstBuffer;
86+
postIndexBuffers[0] = firstBuffer;
8787
int j = 1;
8888
for (int i = (offsetIndex + 1); i < buffers.length; ++i) {
8989
postIndexBuffers[j++] = buffers[i].duplicate();

0 commit comments

Comments
 (0)