WangJPLeo commented on code in PR #12056:
URL: https://github.com/apache/dolphinscheduler/pull/12056#discussion_r974847073


##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java:
##########
@@ -967,7 +967,7 @@ private Boolean checkCmdParam(Command command, Map<String, 
String> cmdParam) {
         if (processInstance.getCommandParam() != null) {
             Map<String, String> processCmdParam = 
JSONUtils.toMap(processInstance.getCommandParam());
             processCmdParam.forEach((key, value) -> {
-                if (!cmdParam.containsKey(key)) {
+                if (cmdParam != null && !cmdParam.containsKey(key)) {

Review Comment:
   You can extend a toMap method with `orDefault` parameter in `JSONUtils` to 
return an `empty Map,`  replacement with null judgment.



##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java:
##########
@@ -1133,15 +1141,18 @@ private void initComplementDataParam(ProcessDefinition 
processDefinition,
             return;
         }
 
-        Date start = 
DateUtils.stringToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE));
-        Date end = 
DateUtils.stringToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_END_DATE));
+        Date start = null, end = null;
+        if (cmdParam != null) {
+            start = 
DateUtils.stringToDate(cmdParam.get(CMDPARAM_COMPLEMENT_DATA_START_DATE));

Review Comment:
   It would be better to add a `CMDPARAM_COMPLEMENT_DATA_START_DATE` key 
existence judgment.



##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java:
##########
@@ -1016,15 +1020,19 @@ private Boolean checkCmdParam(Command command, 
Map<String, String> cmdParam) {
                 break;
             case RECOVER_SUSPENDED_PROCESS:
                 // find pause tasks and init task's state
-                
cmdParam.remove(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING);
+                if (cmdParam != null) {
+                    
cmdParam.remove(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING);
+                }
                 List<Integer> stopNodeList = 
findTaskIdByInstanceState(processInstance.getId(),
                         TaskExecutionStatus.KILL);
                 for (Integer taskId : stopNodeList) {
                     // initialize the pause state
                     initTaskInstance(this.findTaskInstanceById(taskId));
                 }
-                cmdParam.put(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING,
+                if (cmdParam != null) {
+                    
cmdParam.put(Constants.CMD_PARAM_RECOVERY_START_NODE_STRING,
                         String.join(",", 
convertIntListToString(stopNodeList)));

Review Comment:
   ```suggestion
                           String.join(Constants.COMMA, 
convertIntListToString(stopNodeList)));
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to