From 616a4dd89a17312193044b59370c9f03df93762c Mon Sep 17 00:00:00 2001 From: Lukasz Rajewski Date: Tue, 26 May 2020 10:02:57 +0200 Subject: Fix for NPE in Heatbridge Null is checked for network type which can be unknown. Issue-ID: SO-2953 Signed-off-by: Lukasz Rajewski Change-Id: Iccf724eed5ec7d69b70eabbcf25bfafe1e8fe12b (cherry picked from commit 7c35f6dd4fd4b227f063036280a7f24728a198d8) --- .../src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java index a00b9f9002..bbabd7fab8 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java @@ -338,7 +338,7 @@ public class HeatBridgeImpl implements HeatBridgeApi { private void updateLInterfaceVlan(final Port port, final LInterface lIf) { Vlan vlan = new Vlan(); Network network = osClient.getNetworkById(port.getNetworkId()); - if (network.getNetworkType().equals(NetworkType.VLAN)) { + if (network.getNetworkType() != null && network.getNetworkType().equals(NetworkType.VLAN)) { vlan.setVlanInterface(network.getName() + network.getProviderSegID()); vlan.setVlanIdOuter(Long.parseLong(network.getProviderSegID())); @@ -352,7 +352,7 @@ public class HeatBridgeImpl implements HeatBridgeApi { lIf.setVlans(vlans); } // Build sriov-vf to the l-interface - if (port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) { + if (port.getvNicType() != null && port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) { SriovVfs sriovVfs = new SriovVfs(); // JAXB does not generate setters for list, however getter ensures its creation. // Thus, all list manipulations must be made on live list. -- cgit 1.2.3-korg