diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java index 472cfa0f7f..e86ea8301e 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/ProcessDefinitionServiceImpl.java @@ -243,6 +243,9 @@ public class ProcessDefinitionServiceImpl extends BaseService implements for (TaskNode taskNode : tasks) { String taskParameter = taskNode.getParams(); AbstractParameters params = TaskParametersUtils.getParameters(taskNode.getType(), taskParameter); + if (params == null) { + continue; + } if (CollectionUtils.isNotEmpty(params.getResourceFilesList())) { Set tempSet = params.getResourceFilesList(). stream() diff --git a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java index eb71cc87e7..55d7b09173 100644 --- a/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java +++ b/dolphinscheduler-api/src/test/java/org/apache/dolphinscheduler/api/service/ProcessDefinitionServiceTest.java @@ -1035,15 +1035,15 @@ public class ProcessDefinitionServiceTest { taskNode5.setType("SHELL"); ShellParameters shellParameters5 = new ShellParameters(); ResourceInfo resourceInfo5A = new ResourceInfo(); - resourceInfo5A.setId(0); + resourceInfo5A.setId(1); ResourceInfo resourceInfo5B = new ResourceInfo(); - resourceInfo5B.setId(1); + resourceInfo5B.setId(2); shellParameters5.setResourceList(Arrays.asList(resourceInfo5A, resourceInfo5B)); taskNode5.setParams(JSONUtils.toJsonString(shellParameters5)); input5.setTasks(Collections.singletonList(taskNode5)); String output5 = (String) testMethod.invoke(processDefinitionService, input5); assertThat(output5.split(",")).hasSize(2) - .containsExactlyInAnyOrder("0", "1"); + .containsExactlyInAnyOrder("1", "2"); // when resource id list is 0 1 1 2, then return 0,1,2 ProcessData input6 = new ProcessData(); @@ -1051,7 +1051,7 @@ public class ProcessDefinitionServiceTest { taskNode6.setType("SHELL"); ShellParameters shellParameters6 = new ShellParameters(); ResourceInfo resourceInfo6A = new ResourceInfo(); - resourceInfo6A.setId(0); + resourceInfo6A.setId(3); ResourceInfo resourceInfo6B = new ResourceInfo(); resourceInfo6B.setId(1); ResourceInfo resourceInfo6C = new ResourceInfo(); @@ -1065,7 +1065,7 @@ public class ProcessDefinitionServiceTest { String output6 = (String) testMethod.invoke(processDefinitionService, input6); assertThat(output6.split(",")).hasSize(3) - .containsExactlyInAnyOrder("0", "1", "2"); + .containsExactlyInAnyOrder("3", "1", "2"); } /**