[MDSAL-174] binding-dom-codec: fix UnionTypeCodec.deserialize() Created: 08/Jun/16  Updated: 09/Mar/18  Resolved: 07/Sep/16

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

Type: Bug
Reporter: Robert Varga Assignee: Robert Varga
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: 6028

 Description   

UnionTypeCodec.deserialize() invokes the default char[] constructor, which requires adaptation to/from String. As evidenced in BUG-6006, this is not enough and the solution to that issue is a bit hacky.

YANG defines the order in which the members should be tried, hence UnionCodec should decode the appropriate member class and invoke the proper constructor for the member – we already have UnionValueOptionContext, which can hold this information.

This has a slight problem in potentially mis-matching types (in case of union of string and binary), hence binding codecs should expose a value-based check if the invocation should even be tried.



 Comments   
Comment by Robert Varga [ 08/Jun/16 ]

Basic patch: https://git.opendaylight.org/gerrit/40056
Skip obviously wrong children: https://git.opendaylight.org/gerrit/40060

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