[MDSAL-204] yang-to-source error on description Created: 31/Oct/16  Updated: 09/Mar/18  Resolved: 07/Nov/16

Status: Resolved
Project: mdsal
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Sven Wisotzky Assignee: Martin Ciglan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


External issue ID: 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>";



 Comments   
Comment by Martin Ciglan [ 02/Nov/16 ]

moving to yangtools, looks like lexer issue

Comment by Peter Kajsa [ 03/Nov/16 ]

We tested the attached model and it is not a lexer issue. The problem occurs in BaseTemplate by generation of javadoc, hence moved back to md-sal.

Comment by Martin Ciglan [ 07/Nov/16 ]

fix pushed:

https://git.opendaylight.org/gerrit/#/c/48055

should be cherry-picked to Boron eventually

Comment by Martin Ciglan [ 07/Nov/16 ]

stable/boron:

https://git.opendaylight.org/gerrit/#/c/48058

Generated at Wed Feb 07 20:09:01 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.