fix(场景自动化): 查看场景时报空指针异常

This commit is contained in:
shiziyuan9527 2021-03-23 17:03:00 +08:00
parent 0073ed1307
commit 79e11e651a
1 changed files with 7 additions and 3 deletions

View File

@ -114,9 +114,13 @@ public class ApiAutomationService {
Map<String, String> map = d.getEnvironmentMap(); Map<String, String> map = d.getEnvironmentMap();
if (map != null) { if (map != null) {
if (map.isEmpty()) { if (map.isEmpty()) {
List<String> ids = (List<String>) JSONPath.read(definition, "$..projectId"); try {
if (CollectionUtils.isNotEmpty(ids)) { List<String> ids = (List<String>) JSONPath.read(definition, "$..projectId");
idList.addAll(new HashSet<>(ids)); if (CollectionUtils.isNotEmpty(ids)) {
idList.addAll(new HashSet<>(ids));
}
} catch (Exception e) {
LogUtil.error("JSONPath.read projectId fail.");
} }
} else { } else {
Set<String> set = d.getEnvironmentMap().keySet(); Set<String> set = d.getEnvironmentMap().keySet();