Merge "Enhanced List Level flow with backward support"
[so.git] / adapters / mso-openstack-adapters / src / main / java / org / onap / so / adapters / network / MsoNetworkAdapterImpl.java
index d2c0d9c..d9f47f5 100644 (file)
@@ -962,7 +962,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
             if (netInfo != null) {
                 // Found. Populate the output elements
                 networkExists.value = Boolean.TRUE;
-                if ("HEAT".equals(mode)) {
+                if ("HEAT".equals(mode) && heatStack != null) {
                     networkId.value = heatStack.getCanonicalName();
                 } else {
                     networkId.value = netInfo.getId();
@@ -1294,15 +1294,23 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
         // Resource Property
         List<ContrailPolicyRef> prlist = new ArrayList<>();
         int index = 1;
-        for (String pf : pFqdns) {
-            if (!commonUtils.isNullOrEmpty(pf)) {
-                ContrailPolicyRef pr = new ContrailPolicyRef();
-                ContrailPolicyRefSeq refSeq = new ContrailPolicyRefSeq(String.valueOf(index), "0");
-                pr.setSeq(refSeq);
-                index++;
-                logger.debug("Contrail PolicyRefs Data:{}", pr);
-                prlist.add(pr);
+
+        if (pFqdns != null) {
+            for (String pf : pFqdns) {
+                if (!commonUtils.isNullOrEmpty(pf)) {
+                    ContrailPolicyRef pr = new ContrailPolicyRef();
+                    ContrailPolicyRefSeq refSeq = new ContrailPolicyRefSeq(String.valueOf(index), "0");
+                    pr.setSeq(refSeq);
+                    index++;
+                    logger.debug("Contrail PolicyRefs Data:{}", pr);
+                    prlist.add(pr);
+                }
             }
+        } else {
+            String error = "Null pFqdns at start of mergePolicyRefs";
+            logger.error(LoggingAnchor.THREE, MessageEnum.RA_MARSHING_ERROR, ErrorCode.BusinessProcesssError.getValue(),
+                    error);
+            throw new MsoAdapterException(error);
         }
 
         JsonNode node = null;