You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by ke...@apache.org on 2022/02/14 05:37:57 UTC

[dolphinscheduler] branch dev updated: [Bug-8067][LogServer] fix improper use of StringBuilder (#8365)

This is an automated email from the ASF dual-hosted git repository.

kerwin pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new b9406d3  [Bug-8067][LogServer] fix improper use of StringBuilder (#8365)
b9406d3 is described below

commit b9406d356cd20fdb96d2fe0eeac327c346eaf1c5
Author: 弘树丶 <ho...@gmail.com>
AuthorDate: Mon Feb 14 13:37:47 2022 +0800

    [Bug-8067][LogServer] fix improper use of StringBuilder (#8365)
    
    fix code format and fix spelling errors
---
 .../dolphinscheduler/server/log/LoggerRequestProcessor.java   | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java b/dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
index 6e85b21..9c720c5 100644
--- a/dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
+++ b/dolphinscheduler-log-server/src/main/java/org/apache/dolphinscheduler/server/log/LoggerRequestProcessor.java
@@ -70,9 +70,7 @@ public class LoggerRequestProcessor implements NettyRequestProcessor {
     public void process(Channel channel, Command command) {
         logger.info("received command : {}", command);
 
-        /**
-         * reuqest task log command type
-         */
+        //request task log command type
         final CommandType commandType = command.getType();
         switch (commandType) {
             case GET_LOG_BYTES_REQUEST:
@@ -96,7 +94,7 @@ public class LoggerRequestProcessor implements NettyRequestProcessor {
                         rollViewLogRequest.getSkipLineNum(), rollViewLogRequest.getLimit());
                 StringBuilder builder = new StringBuilder();
                 for (String line : lines) {
-                    builder.append(line + "\r\n");
+                    builder.append(line).append("\r\n");
                 }
                 RollViewLogResponseCommand rollViewLogRequestResponse = new RollViewLogResponseCommand(builder.toString());
                 channel.writeAndFlush(rollViewLogRequestResponse.convert2Command(command.getOpaque()));
@@ -108,7 +106,7 @@ public class LoggerRequestProcessor implements NettyRequestProcessor {
                 String taskLogPath = removeTaskLogRequest.getPath();
 
                 File taskLogFile = new File(taskLogPath);
-                Boolean status = true;
+                boolean status = true;
                 try {
                     if (taskLogFile.exists()) {
                         status = taskLogFile.delete();
@@ -130,11 +128,10 @@ public class LoggerRequestProcessor implements NettyRequestProcessor {
     }
 
     /**
-     * get files content bytes,for down load file
+     * get files content bytes for download file
      *
      * @param filePath file path
      * @return byte array of file
-     * @throws Exception exception
      */
     private byte[] getFileContentBytes(String filePath) {
         try (InputStream in = new FileInputStream(filePath);