NullPointer Protected while plan is empty.
authorYuanHu <yuan.hu1@zte.com.cn>
Tue, 6 Sep 2016 03:09:48 +0000 (11:09 +0800)
committerYuanHu <yuan.hu1@zte.com.cn>
Tue, 6 Sep 2016 03:09:48 +0000 (11:09 +0800)
Change-Id: I124e06b671fea5305c617483c64547e91c2fe212
Signed-off-by: YuanHu <yuan.hu1@zte.com.cn>
catalog-core/catalog-mgr/src/main/java/org/openo/commontosca/catalog/model/parser/yaml/entity/ParseYamlResult.java

index 5075f48..e64a6ab 100644 (file)
@@ -153,7 +153,10 @@ public class ParseYamlResult {
   }\r
 \r
   private List<Plan> jsonObject2PlanList(JsonObject plans) {\r
-    List<Plan> retList = new ArrayList<Plan>();\r
+    if (plans == null) {\r
+      return new ArrayList<>();\r
+    }\r
+    List<Plan> retList = new ArrayList<>();\r
     Iterator<Entry<String, JsonElement>> iterator = plans.entrySet().iterator();\r
     while (iterator.hasNext()) {\r
       Plan ret = new Plan();\r