Merge "Fixed NPE when RuntimeRpc could not find module in schemaContext."
authorTony Tkacik <ttkacik@cisco.com>
Wed, 8 Apr 2015 09:10:09 +0000 (09:10 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 8 Apr 2015 09:10:10 +0000 (09:10 +0000)
opendaylight/netconf/mdsal-netconf-connector/src/main/java/org/opendaylight/controller/netconf/mdsal/connector/ops/RuntimeRpc.java

index ff7d30d574aaa72e16499db34a3ecf3f80c7a538..a3cd3c7afa48e655e209672daacf564a76171e55 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) {