We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 87afc97 commit ae8aa86Copy full SHA for ae8aa86
server/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java
@@ -391,9 +391,12 @@ public Text readOptionalText() throws IOException {
391
if (length == -1) {
392
return null;
393
}
394
- var byteBuffs = BytesReference.toByteBuffers(readBytesReference(length));
395
- assert byteBuffs.length == 1;
396
- return new Text(byteBuffs[0]);
+ byte[] bytes = new byte[length];
+ if (length > 0) {
+ readBytes(bytes, 0, length);
397
+ }
398
+ var byteBuff = ByteBuffer.wrap(bytes);
399
+ return new Text(byteBuff);
400
401
402
public Text readText() throws IOException {
0 commit comments