Skip to content

JSON message converter returns null for empty POJO #1097

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

Closed
castelblanque opened this issue Nov 24, 2023 · 2 comments
Closed

JSON message converter returns null for empty POJO #1097

castelblanque opened this issue Nov 24, 2023 · 2 comments
Milestone

Comments

@castelblanque
Copy link

Describe the issue
When using an empty POJO (class without fields), JsonMessageConverter converts it to null instead of a representation of an empty JSON ({}).

To Reproduce
Steps to reproduce the behavior:

  1. Create POJO class e.g.
    public class EmptyPOJO {
    }
  2. Use JsonMessageConverter#convertToInternal method to convert the POJO. It uses jsonMapper.toJson(payload) inside.
  3. Returned value is null

Version of the framework
Spring Cloud Stream 4.0.4

Expected behavior
JSON message converter returns the representation of an empty JSON: {}

Additional context
Issue appeared when migrating from Spring Boot 2 to 3.0.12. Stream tests that we had passing in v2 started to fail, and we debugged the problem down to this issue.

@sobychacko
Copy link
Collaborator

@castelblanque JsonMessageConverter is from Spring Cloud Function. I am moving this issue over there.

@sobychacko sobychacko transferred this issue from spring-cloud/spring-cloud-stream Dec 18, 2023
@olegz
Copy link
Contributor

olegz commented Mar 27, 2024

Ok , 4.0.4 is already EOL. In fact the entire 4.0.x is EOL, so please switch to 4.1.0 or 4.1.1.
As for this issue, I believe it has ben addressed quite recently, but it was related to AWS, so i am fixing it for the entire framework now. Shouldn't be long

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants