[MDSAL-355] IdentifiableItemCodec should ignore case when sorting keys Created: 22/Jun/18 Updated: 09/Oct/18 Resolved: 09/Oct/18 |
|
| Status: | Resolved |
| Project: | mdsal |
| Component/s: | Binding runtime |
| Affects Version/s: | None |
| Fix Version/s: | Fluorine SR1, Oxygen SR4, 3.0.1 |
| Type: | Bug | Priority: | Medium |
| Reporter: | Huafei Zhang | Assignee: | Robert Varga |
| Resolution: | Done | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Input parameter sequence of constructor of generated type or builder follows alphabetical and case-insensitive order, which differs with IdentifiableItemCodec expectation.
IdentifiableItemCodec.java: (q1, q2) -> q1.getLocalName().compareTo*IgnoreCase*(q2.getLocalName()
ClassTempate.xtend: Collections.sort(sorted, [p1, p2|
BuilderTemplate.xtend «Collections.sort(keyProps,
|
| Comments |
| Comment by Robert Varga [ 22/Jun/18 ] |
|
Key properties names are not QName.localNames. Is there a testcase which does currently work? |
| Comment by Huafei Zhang [ 26/Jun/18 ] |
|
It's hard to provide an existing test case. We found this issue in our controller application.
list OspfStatLsdbBrief {
key "AreaIndex LsaType LsId AdvRtr";
leaf AreaIndex { type int32; description "Area Index"; }
leaf LsaType { type uint8; description "LSA Type"; }
leaf LsId { type int32; description "LSA ID"; }
leaf AdvRtr { type string; description "Advertised Router"; }
}
when decode a list entry accessing YangInstanceIdentifier by calling method "InstanceIdentifier<?> fromYangInstanceIdentifier(@Nonnull YangInstanceIdentifier dom)" of service
an java.lang.ClassCastException thrown: ----------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------- This is because the constructor parameter from instance identifier is injected with wrong order. Fixing code of either xxtemplate.xtend or IdentifiableItemCodec will work. |
| Comment by Robert Varga [ 04/Oct/18 ] |
|
I see – the problem is that "LsId" and "LsaType" compare differently. This usually does not happen, as standard models usually end up using capitalization from the use of dashes, which is what the comparison was designed to overcome. Alas the shortcut does not work, as we really need to enlist binding-generator types and use them to establish the order arguments. |
| Comment by Robert Varga [ 04/Oct/18 ] |
|
zhfinder does https://git.opendaylight.org/gerrit/76650 fix the issue for you? |