Bug 8831 - Yang 1.1 default values are not checked correctly 70/61170/3
authorPeter Kajsa <pkajsa@cisco.com>
Fri, 4 Aug 2017 13:28:29 +0000 (15:28 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 4 Aug 2017 22:52:30 +0000 (22:52 +0000)
commit6f90351f01d34979e9d22f5e6235b785d8091b14
tree6be8beec00780943988d83e729d92e0b65af9f64
parent8be073a1372e4526ddd843cead10b8fd2468bad9
Bug 8831 - Yang 1.1 default values are not checked correctly

When a leaf has a union type, and a default that does not correspond
to the first member of that union type, the default is not processed
correctly and IllegalStateException is thrown during the check of if-feature
statements. The same bug occurs also in case, when the default is a
number, which is in the range of the first member of the union etc..

Change-Id: Ic3b165eb5c4416dee2216f47c240ce596e3f7dd2
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/TypeUtils.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LeafEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/LeafListEffectiveStatementImpl.java
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/effective/TypeDefEffectiveStatementImpl.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/parser/stmt/rfc7950/Bug6901Test.java
yang/yang-parser-impl/src/test/java/org/opendaylight/yangtools/yang/stmt/Bug8831Test.java [new file with mode: 0644]
yang/yang-parser-impl/src/test/resources/bugs/bug8831/invalid/inv-model.yang [new file with mode: 0644]
yang/yang-parser-impl/src/test/resources/bugs/bug8831/invalid/inv-model2.yang [new file with mode: 0644]
yang/yang-parser-impl/src/test/resources/bugs/bug8831/valid/example-model.yang [new file with mode: 0644]
yang/yang-parser-impl/src/test/resources/bugs/bug8831/valid/example-model2.yang [new file with mode: 0644]