Skip to content

Commit ca03f87

Browse files
committed
Fix CI
1 parent 9380a0b commit ca03f87

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

server/src/main/java/org/elasticsearch/common/io/stream/StreamInput.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -399,9 +399,12 @@ public Text readOptionalText() throws IOException {
399399
public Text readText() throws IOException {
400400
// use Text so we can cache the string if it's ever converted to it
401401
int length = readInt();
402-
var byteBuffs = BytesReference.toByteBuffers(readBytesReference(length));
403-
assert byteBuffs.length == 1;
404-
return new Text(byteBuffs[0]);
402+
byte[] bytes = new byte[length];
403+
if (length > 0) {
404+
readBytes(bytes, 0, length);
405+
}
406+
var byteBuff = ByteBuffer.wrap(bytes);
407+
return new Text(byteBuff);
405408
}
406409

407410
@Nullable

0 commit comments

Comments
 (0)