From: Ed Warnicke Date: Sun, 26 Jan 2014 06:13:56 +0000 (-0600) Subject: Fixed some exceptions in the Adapters X-Git-Tag: jenkins-controller-bulk-release-prepare-only-2-10~2 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=a7ec3696560e52f84325bc041e2d74f84d032924 Fixed some exceptions in the Adapters Change-Id: Icf4c0802a41bc68026117cff38d080aeea87aef1 Signed-off-by: Ed Warnicke --- diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FlowProgrammerAdapter.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FlowProgrammerAdapter.xtend index 8039156425..f5b876f7c7 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FlowProgrammerAdapter.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/FlowProgrammerAdapter.xtend @@ -141,7 +141,12 @@ class FlowProgrammerAdapter implements IPluginInFlowProgrammerService, SalFlowLi } 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) { diff --git a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend index 6d209f3b17..9b69d44144 100644 --- a/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend +++ b/opendaylight/md-sal/compatibility/sal-compatibility/src/main/java/org/opendaylight/controller/sal/compatibility/InventoryAndReadAdapter.xtend @@ -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; - 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); - 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) { @@ -492,14 +498,16 @@ class InventoryAndReadAdapter implements IPluginInReadService, 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; }