Do not fallback to toString() in UnionStringCodec

Description

UnionStringCodec does the wrong thing when it encounters a type which is not handled by TypeDefinitionAwareCodec: it falls back to invoking toString() on the value. The types not handled are: identityref, instance-identifier and leafref. One example of how this can go wrong is YANGTOOLS-1108. Let's just remove the codepath and start flushing out any offenders out there.

To achieve this, we will take two steps:

  1. we will remove the toString() fallback and perform an eager codec construction to see if we can handle the type at all. If we cannot, we will return null

  2. we will remove UnionStringCodec and always return it as unhandled

In this issue we will do the first item and introduce a system property to turn the behaviour to the second item.

Activity

Show:
Done

Details

Assignee

Reporter

Components

Fix versions

Priority

Created April 12, 2022 at 11:04 PM
Updated January 5, 2024 at 4:42 PM
Resolved June 20, 2022 at 11:09 AM