From e1fcd4e485531677fbbe203e107873e00b8c63c6 Mon Sep 17 00:00:00 2001 From: sunsongyang <707509803@qq.com> Date: Wed, 17 Jan 2024 22:03:33 +0800 Subject: [PATCH] [Bug][Api] Fix NPE when deleting a workflow instance (#15485) (#15488) --- .../api/service/impl/TaskInstanceServiceImpl.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java index 330374779f..d3426dfa3e 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/TaskInstanceServiceImpl.java @@ -379,9 +379,12 @@ public class TaskInstanceServiceImpl extends BaseServiceImpl implements TaskInst return; } for (TaskInstance taskInstance : needToDeleteTaskInstances) { - ILogService iLogService = - SingletonJdkDynamicRpcClientProxyFactory.getProxyClient(taskInstance.getHost(), ILogService.class); - iLogService.removeTaskInstanceLog(taskInstance.getLogPath()); + if (StringUtils.isNotBlank(taskInstance.getLogPath())) { + ILogService iLogService = + SingletonJdkDynamicRpcClientProxyFactory.getProxyClient(taskInstance.getHost(), + ILogService.class); + iLogService.removeTaskInstanceLog(taskInstance.getLogPath()); + } } dqExecuteResultDao.deleteByWorkflowInstanceId(workflowInstanceId);