The StatementDefinition for openconfig-version extension is
not bound to any revision. When populating the ExtensionNamespace
with openconfig-version, we have to store it with a revisionless
QName key. This way we can properly extract the corresponding
ExtensionDefinition later down the road in the
UnknownEffectiveStatementBase.
This issue causes NPE in MDSAL's binding generator v2.
Change-Id: Ie24c09b56986c87b5118d715ec6c8e755cf07ebe
Signed-off-by: Igor Foltin <igor.foltin@pantheon.tech>
public void onStatementDefinitionDeclared(final StmtContext.Mutable<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> stmt) {
super.onStatementDefinitionDeclared(stmt);
public void onStatementDefinitionDeclared(final StmtContext.Mutable<QName, ExtensionStatement, EffectiveStatement<QName, ExtensionStatement>> stmt) {
super.onStatementDefinitionDeclared(stmt);
- stmt.addContext(ExtensionNamespace.class, stmt.getStatementArgument(), stmt);
+ QName stmtName = stmt.getStatementArgument();
+ if (SupportedExtensionsMapping.OPENCONFIG_VERSION.getStatementName().isEqualWithoutRevision(stmtName)) {
+ stmtName = stmtName.withoutRevision();
+ }
+
+ stmt.addContext(ExtensionNamespace.class, stmtName, stmt);
final StmtContext<QName, ?, ?> argument = StmtContextUtils.findFirstDeclaredSubstatement(stmt,
ArgumentStatement.class);
final StmtContext<QName, ?, ?> argument = StmtContextUtils.findFirstDeclaredSubstatement(stmt,
ArgumentStatement.class);