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 9380a0b commit ca03f87Copy full SHA for ca03f87
server/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java
@@ -399,9 +399,12 @@ public Text readOptionalText() throws IOException {
399
public Text readText() throws IOException {
400
// use Text so we can cache the string if it's ever converted to it
401
int length = readInt();
402
- var byteBuffs = BytesReference.toByteBuffers(readBytesReference(length));
403
- assert byteBuffs.length == 1;
404
- return new Text(byteBuffs[0]);
+ byte[] bytes = new byte[length];
+ if (length > 0) {
+ readBytes(bytes, 0, length);
405
+ }
406
+ var byteBuff = ByteBuffer.wrap(bytes);
407
+ return new Text(byteBuff);
408
}
409
410
@Nullable
0 commit comments