diff --git a/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java b/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java index 0ecbf6c9bd..808cdf2323 100644 --- a/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java +++ b/backend/src/main/java/io/metersphere/api/service/ApiScenarioModuleService.java @@ -581,7 +581,7 @@ public class ApiScenarioModuleService extends NodeTreeService nameModuleMap = null; Map repeatDataMap = null; if (chooseModule != null) { - if (!repeatApiScenarioWithBLOBs.isEmpty()) { + if (!CollectionUtils.isEmpty(repeatApiScenarioWithBLOBs)) { String chooseModuleParentId = getChooseModuleParentId(chooseModule); String chooseModulePath = getChooseModulePath(idPathMap, chooseModule, chooseModuleParentId); nameModuleMap = optionData.stream().collect(Collectors.toMap(t -> t.getName() + chooseModulePath, scenario -> scenario)); @@ -608,7 +608,7 @@ public class ApiScenarioModuleService extends NodeTreeService repeatMap = repeatApiScenarioWithBLOBs.stream().collect(Collectors.toMap(t -> t.getName() + t.getModulePath(), scenario -> scenario)); Map optionMap = optionData.stream().collect(Collectors.toMap(t -> t.getName() + t.getModulePath(), scenario -> scenario)); if (fullCoverage) { @@ -786,7 +786,6 @@ public class ApiScenarioModuleService extends NodeTreeService idPathMap, ApiScenarioModuleDTO chooseModule, String chooseModuleParentId) { @@ -867,9 +865,12 @@ public class ApiScenarioModuleService extends NodeTreeService collect = parentModuleList.stream().filter(t -> t.getName().equals(tagTree[finalI])).collect(Collectors.toList()); + List collect = null; + if (!CollectionUtils.isEmpty(parentModuleList)) { + collect = parentModuleList.stream().filter(t -> t.getName().equals(tagTree[finalI])).collect(Collectors.toList()); + } - if (collect.isEmpty()) { + if (CollectionUtils.isEmpty(collect)) { if (i == 0) { //证明需要在根目录创建, parentModule = new ApiScenarioModule(); @@ -877,7 +878,7 @@ public class ApiScenarioModuleService extends NodeTreeService