Fixed NPE when RuntimeRpc could not find module in schemaContext. 40/17840/1
authorTomas Cere <tcere@cisco.com>
Tue, 7 Apr 2015 13:15:58 +0000 (15:15 +0200)
committerTomas Cere <tcere@cisco.com>
Tue, 7 Apr 2015 13:27:54 +0000 (15:27 +0200)
Change-Id: I40c72d413f23753e95fd5f0bb42cc78046a6494f
Signed-off-by: Tomas Cere <tcere@cisco.com>
opendaylight/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/controller/netconf/mdsal/connector/ops/RuntimeRpc.java

index ff7d30d..a3cd3c7 100644 (file)
@@ -110,7 +110,7 @@ public class RuntimeRpc extends AbstractSingletonNetconfOperation {
 
     //this returns module with the newest revision if more then 1 module with same namespace is found
     private Optional<Module> getModule(final URI namespaceURI) {
-        return Optional.of(schemaContext.getCurrentContext().findModuleByNamespaceAndRevision(namespaceURI, null));
+        return Optional.fromNullable(schemaContext.getCurrentContext().findModuleByNamespaceAndRevision(namespaceURI, null));
     }
 
     private Optional<RpcDefinition> getRpcDefinitionFromModule(Module module, URI namespaceURI, String name) {

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.