Fixed some exceptions in the Adapters 86/4786/2
authorEd Warnicke <eaw@cisco.com>
Sun, 26 Jan 2014 06:13:56 +0000 (00:13 -0600)
committerGerrit Code Review <gerrit@opendaylight.org>
Sun, 26 Jan 2014 06:47:53 +0000 (06:47 +0000)
Change-Id: Icf4c0802a41bc68026117cff38d080aeea87aef1
Signed-off-by: Ed Warnicke <eaw@cisco.com>
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FlowProgrammerAdapter.xtend
opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend

index 80391564258ac72b899d4c7d9879b2bfaf8ec675..f5b876f7c7b51ba9041ec5b6286a9e6ae8f4fb69 100644 (file)
@@ -141,7 +141,12 @@ class FlowProgrammerAdapter implements IPluginInFlowProgrammerService, SalFlowLi
     }
     
     override onFlowRemoved(FlowRemoved notification) {
     }
     
     override onFlowRemoved(FlowRemoved notification) {
-        flowProgrammerPublisher.flowRemoved(notification.node.toADNode,notification.toFlow(notification.node.toADNode));
+        if(notification != null && notification.node != null) {
+            val adNode = notification.node.toADNode
+            if(adNode != null) {
+                flowProgrammerPublisher.flowRemoved(adNode,notification.toFlow(adNode));
+            }
+        } 
     }
     
     override onFlowUpdated(FlowUpdated notification) {
     }
     
     override onFlowUpdated(FlowUpdated notification) {
index 6d209f3b172f5f90b1d075190b4be4fa31fdfb6d..9b69d4414435747059aa045cb6c2654c1ba14604 100644 (file)
@@ -367,7 +367,10 @@ class InventoryAndReadAdapter implements IPluginInReadService,
         
         for (statsPublisher : statisticsPublisher){
                        val nodeRef = InstanceIdentifier.builder(Nodes).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(notification.id)).toInstance;
         
         for (statsPublisher : statisticsPublisher){
                        val nodeRef = InstanceIdentifier.builder(Nodes).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node,new NodeKey(notification.id)).toInstance;
-                       statsPublisher.descriptionStatisticsUpdated(nodeRef.toADNode,toNodeDescription(notification.nodeRef));
+            val description = notification.nodeRef.toNodeDescription
+            if(description != null) {
+                         statsPublisher.descriptionStatisticsUpdated(nodeRef.toADNode,description);
+                       }
                }
     }
 
                }
     }
 
@@ -434,9 +437,12 @@ class InventoryAndReadAdapter implements IPluginInReadService,
 
     private def FlowCapableNode readFlowCapableNode(NodeRef ref) {
         val dataObject = dataService.readOperationalData(ref.value as InstanceIdentifier<? extends DataObject>);
 
     private def FlowCapableNode readFlowCapableNode(NodeRef ref) {
         val dataObject = dataService.readOperationalData(ref.value as InstanceIdentifier<? extends DataObject>);
-        val node = dataObject.checkInstanceOf(
-            org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node);
-        return node.getAugmentation(FlowCapableNode);
+        if(dataObject != null) {
+            val node = dataObject.checkInstanceOf(
+                org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node);
+            return node.getAugmentation(FlowCapableNode);
+        }
+        return null;
     }
 
     private def FlowCapableNodeConnector readFlowCapableNodeConnector(NodeConnectorRef ref) {
     }
 
     private def FlowCapableNodeConnector readFlowCapableNodeConnector(NodeConnectorRef ref) {
@@ -492,14 +498,16 @@ class InventoryAndReadAdapter implements IPluginInReadService,
        
        private def toNodeDescription(NodeRef nodeRef){
                val capableNode = readFlowCapableNode(nodeRef);
        
        private def toNodeDescription(NodeRef nodeRef){
                val capableNode = readFlowCapableNode(nodeRef);
-
-        val it = new NodeDescription()
-        manufacturer = capableNode.manufacturer
-        serialNumber = capableNode.serialNumber
-        software = capableNode.software
-        description = capableNode.description
-        
-        return it;
+        if(capableNode !=null) {
+            val it = new NodeDescription()
+            manufacturer = capableNode.manufacturer
+            serialNumber = capableNode.serialNumber
+            software = capableNode.software
+            description = capableNode.description
+            
+            return it;
+         }
+         return null;
        }
     
     
        }