diff options
author | Steve Smokowski <ss835w@att.com> | 2019-07-18 20:40:57 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-07-18 20:40:57 +0000 |
commit | 2be5b56ac756f30e543d9272d31f8d56b2a07328 (patch) | |
tree | eaef59332336920e4f6bfe8c53e0ce7e2f0f0dea /adapters/mso-openstack-adapters/src/main/java | |
parent | 86a85de638889f587e6eed1b6888998c4d8dc6ad (diff) | |
parent | 83c91e61a7dd84394c8df763915ed09d97fcb407 (diff) |
Merge changes I5e72e1c6,I5e1cb624
* changes:
Added null check for function param pFqdns to prevent crash at for loop.
Added check for null ptr before dereferencing at gBBInput.getCustomer().getServiceSubscription() - to prevent static analyzer warning
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java')
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index 5dff4705af..d9f47f5c3a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -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; |