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

[Avro] Fix unit test for untyped map schema generation. #282

Conversation

MichalFoksa
Copy link
Contributor

Since 2.13, UnsupportedOperationException is thrown instead of InvalidDefinitionException.

Fixes #281

…instead of `InvalidDefinitionException`. Reason in 2.13 in that `ToEmptyObjectSerializer` is used to serialize `java.util.Map` which calls `visitor.expectObjectFormat(typeHint)` and thus different exception is thrown at the end and when schema is requested from mapper.
@MichalFoksa MichalFoksa marked this pull request as ready for review May 22, 2021 16:15
@cowtowncoder
Copy link
Member

Thank you for digging into this! Ideally, I think, we should try to avoid exposing non-Jackson RuntimeExceptions, so it'd be good to see if this could be changed. This because users are less likely to catch these exceptions (wrt jackson's declared ones; type of which will change in 3.x to become unchecked but still with common JacksonException base type).

Not sure if exception 2.12 uses is optimal, but it seems better than UnsupportedOperationException.

I'll merge this first to stop failing CI and see if I can find time to further improve handling.

@cowtowncoder cowtowncoder merged commit c94dbef into FasterXML:2.13 May 26, 2021
@MichalFoksa MichalFoksa deleted the bugfix/2.13.x/avro/testSchemaForUntypedMap branch May 26, 2021 18:20
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.

[Avro] Unit test for untyped map schema fails in 2.13 branch
2 participants