spring-cloud/spring-cloud-function

JSON message converter returns null for empty POJO

castelblanque opened this issue · 2 comments

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.

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

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