+ final ModuleImport imp = moduleBuilder.getImport(prefix);
+ if (imp == null) {
+ LOG.debug("Error in module {} at line {}: No import found with prefix {}", moduleName, line, prefix);
+ throw new YangParseException(moduleName, line, "Error in module " + moduleName
+ + " No import found with prefix " + prefix + " not found.");
+ }
+ Date revision = imp.getRevision();
+ final NavigableMap<Date, URI> namespaces = namespaceContext.get(imp.getModuleName());
+ if (namespaces == null) {
+ throw new YangParseException(moduleName, line, String.format("Imported module %s not found",
+ imp.getModuleName()));
+ }
+ URI namespace;
+ if (revision == null) {
+ revision = namespaces.lastEntry().getKey();
+ namespace = namespaces.lastEntry().getValue();
+ } else {
+ // FIXME: this lookup does not look right, as we will end up
+ // with
+ // a qname which does not have a namespace. At any rate we
+ // should arrive at a QNameModule!
+ namespace = namespaces.get(revision);
+ }
+
+ final QNameModule mod = QNameModule.create(namespace, revision).intern();
+ qname = QName.create(mod, name);