From 5b3230cbaed6851cffbb5babca30a11f393bdde1 Mon Sep 17 00:00:00 2001 From: Tim Brooks Date: Wed, 6 Dec 2017 20:57:46 -0700 Subject: [PATCH] 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. --- .../java/org/elasticsearch/transport/nio/WriteOperation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/framework/src/main/java/org/elasticsearch/transport/nio/WriteOperation.java b/test/framework/src/main/java/org/elasticsearch/transport/nio/WriteOperation.java index 0abb6a67650..1b2f2cfede4 100644 --- a/test/framework/src/main/java/org/elasticsearch/transport/nio/WriteOperation.java +++ b/test/framework/src/main/java/org/elasticsearch/transport/nio/WriteOperation.java @@ -81,9 +81,9 @@ public class WriteOperation { ByteBuffer[] postIndexBuffers = new ByteBuffer[buffers.length - offsetIndex]; - ByteBuffer firstBuffer = buffers[0].duplicate(); + ByteBuffer firstBuffer = buffers[offsetIndex].duplicate(); firstBuffer.position(internalIndex - offsets[offsetIndex]); - postIndexBuffers[offsetIndex] = firstBuffer; + postIndexBuffers[0] = firstBuffer; int j = 1; for (int i = (offsetIndex + 1); i < buffers.length; ++i) { postIndexBuffers[j++] = buffers[i].duplicate();