Details
-
Bug
-
Status: Resolved
-
Resolution: Done
-
None
-
None
-
None
-
None
-
Operating System: All
Platform: All
-
7064
Description
yang-to-sources runs into issues for the following sample YANG file:
module acme {
yang-version 1;
namespace "urn:acme:simple:test";
prefix acme;
organization "acme";
revision "2016-10-31";
container acme {
leaf route-distinguisher {
description
"<ip-addr:comm-val>|<2byte-asnumber:ext-comm-val>|<4byte-asnummber:comm-
val>";
type string
{ length "1..21"; } } //route-distinguisher
} // container
} // module
Following issue is reported:
[ERROR] yang-to-sources: Unable to generate sources with org.opendaylight.yangtools.maven.sal.api.gen.plugin.CodeGeneratorImpl generator
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.AbstractStringBuilder.charAt(AbstractStringBuilder.java:237)
at java.lang.StringBuilder.charAt(StringBuilder.java:76)
at org.opendaylight.yangtools.sal.java.api.generator.BaseTemplate.formatToParagraph(BaseTemplate.java:562)
at org.opendaylight.yangtools.sal.java.api.generator.BaseTemplate.formatDataForJavaDoc(BaseTemplate.java:464)
Using PYANG this YANG file is processed/validated without any issues.
The issue is related to the description string. When removing parts from the description, file can be processed without problems:
leaf route-distinguisher {
description
"<ip-addr:comm-val>|<2byte-asnumber:ext-comm-val>";