From 54e110d17b2558c05ed896d383897ff7e9fdfdea Mon Sep 17 00:00:00 2001 From: Hxssssss Date: Fri, 15 Jan 2021 10:32:16 +0800 Subject: [PATCH] =?UTF-8?q?fix=20the=20exception=20of=20update=20null=20po?= =?UTF-8?q?int=20of=20workflow=20instance=20due=20to=20no=E2=80=A6=20(#445?= =?UTF-8?q?9)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix the exception of update null point of workflow instance due to not add global parameter when create workflow definition * optimization of the leading package Co-authored-by: yaoshui --- .../dolphinscheduler/api/service/ProcessInstanceService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java index 739fa19735..3f55fae66f 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/ProcessInstanceService.java @@ -66,11 +66,13 @@ import java.io.InputStreamReader; import java.nio.charset.StandardCharsets; import java.text.ParseException; import java.util.ArrayList; +import java.util.Collections; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.Optional; import java.util.stream.Collectors; import org.slf4j.Logger; @@ -449,7 +451,7 @@ public class ProcessInstanceService extends BaseService { originDefParams = JSONUtils.toJsonString(processData.getGlobalParams()); List globalParamList = processData.getGlobalParams(); - Map globalParamMap = globalParamList.stream().collect(Collectors.toMap(Property::getProp, Property::getValue)); + Map globalParamMap = Optional.ofNullable(globalParamList).orElse(Collections.emptyList()).stream().collect(Collectors.toMap(Property::getProp, Property::getValue)); globalParams = ParameterUtils.curingGlobalParams(globalParamMap, globalParamList, processInstance.getCmdTypeIfComplement(), schedule); timeout = processData.getTimeout();