From 4a6c019d7a0c384ea80dec7e7d14a001d7820271 Mon Sep 17 00:00:00 2001 From: Oleksandr Moliavko Date: Fri, 9 Aug 2019 10:47:43 +0300 Subject: Moved null check for outputs so that get() method call won't result in crash. Issue-ID: SO-1841 Signed-off-by: Oleksandr Moliavko Change-Id: I23deef70ec7efec22cd31489666341a3b53c9899 --- .../java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'adapters/mso-openstack-adapters/src/main') diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java index c934291246..64f1b215d4 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java @@ -914,7 +914,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Use MsoNeutronUtils for all NEUTRON commands String mode; - String neutronId; + String neutronId = null; // Try Heat first, since networks may be named the same as the Heat stack StackInfo heatStack = null; long queryStackStarttime = System.currentTimeMillis(); @@ -930,12 +930,12 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter { // Populate the outputs based on the returned Stack information if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) { // Found it. Get the neutronNetworkId for further query + Map sMap = new HashMap<>(); Map outputs = heatStack.getOutputs(); - neutronId = (String) outputs.get(NETWORK_ID); mode = "HEAT"; - - Map sMap = new HashMap<>(); if (outputs != null) { + neutronId = (String) outputs.get(NETWORK_ID); + for (String key : outputs.keySet()) { if (key != null && key.startsWith("subnet_id_")) // multiples subnet_%aaid% outputs { -- cgit 1.2.3-korg