github-code-scanning[bot] commented on code in PR #11777:
URL: https://github.com/apache/dolphinscheduler/pull/11777#discussion_r969580725


##########
dolphinscheduler-task-plugin/dolphinscheduler-task-api/src/main/java/org/apache/dolphinscheduler/plugin/task/api/AbstractYarnTask.java:
##########
@@ -106,24 +105,10 @@
      * @return
      * @throws TaskException
      */
-    public Set<String> getApplicationIds() throws TaskException {
+    public List<String> getApplicationIds() throws TaskException {

Review Comment:
   ## Missing Override annotation
   
   This method overrides [AbstractRemoteTask.getApplicationIds](1); it is 
advisable to add an Override annotation.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/1226)



##########
dolphinscheduler-service/src/main/java/org/apache/dolphinscheduler/service/process/ProcessServiceImpl.java:
##########
@@ -1174,7 +1175,8 @@
         // copy parent instance user def params to sub process..
         String parentInstanceId = 
paramMap.get(CMD_PARAM_SUB_PROCESS_PARENT_INSTANCE_ID);
         if (!Strings.isNullOrEmpty(parentInstanceId)) {
-            ProcessInstance parentInstance = 
findProcessInstanceDetailById(Integer.parseInt(parentInstanceId));
+            ProcessInstance parentInstance =
+                    
findProcessInstanceDetailById(Integer.parseInt(parentInstanceId)).orElse(null);

Review Comment:
   ## Missing catch of NumberFormatException
   
   Potential uncaught 'java.lang.NumberFormatException'.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/1229)



##########
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java:
##########
@@ -451,14 +455,18 @@
         ProcessInstance processInstance = getProcessInstance();
         when(projectMapper.queryByCode(projectCode)).thenReturn(project);
         when(projectService.checkProjectAndAuth(loginUser, project, 
projectCode, INSTANCE_UPDATE)).thenReturn(result);
-        when(processService.findProcessInstanceDetailById(1)).thenReturn(null);
-        Map<String, Object> processInstanceNullRes =
-                processInstanceService.updateProcessInstance(loginUser, 
projectCode, 1,
-                        shellJson, taskJson, "2020-02-21 00:00:00", true, "", 
"", 0, "");
-        Assert.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST, 
processInstanceNullRes.get(Constants.STATUS));
+        
when(processService.findProcessInstanceDetailById(1)).thenReturn(Optional.empty());
+        try {
+            Map<String, Object> processInstanceNullRes =
+                    processInstanceService.updateProcessInstance(loginUser, 
projectCode, 1,
+                            shellJson, taskJson, "2020-02-21 00:00:00", true, 
"", "", 0, "");

Review Comment:
   ## Unread local variable
   
   Variable 'Map<String,Object> processInstanceNullRes' is never read.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/1227)



##########
dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessInstanceServiceTest.java:
##########
@@ -523,16 +531,20 @@
         putMsg(result, Status.SUCCESS, projectCode);
         when(projectMapper.queryByCode(projectCode)).thenReturn(project);
         when(projectService.checkProjectAndAuth(loginUser, project, 
projectCode, WORKFLOW_INSTANCE)).thenReturn(result);
-        when(processService.findProcessInstanceDetailById(1)).thenReturn(null);
-        Map<String, Object> processInstanceNullRes =
-                processInstanceService.queryParentInstanceBySubId(loginUser, 
projectCode, 1);
-        Assert.assertEquals(Status.PROCESS_INSTANCE_NOT_EXIST, 
processInstanceNullRes.get(Constants.STATUS));
+        
when(processService.findProcessInstanceDetailById(1)).thenReturn(Optional.empty());
+        try {
+            Map<String, Object> processInstanceNullRes =
+                    
processInstanceService.queryParentInstanceBySubId(loginUser, projectCode, 1);

Review Comment:
   ## Unread local variable
   
   Variable 'Map<String,Object> processInstanceNullRes' is never read.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/1228)



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