Skip to content

Commit

Permalink
BIGTOP-4159: Reading agent task log encoding garbled bug fixing (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxiaofengfu authored Jul 13, 2024
1 parent 388c265 commit b11d0db
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

import java.io.File;
import java.io.RandomAccessFile;
import java.nio.charset.StandardCharsets;

@Slf4j
@GrpcService
Expand All @@ -46,6 +47,7 @@ public void getLog(TaskLogRequest request, StreamObserver<TaskLogReply> response
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());
}
Expand Down Expand Up @@ -76,9 +78,9 @@ private void readNewLogs(RandomAccessFile file, StreamObserver<TaskLogReply> res
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();
}
Expand Down

0 comments on commit b11d0db

Please sign in to comment.