zhuangchong commented on a change in pull request #3746:
URL: 
https://github.com/apache/incubator-dolphinscheduler/pull/3746#discussion_r489302105



##########
File path: 
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/TaskParametersUtils.java
##########
@@ -55,41 +55,42 @@ private TaskParametersUtils() {
      * @return task parameters
      */
     public static AbstractParameters getParameters(String taskType, String 
parameter) {
-        try {
-            switch (EnumUtils.getEnum(TaskType.class, taskType)) {
-                case SUB_PROCESS:
-                    return JSONUtils.parseObject(parameter, 
SubProcessParameters.class);
-                case SHELL:
-                case WATERDROP:
-                    return JSONUtils.parseObject(parameter, 
ShellParameters.class);
-                case PROCEDURE:
-                    return JSONUtils.parseObject(parameter, 
ProcedureParameters.class);
-                case SQL:
-                    return JSONUtils.parseObject(parameter, 
SqlParameters.class);
-                case MR:
-                    return JSONUtils.parseObject(parameter, 
MapreduceParameters.class);
-                case SPARK:
-                    return JSONUtils.parseObject(parameter, 
SparkParameters.class);
-                case PYTHON:
-                    return JSONUtils.parseObject(parameter, 
PythonParameters.class);
-                case DEPENDENT:
-                    return JSONUtils.parseObject(parameter, 
DependentParameters.class);
-                case FLINK:
-                    return JSONUtils.parseObject(parameter, 
FlinkParameters.class);
-                case HTTP:
-                    return JSONUtils.parseObject(parameter, 
HttpParameters.class);
-                case DATAX:
-                    return JSONUtils.parseObject(parameter, 
DataxParameters.class);
-                case CONDITIONS:
-                    return JSONUtils.parseObject(parameter, 
ConditionsParameters.class);
-                case SQOOP:
-                    return JSONUtils.parseObject(parameter, 
SqoopParameters.class);
-                default:
-                    return null;
-            }
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
+        TaskType anEnum = EnumUtils.getEnum(TaskType.class, taskType);
+        if (anEnum == null) {
+            logger.error("not support task type: {}", taskType);
+            return null;

Review comment:
       This method is called by multiple methods in the project, which has a 
big impact. It still returns null according to the original logic of the 
method. This time, we mainly deal with the switch null pointer problem.
   
   ---
   这个方法被项目里面多个方法调用,影响大,还是按方法原逻辑返回null,本次主要处理switch 空指针问题。




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to