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 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) {
 
     //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) {
     }
 
     private Optional<RpcDefinition> getRpcDefinitionFromModule(Module module, URI namespaceURI, String name) {