From d2ff22fbc0b3df0f2bfac8deac47afd866078898 Mon Sep 17 00:00:00 2001 From: Flavio Fernandes Date: Wed, 26 Aug 2015 10:46:35 -0400 Subject: [PATCH] Bug 4160 - null pointer exception in getDHCPServerPort() (re-do) null pointer exception in SecurityServicesImpl.getDHCPServerPort() because neutronPortCache.getPort() may return null. It needs null check. NOTE: the order of neutron port creation/deletion via neutron northbound api and ovs port creation/deletion is not deterministic. Either order can happen. SecurityServicesImpl seems to be fixed to be aware of it. it's another story. This patch addresses only null pointer exception for now. This is a redo, to fix a merge mistake introduced in https://git.opendaylight.org/gerrit/#/c/24579/8..9 Original-Change-Id: I40f78b1477f1c2a6ad3e23b2e60e21be6d9abc23 Change-Id: Ib929bf774426d6240934ea406189e25be1ecf536 Co-Authored-By: Isaku Yamahata Signed-off-by: Flavio Fernandes --- .../ovsdb/openstack/netvirt/impl/SecurityServicesImpl.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImpl.java b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImpl.java index 867aa7241f..bc13955c19 100644 --- a/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImpl.java +++ b/openstack/net-virt/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/impl/SecurityServicesImpl.java @@ -251,6 +251,10 @@ public class SecurityServicesImpl implements ConfigInterface, SecurityServicesMa return null; } NeutronPort neutronPort = neutronPortCache.getPort(neutronPortId); + if (neutronPort == null) { + LOG.error("getIpAddress: neutron port of {} is not found", neutronPortId); + return null; + } return neutronPort.getFixedIPs(); } -- 2.36.6