diff options
author | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2022-04-10 21:54:10 -0400 |
---|---|---|
committer | Jozsef Csongvai <jozsef.csongvai@bell.ca> | 2022-04-13 12:39:48 +0000 |
commit | 2a64ad1f5db58eee7148feb71fdcc68b61c0f0eb (patch) | |
tree | ea94d44af4619d7dfa54129a99844190270aaf6e /adapters/mso-openstack-adapters | |
parent | d64070d39ee8608c514e6b1e45f1e1e25480c076 (diff) |
Add nullcheck to HeatbridgeUtils.extractPciIdsFromVserver
It throws a NullPointerException when vserver has no l-interfaces
Issue-ID: SO-3924
Change-Id: I5e4116ead0775dd53b92414b9badfa09fe58779e
Signed-off-by: Jozsef Csongvai <jozsef.csongvai@bell.ca>
(cherry picked from commit 9a6d09acbd38c70329377e2ead31900efe773b27)
Diffstat (limited to 'adapters/mso-openstack-adapters')
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java index c281dbd9e5..17fd99482c 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/utils/HeatBridgeUtils.java @@ -35,6 +35,7 @@ package org.onap.so.heatbridge.utils; import com.google.common.base.Preconditions; import com.google.common.base.Strings; +import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; @@ -71,6 +72,9 @@ public final class HeatBridgeUtils { } public static List<String> extractPciIdsFromVServer(Vserver vserver) { + if (vserver.getLInterfaces() == null) { + return Collections.emptyList(); + } return vserver.getLInterfaces().getLInterface().stream() .filter(lInterface -> lInterface.getSriovVfs() != null && CollectionUtils.isNotEmpty(lInterface.getSriovVfs().getSriovVf())) |