Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UUIDSerializer: Cast to parent type to deserialize a UUID within a list #427

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

desilvai-target
Copy link
Contributor

The UUIDSerializer's deserializer will fail with a ClassCastException when the UUID is embedded in a list (e.g., val foo: Collection<@Contextual UUID> = emptyList()). The decoder in this example is a ListDecoder rather than the expected BsonFlexibleDecoder triggering the exception. Both, however, are FlexibleDecoder objects and the reader field is declared there. Updated the cast to this parent type, resolving the issue. The existing tests pass with this change.

If you need more info, please let me know.

…ithin a list.

The UUIDSerializer's deserializer will fail with a `ClassCastException` when the UUID is embedded in a list (e.g., `val foo: Collection<@contextual UUID> = emptyList()`).  The decoder in this example is a `ListDecoder` rather than the expected `BsonFlexibleDecoder` triggering the exception.  Both, however, are `FlexibleDecoder` objects and the reader field is declared there.  Updated the cast to this parent type, resolving the issue.
@zigzago
Copy link
Member

zigzago commented Nov 7, 2023

Thank you !

@zigzago zigzago merged commit eefb061 into Litote:master Nov 7, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants