Bug 5315 - NPE while creating Neutron Router w/o interface attached to it 47/34447/1
authorAbhinav Gupta <abhinav.gupta@ericsson.com>
Thu, 11 Feb 2016 09:30:03 +0000 (15:00 +0530)
committerAbhinav Gupta <abhinav.gupta@ericsson.com>
Thu, 11 Feb 2016 09:34:53 +0000 (09:34 +0000)
Fixes NPE while creating Neutron Router without any interface
(subnet) attached to it.
Also removes a redundant null check

Change-Id: I9490d673c25771036ec93e19b9e9dee50bd53115
Signed-off-by: Abhinav Gupta <abhinav.gupta@ericsson.com>
neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/vpnservice/neutronvpn/NeutronPortChangeListener.java
neutronvpn/neutronvpn-impl/src/main/java/org/opendaylight/vpnservice/neutronvpn/NeutronvpnUtils.java

index e88b1be08748c2b1f31dc323e2433eedd9423078..9a14c570bf505181b97c7c29dff8633dddf8ad07 100644 (file)
@@ -268,7 +268,7 @@ public class NeutronPortChangeListener extends AbstractDataChangeListener<Port>
 
             subnetId = ip.getSubnetId();
             Subnetmap subnetmap = nvpnManager.updateSubnetNode(subnetId, null, null, null, null, null, port.getUuid());
-            if (vpnId == null && subnetmap != null) {
+            if (subnetmap != null) {
                 vpnId = subnetmap.getVpnId();
             }
         }
index d7adab8b6ba177c21eeff4e82cc76534f2d901b0..b23120e4508aa645fb2e1b5994f5cec75b1cce0d 100644 (file)
@@ -220,7 +220,7 @@ public class NeutronvpnUtils {
         if (router != null) {
             List<org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers.router
                     .Interfaces> interfacesList = router.getInterfaces();
-            if (!interfacesList.isEmpty()) {
+            if (interfacesList != null) {
                 for (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.l3.rev150712.routers.attributes.routers
                         .router.Interfaces interfaces : interfacesList) {
                     subnetIdList.add(interfaces.getSubnetId());