diff options
author | YuanHu <yuan.hu1@zte.com.cn> | 2016-09-06 11:09:48 +0800 |
---|---|---|
committer | YuanHu <yuan.hu1@zte.com.cn> | 2016-09-06 11:09:48 +0800 |
commit | fdd9882d31ca618a2e1e1e8dc3f09c11b2097642 (patch) | |
tree | b59219c480bdb50257837973d8dc889df83ddd41 | |
parent | d5599134eeb8fd0a10b041ff56ef2a2d68d76bce (diff) |
NullPointer Protected while plan is empty.
Change-Id: I124e06b671fea5305c617483c64547e91c2fe212
Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
-rw-r--r-- | catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/entity/ParseYamlResult.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/entity/ParseYamlResult.java b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/entity/ParseYamlResult.java index 5075f485..e64a6abb 100644 --- a/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/entity/ParseYamlResult.java +++ b/catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/entity/ParseYamlResult.java @@ -153,7 +153,10 @@ public class ParseYamlResult { }
private List<Plan> jsonObject2PlanList(JsonObject plans) {
- List<Plan> retList = new ArrayList<Plan>();
+ if (plans == null) {
+ return new ArrayList<>();
+ }
+ List<Plan> retList = new ArrayList<>();
Iterator<Entry<String, JsonElement>> iterator = plans.entrySet().iterator();
while (iterator.hasNext()) {
Plan ret = new Plan();
|