port of:
https://git.opendaylight.org/gerrit/#/c/33904/2
Change-Id: Ib5e4f3d01a710e1a8e4f11bb01ba26f643d88ab0
Signed-off-by: Tomas Cere <tcere@cisco.com>
try {
//returns module with newest revision since findModuleByNamespace returns a set of modules and we only need the newest one
final Module module = schemaContext.getCurrentContext().findModuleByNamespaceAndRevision(new URI(namespace), null);
+ if (module == null) {
+ // no module is present with this namespace
+ throw new NetconfDocumentedException("Unable to find module by namespace: " + namespace,
+ ErrorType.application, ErrorTag.unknown_namespace, ErrorSeverity.error);
+ }
DataSchemaNode schemaNode = module.getDataChildByName(element.getName());
if (schemaNode != null) {
dataSchemaNode = Optional.of(module.getDataChildByName(element.getName()));