diff options
author | Munir Ahmad <munir.ahmad@bell.ca> | 2020-04-13 19:04:48 -0400 |
---|---|---|
committer | Munir Ahmad <munir.ahmad@bell.ca> | 2020-04-13 19:04:48 -0400 |
commit | a8e7c090c351fd5531e09724fcab8a419773cec7 (patch) | |
tree | 507b74e2c79583c5785f4015a1423b02b895bd5c /adapters | |
parent | 39315bf63770c66718e629d268c4f67183bcf17b (diff) |
Check for null when building pserver objects from op server obj
Issue-ID: SO-2802
Signed-off-by: Munir Ahmad <munir.ahmad@bell.ca>
Change-Id: Idc7d2a4a831ece6347f5d6bc837a476bfa0b2d27
Diffstat (limited to 'adapters')
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java | 12 |
1 files changed, 9 insertions, 3 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 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; } |