diff --git a/escheduler-api/src/main/java/cn/escheduler/api/service/ProcessDefinitionService.java b/escheduler-api/src/main/java/cn/escheduler/api/service/ProcessDefinitionService.java index 7b20f516db..45ff487f5e 100644 --- a/escheduler-api/src/main/java/cn/escheduler/api/service/ProcessDefinitionService.java +++ b/escheduler-api/src/main/java/cn/escheduler/api/service/ProcessDefinitionService.java @@ -293,12 +293,12 @@ public class ProcessDefinitionService extends BaseDAGService { processDefine.setTimeout(processData.getTimeout()); //custom global params - List globalParamsList = processData.getGlobalParams(); - if (globalParamsList != null && globalParamsList.size() > 0) { - Set userDefParamsSet = new HashSet<>(globalParamsList); + List globalParamsList = new ArrayList<>(); + if (processData.getGlobalParams() != null && processData.getGlobalParams().size() > 0) { + Set userDefParamsSet = new HashSet<>(processData.getGlobalParams()); globalParamsList = new ArrayList<>(userDefParamsSet); - processDefine.setGlobalParamList(globalParamsList); } + processDefine.setGlobalParamList(globalParamsList); processDefine.setUpdateTime(now); processDefine.setFlag(Flag.YES); if (processDefineMapper.update(processDefine) > 0) { diff --git a/escheduler-common/src/main/java/cn/escheduler/common/utils/JSONUtils.java b/escheduler-common/src/main/java/cn/escheduler/common/utils/JSONUtils.java index 6efef083ea..9dad6ac542 100644 --- a/escheduler-common/src/main/java/cn/escheduler/common/utils/JSONUtils.java +++ b/escheduler-common/src/main/java/cn/escheduler/common/utils/JSONUtils.java @@ -27,10 +27,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.TimeZone; +import java.util.*; /** * json utils @@ -109,7 +106,7 @@ public class JSONUtils { */ public static List toList(String json, Class clazz) { if (StringUtils.isEmpty(json)) { - return null; + return new ArrayList<>(); } try { return JSONArray.parseArray(json, clazz); @@ -117,7 +114,7 @@ public class JSONUtils { logger.error("JSONArray.parseArray exception!",e); } - return null; + return new ArrayList<>(); }