[YANGTOOLS-983] Extensions nested in enums cause a failure to assemble SchemaContext Created: 15/Apr/19 Updated: 30/Apr/19 Resolved: 30/Apr/19 |
|
| Status: | Resolved |
| Project: | yangtools |
| Component/s: | parser |
| Affects Version/s: | None |
| Fix Version/s: | 3.0.1 |
| Type: | Bug | Priority: | High |
| Reporter: | Robert Varga | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
The following construct:
leaf pc-speed {
tailf:alt-name "speed";
tailf:info "Configure speed operation.";
description "Configure speed operation.";
type enumeration {
enum "10" {
tailf:info "Force 10 Mbps operation";
}
enum "100" {
tailf:info "Force 100 Mbps operation";
}
enum "1000" {
tailf:info "Enable AUTO speed configuration";
}
enum "nonegotiate" {
//FIXME
}
enum "auto" {
tailf:info "Enable AUTO speed configuration";
}
}
}
causes a failure to assemble: 07:57:59 Caused by: java.lang.IllegalArgumentException: String '10' is not a valid identifier 07:57:59 at com.google.common.base.Preconditions.checkArgument (Preconditions.java:217) 07:57:59 at org.opendaylight.yangtools.yang.common.AbstractQName.checkLocalName (AbstractQName.java:69) 07:57:59 at org.opendaylight.yangtools.yang.common.QName.create (QName.java:125) 07:57:59 at org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils.internedQName (StmtContextUtils.java:576) 07:57:59 at org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils.qnameFromArgument (StmtContextUtils.java:499) 07:57:59 at org.opendaylight.yangtools.yang.parser.stmt.reactor.SubstatementContext.createSchemaPath (SubstatementContext.java:154) 07:57:59 at org.opendaylight.yangtools.yang.parser.stmt.reactor.SubstatementContext.getSchemaPath (SubstatementContext.java:176) 07:57:59 at org.opendaylight.yangtools.yang.parser.rfc7950.stmt.extension.UnrecognizedEffectiveStatementImpl.<init> (UnrecognizedEffectiveStatementImpl.java:49) 07:57:59 at org.opendaylight.yangtools.yang.parser.rfc7950.stmt.extension.UnrecognizedStatementSupport.createEffective (UnrecognizedStatementSupport.java:41) 07:57:59 at org.opendaylight.yangtools.yang.parser.rfc7950.stmt.extension.ModelDefinedStatementSupport.createEffective (ModelDefinedStatementSupport.java:42) 07:57:59 at org.opendaylight.yangtools.yang.parser.stmt.reactor.StatementContextBase.buildEffective (StatementContextBase.java:485) This is cause by the assumption that each statement has to have a SchemaPath, which is composed of QNames. This used to work as long as QName allowed non-identifiers to be present in localName, but was fragile anyway – in this particular case it was allowed, but the same thing would have happened if the enum argument would have any of forbidden characters in it. |