fastjson icon indicating copy to clipboard operation
fastjson copied to clipboard

Spring AbstractMessageConverter ISSUE

Open Reagan1947 opened this issue 5 months ago • 0 comments

1. Spring AbstarctMessageConvert ISSUE

1.1 Summary

1.1.1 Issue Summary

When I try to use fast-json with spring cloud stream framework, it not working correctly. More details: in fast-json a message convert was supplied (See also: org.springframework.messaging.converter.AbstractMessageConverter). It not convert my message correctly. I got the error stack:

nested exception is com.alibaba.fastjson.JSONException: TODO

I noticed that in src/main/java/com/alibaba/fastjson/support/spring/messaging/MappingFastJsonMessageConverter.java the supports method return true directly.

The support Type (byte[] or String) should be determinate. Not Just return the true result

1.2 Code Changing

1.2.1 MappingFastJsonMessageConverter

    @Override
    protected boolean supports(Class<?> clazz) {
        // To determining the supporting type
    }

1.2.2 Root Cause

Without support type determinate. ANY TYPE object will be convert by this convertor.

Reagan1947 avatar Sep 06 '24 16:09 Reagan1947