Revert "[debugger] avoid using writeUTF, it does not work for long strings"

We have to be compatible with the previous format
This reverts commit 9242ed91f50c3f1ce5c449b03755e9982d95805a.

GitOrigin-RevId: effbe96b8adff9e39ba73eb274066360fa8df694
This commit is contained in:
Egor Ushakov
2025-06-30 19:02:08 +00:00
committed by intellij-monorepo-bot
parent 5747b6d20a
commit aa074c986a
2 changed files with 3 additions and 10 deletions
@@ -106,9 +106,7 @@ class BatchEvaluator private constructor() {
var count = 0
while (dis.available() > 0) {
val error = dis.readBoolean()
val data = ByteArray(dis.readInt())
dis.readFully(data)
val message = String(data, Charsets.UTF_8)
val message = dis.readUTF()
if (count >= requests.size) {
LOG.error("Invalid number of results: required " + requests.size + ", reply = " + bytes.contentToString())
return false
@@ -1,4 +1,4 @@
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
/*
* @author Eugene Zhuravlev
@@ -8,7 +8,6 @@ package com.intellij.rt.debugger;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@SuppressWarnings("unused")
public final class BatchEvaluatorServer {
@@ -34,11 +33,7 @@ public final class BatchEvaluatorServer {
}
dos.writeBoolean(error);
// do not use writeUTF as it supports only 65535 symbols
// dos.writeUTF(res);
byte[] stringBytes = res.getBytes(StandardCharsets.UTF_8);
dos.writeInt(stringBytes.length);
dos.write(stringBytes);
dos.writeUTF(res);
}
return bas.toString("ISO-8859-1");
}