summaryrefslogtreecommitdiffstats
path: root/adapters/mso-openstack-adapters
diff options
context:
space:
mode:
authorLukasz Muszkieta <lukasz.muszkieta@nokia.com>2019-09-30 13:16:12 +0000
committerGerrit Code Review <gerrit@onap.org>2019-09-30 13:16:12 +0000
commitc599aaba3cf6c205fd1bb2f8641b01b31695ec98 (patch)
tree556b47b859e832a61a50cac811962933675eee24 /adapters/mso-openstack-adapters
parent3b007e23e4acca0405db0fd18f05195d49c4f988 (diff)
parent7b4bca3cb2f1c21cb2a927305bafea261cdf0769 (diff)
Merge "Added null check to server.getImage() to prevent crash at getId() call."
Diffstat (limited to 'adapters/mso-openstack-adapters')
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java12
1 files changed, 7 insertions, 5 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index 137aaa9f41..d8a876016f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -84,11 +84,13 @@ public class AaiHelper {
relationships.add(vfModuleRelationship);
// vserver to image relationship
- Relationship imageRel = buildRelationship(HeatBridgeConstants.AAI_IMAGE,
- ImmutableMap.<String, String>builder().put(HeatBridgeConstants.AAI_CLOUD_OWNER, cloudOwner)
- .put(HeatBridgeConstants.AAI_CLOUD_REGION_ID, cloudRegionId)
- .put(HeatBridgeConstants.AAI_IMAGE_ID, server.getImage().getId()).build());
- relationships.add(imageRel);
+ if (server.getImage() != null) {
+ Relationship imageRel = buildRelationship(HeatBridgeConstants.AAI_IMAGE,
+ ImmutableMap.<String, String>builder().put(HeatBridgeConstants.AAI_CLOUD_OWNER, cloudOwner)
+ .put(HeatBridgeConstants.AAI_CLOUD_REGION_ID, cloudRegionId)
+ .put(HeatBridgeConstants.AAI_IMAGE_ID, server.getImage().getId()).build());
+ relationships.add(imageRel);
+ }
// vserver to flavor relationship
Relationship flavorRel = buildRelationship(HeatBridgeConstants.AAI_FLAVOR,