aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2019-07-18 20:40:57 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-18 20:40:57 +0000
commit2be5b56ac756f30e543d9272d31f8d56b2a07328 (patch)
treeeaef59332336920e4f6bfe8c53e0ce7e2f0f0dea
parent86a85de638889f587e6eed1b6888998c4d8dc6ad (diff)
parent83c91e61a7dd84394c8df763915ed09d97fcb407 (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
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java2
2 files changed, 17 insertions, 9 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;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
index b76316bf0e..b2dbd97bfc 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExtractPojosForBB.java
@@ -60,7 +60,7 @@ public class ExtractPojosForBB {
if (gBBInput.getCustomer().getServiceSubscription() == null
&& gBBInput.getServiceInstance() != null) {
result = Optional.of((T) gBBInput.getServiceInstance());
- } else {
+ } else if (gBBInput.getCustomer().getServiceSubscription() != null) {
result = lookupObjectInList(
gBBInput.getCustomer().getServiceSubscription().getServiceInstances(), value);
}