Fix NPE in FlowProgrammerService in openflow plugin 20/2920/1
authorAlessandro Boch <aboch@cisco.com>
Wed, 20 Nov 2013 16:23:50 +0000 (08:23 -0800)
committerAlessandro Boch <aboch@cisco.com>
Wed, 20 Nov 2013 16:28:21 +0000 (08:28 -0800)
- In default container have installed flows matching on input port.
  When creating the first container, default container flows are removed.
  On switch notification about flow removal, a NPE is hit in FlowProgrammerService
  because of the assumption the newly created container already has ports assigned.

Change-Id: I645684f9bc47ea26d1fe9f45383343354fb3df6a
Signed-off-by: Alessandro Boch <aboch@cisco.com>
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/FlowProgrammerService.java

index b163c639a5c53d507988958ef04afc0b1d1d540f..f26bcf718c75216078d4b7f37f16d19603ec20bf 100644 (file)
@@ -415,7 +415,7 @@ public class FlowProgrammerService implements IPluginInFlowProgrammerService,
              */
             if (inPort == null
                     || container.equals(GlobalConstants.DEFAULT.toString())
              */
             if (inPort == null
                     || container.equals(GlobalConstants.DEFAULT.toString())
-                    || this.containerToNc.get(container).contains(inPort)) {
+                    || (containerToNc.containsKey(container) && containerToNc.get(container).contains(inPort))) {
                 notifier.flowRemoved(node, flow);
             }
         }
                 notifier.flowRemoved(node, flow);
             }
         }