When we encounter an empyt YangInstanceIdentifier (for
example during listener registration), we cannot extract
a module name -- fallback to unknown, which will cause
us to talk to the default shard.
Change-Id: I2162884c5ce0d2c2f714bb66afd82f699c52d789
Signed-off-by: Robert Varga <rovarga@cisco.com>
}
private String getModuleName(final YangInstanceIdentifier path) {
+ if (path.isEmpty()) {
+ return UNKNOWN_MODULE_NAME;
+ }
+
String namespace = path.getPathArguments().iterator().next().getNodeType().getNamespace().toASCIIString();
String moduleName = configuration.getModuleNameFromNameSpace(namespace);
return moduleName != null ? moduleName : UNKNOWN_MODULE_NAME;