diff options
author | Oleksandr Moliavko <o.moliavko@samsung.com> | 2019-09-13 14:51:09 +0300 |
---|---|---|
committer | Oleksandr Moliavko <o.moliavko@samsung.com> | 2019-09-26 02:59:29 +0000 |
commit | 7b4bca3cb2f1c21cb2a927305bafea261cdf0769 (patch) | |
tree | 32314148f26dbdf00b08f38b0942e3af7d7cfc10 /adapters/mso-openstack-adapters/src/main/java/org | |
parent | d99d0a3ef409b634ce257bbf5ecb783c0e4ebff8 (diff) |
Added null check to server.getImage() to prevent
crash at getId() call.
Issue-ID: SO-1841
Signed-off-by: Oleksandr Moliavko <o.moliavko@samsung.com>
Change-Id: I6ecaf66649e9df971003268b7272f677c5394083
Diffstat (limited to 'adapters/mso-openstack-adapters/src/main/java/org')
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java | 12 |
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, |