This is an automated email from the ASF dual-hosted git repository.
wuzhiguo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/bigtop-manager.git
The following commit(s) were added to refs/heads/main by this push:
new b11d0db BIGTOP-4159: Reading agent task log encoding garbled bug
fixing (#18)
b11d0db is described below
commit b11d0dba25ec0b14daa3cd8909ec014cde57b1ae
Author: fuxiaofengfu <[email protected]>
AuthorDate: Sat Jul 13 18:07:42 2024 +0800
BIGTOP-4159: Reading agent task log encoding garbled bug fixing (#18)
---
.../apache/bigtop/manager/agent/service/TaskLogServiceGrpcImpl.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git
a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/service/TaskLogServiceGrpcImpl.java
b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/service/TaskLogServiceGrpcImpl.java
index 4585527..018ad0a 100644
---
a/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/service/TaskLogServiceGrpcImpl.java
+++
b/bigtop-manager-agent/src/main/java/org/apache/bigtop/manager/agent/service/TaskLogServiceGrpcImpl.java
@@ -32,6 +32,7 @@ import net.devh.boot.grpc.server.service.GrpcService;
import java.io.File;
import java.io.RandomAccessFile;
+import java.nio.charset.StandardCharsets;
@Slf4j
@GrpcService
@@ -46,6 +47,7 @@ public class TaskLogServiceGrpcImpl extends
TaskLogServiceGrpc.TaskLogServiceImp
while (file.getFilePointer() < fileLength) {
String line = file.readLine();
if (line != null) {
+ line = new
String(line.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8);
responseObserver.onNext(
TaskLogReply.newBuilder().setText(line).build());
}
@@ -76,9 +78,9 @@ public class TaskLogServiceGrpcImpl extends
TaskLogServiceGrpc.TaskLogServiceImp
if (file.readByte() != '\n') {
file.seek(position);
}
-
String line = file.readLine();
while (line != null) {
+ line = new String(line.getBytes(StandardCharsets.ISO_8859_1),
StandardCharsets.UTF_8);
responseObserver.onNext(TaskLogReply.newBuilder().setText(line).build());
line = file.readLine();
}