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

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


The following commit(s) were added to refs/heads/dev by this push:
     new f6f29f4  Replace Charset.forName("UTF-8") with StandardCharsets.UTF_8. 
(#2193)
f6f29f4 is described below

commit f6f29f4abb9f8034441a05ea4b7f85eef4f9f100
Author: t1mon <[email protected]>
AuthorDate: Mon Mar 16 17:10:55 2020 +0800

    Replace Charset.forName("UTF-8") with StandardCharsets.UTF_8. (#2193)
---
 .../apache/dolphinscheduler/api/service/ProcessInstanceService.java  | 5 +++--
 .../java/org/apache/dolphinscheduler/remote/utils/Constants.java     | 3 ++-
 .../java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java  | 4 ++--
 .../apache/dolphinscheduler/server/worker/task/datax/DataxTask.java  | 4 ++--
 4 files changed, 9 insertions(+), 7 deletions(-)

diff --git 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
index 4f81d89..3530c66 100644
--- 
a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
+++ 
b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java
@@ -16,6 +16,7 @@
  */
 package org.apache.dolphinscheduler.api.service;
 
+import java.nio.charset.StandardCharsets;
 import org.apache.dolphinscheduler.api.dto.gantt.GanttDto;
 import org.apache.dolphinscheduler.api.dto.gantt.Task;
 import org.apache.dolphinscheduler.api.enums.Status;
@@ -49,7 +50,6 @@ import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
-import java.nio.charset.Charset;
 import java.text.ParseException;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -273,7 +273,8 @@ public class ProcessInstanceService extends BaseDAGService {
             return resultMap;
         }
 
-        BufferedReader br = new BufferedReader(new InputStreamReader(new 
ByteArrayInputStream(log.getBytes(Charset.forName("utf8"))), 
Charset.forName("utf8")));
+        BufferedReader br = new BufferedReader(new InputStreamReader(new 
ByteArrayInputStream(log.getBytes(
+            StandardCharsets.UTF_8)), StandardCharsets.UTF_8));
         String line;
         while ((line = br.readLine()) != null) {
             if(line.contains(DEPENDENT_SPLIT)){
diff --git 
a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/Constants.java
 
b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/Constants.java
index 5733b17..f479171 100644
--- 
a/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/Constants.java
+++ 
b/dolphinscheduler-remote/src/main/java/org/apache/dolphinscheduler/remote/utils/Constants.java
@@ -17,6 +17,7 @@
 package org.apache.dolphinscheduler.remote.utils;
 
 import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 
 
 /**
@@ -31,7 +32,7 @@ public class Constants {
     /**
      *  charset
      */
-    public static final Charset UTF8 = Charset.forName("UTF-8");
+    public static final Charset UTF8 = StandardCharsets.UTF_8;
 
     /**
      *  cpus
diff --git 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
index e0c00c5..f3f8a79 100644
--- 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
+++ 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/utils/ProcessUtils.java
@@ -16,6 +16,7 @@
  */
 package org.apache.dolphinscheduler.server.utils;
 
+import java.nio.charset.StandardCharsets;
 import org.apache.dolphinscheduler.common.Constants;
 import org.apache.dolphinscheduler.common.utils.CommonUtils;
 import org.apache.dolphinscheduler.common.utils.LoggerUtils;
@@ -29,7 +30,6 @@ import org.slf4j.LoggerFactory;
 
 import java.io.File;
 import java.io.IOException;
-import java.nio.charset.Charset;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.regex.Matcher;
@@ -297,7 +297,7 @@ public class ProcessUtils {
         File f = new File(commandFile);
 
         if (!f.exists()) {
-          FileUtils.writeStringToFile(new File(commandFile), sb.toString(), 
Charset.forName("UTF-8"));
+          FileUtils.writeStringToFile(new File(commandFile), sb.toString(), 
StandardCharsets.UTF_8);
         }
 
         String runCmd = "sh " + commandFile;
diff --git 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java
 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java
index 7537ca2..952030e 100755
--- 
a/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java
+++ 
b/dolphinscheduler-server/src/main/java/org/apache/dolphinscheduler/server/worker/task/datax/DataxTask.java
@@ -18,7 +18,7 @@ package org.apache.dolphinscheduler.server.worker.task.datax;
 
 
 import java.io.File;
-import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardOpenOption;
@@ -209,7 +209,7 @@ public class DataxTask extends AbstractTask {
         logger.debug("datax job json : {}", root.toString());
 
         // create datax json file
-        FileUtils.writeStringToFile(new File(fileName), root.toString(), 
Charset.forName("UTF-8"));
+        FileUtils.writeStringToFile(new File(fileName), root.toString(), 
StandardCharsets.UTF_8);
         return fileName;
     }
 

Reply via email to