github-advanced-security[bot] commented on code in PR #15528:
URL: 
https://github.com/apache/dolphinscheduler/pull/15528#discussion_r1469056751


##########
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ExecutorServiceImpl.java:
##########
@@ -552,16 +549,20 @@
         Map<String, Object> result = new HashMap<>();
         TaskGroupQueue taskGroupQueue = 
taskGroupQueueMapper.selectById(queueId);
         // check process instance exist
-        ProcessInstance processInstance = 
processInstanceMapper.selectById(taskGroupQueue.getProcessId());
-        if (processInstance == null) {
-            log.error("Process instance does not exist, projectCode:{}, 
processInstanceId:{}.",
-                    taskGroupQueue.getProjectCode(), 
taskGroupQueue.getProcessId());
-            putMsg(result, Status.PROCESS_INSTANCE_NOT_EXIST, 
taskGroupQueue.getProcessId());
-            return result;
+        ProcessInstance processInstance = 
processInstanceDao.queryOptionalById(taskGroupQueue.getProcessId())
+                .orElseThrow(
+                        () -> new 
ServiceException(Status.PROCESS_INSTANCE_NOT_EXIST, 
taskGroupQueue.getProcessId()));

Review Comment:
   ## Unread local variable
   
   Variable 'ProcessInstance processInstance' is never read.
   
   [Show more 
details](https://github.com/apache/dolphinscheduler/security/code-scanning/3876)



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