From a8e7c090c351fd5531e09724fcab8a419773cec7 Mon Sep 17 00:00:00 2001 From: Munir Ahmad Date: Mon, 13 Apr 2020 19:04:48 -0400 Subject: Check for null when building pserver objects from op server obj Issue-ID: SO-2802 Signed-off-by: Munir Ahmad Change-Id: Idc7d2a4a831ece6347f5d6bc837a476bfa0b2d27 --- .../main/java/org/onap/so/heatbridge/helpers/AaiHelper.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'adapters/mso-openstack-adapters/src/main/java/org/onap') 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 c578b29664..adcde92917 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 @@ -148,10 +148,16 @@ public class AaiHelper { public Pserver buildPserver(final Server server) { Pserver pserver = new Pserver(); pserver.setInMaint(false); - pserver.setPserverId(server.getId()); pserver.setHostname(server.getHypervisorHostname()); - pserver.setPserverName2(server.getHost()); - pserver.setProvStatus(server.getStatus().value()); + if (server.getId() != null) { + pserver.setPserverId(server.getId()); + } + if (server.getHost() != null) { + pserver.setPserverName2(server.getHost()); + } + if (server.getStatus() != null && server.getStatus().value() != null) { + pserver.setProvStatus(server.getStatus().value()); + } return pserver; } -- cgit 1.2.3-korg