diff options
author | Oleksandr Moliavko <o.moliavko@samsung.com> | 2019-08-09 10:47:43 +0300 |
---|---|---|
committer | Oleksandr Moliavko <o.moliavko@samsung.com> | 2019-08-09 10:47:43 +0300 |
commit | 4a6c019d7a0c384ea80dec7e7d14a001d7820271 (patch) | |
tree | 07cc7983bfd32adef1e3115b5978f66040d32003 /adapters | |
parent | 3b7a7443e320d6dcf9a034b0ca290598316d8821 (diff) |
Moved null check for outputs so that get() method
call won't result in crash.
Issue-ID: SO-1841
Signed-off-by: Oleksandr Moliavko <o.moliavko@samsung.com>
Change-Id: I23deef70ec7efec22cd31489666341a3b53c9899
Diffstat (limited to 'adapters')
-rw-r--r-- | adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java | 8 |
1 files changed, 4 insertions, 4 deletions
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<String, String> sMap = new HashMap<>(); Map<String, Object> outputs = heatStack.getOutputs(); - neutronId = (String) outputs.get(NETWORK_ID); mode = "HEAT"; - - Map<String, String> 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 { |