-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
AbstractJackson2HttpMessageConverter - Check for encoding breaks JSON to POJO de-serialization experience #25247
Comments
@poutsma I suppose this also affects 5.1.16 since the same change got backported. |
It does, yes. |
This commit makes sure that Jackson-based message converters and decoders can deal with non-unicode input. It does so by reading non-unicode input messages with a InputStreamReader. This commit also adds additional tests forthe canRead/canWrite methods on both codecs and message converters. Closes: spring-projectsgh-25247
We were caught by this problem because we use Is there a better constant class to use? |
@jeffjensen This issue should only occur when dealing with non-unicode JSON. By default (i.e. without a charset specified in the Content-Type) JSON is UTF-8 encoded. It was only because of a bug in Chrome that the explicit UTF-8 parameter was required. That bug is now fixed, and that is why we deprecated the constant. Can you elaborate more about your setup? Is your service producing non-unicode JSON? |
This commit makes sure that Jackson-based message converters and decoders can deal with non-unicode input. It does so by reading non-unicode input messages with a InputStreamReader. This commit also adds additional tests forthe canRead/canWrite methods on both codecs and message converters. Closes: gh-25247
Not intentionally. Our puzzler is most of the responses are the same with Boot 2.3.0 and 2.3.1, but there is a situation in error handling where:
It happens when going through this method:
When I add UTF-8 to this line: |
@kruegsch This should now be fixed. Can you please try a recent 5.2.8 snapshot to see if the problem has been resolved? @jeffjensen I am not sure you are facing the same issue. Feel free to try the snapshot, to see if it resolves the problem. If not then please create a separate issue, because it was something else causing this. |
@poutsma |
@poutsma |
@jeffjensen The problem could be related, but I really can't tell without more information. So please create a new issue, with a sample if possible. |
This commit makes sure that Jackson-based message converters and decoders can deal with non-unicode input. It does so by reading non-unicode input messages with a InputStreamReader. This commit also adds additional tests forthe canRead/canWrite methods on both codecs and message converters. Closes: spring-projectsgh-25247
This commit makes sure that Jackson-based message converters and decoders can deal with non-unicode input. It does so by reading non-unicode input messages with a InputStreamReader. This commit also adds additional tests forthe canRead/canWrite methods on both codecs and message converters. Closes: spring-projectsgh-25247
Affects: 5.2.7 (Spring Boot 2.3.1)
Due to a fix in Issue #25076
the AbstractJackson2HttpMessageConverter also blocks the out-of-the-box JSON to POJO de-serialization for responses with an encoding/character set not being unicode.
In our case a GET request to
https://appleid.apple.com/auth/keys
responses with aContent-Type: application/json;charset=ISO-8859-1
, which results now inorg.springframework.web.client.UnknownContentTypeException: Could not extract response: no suitable HttpMessageConverter found for response type [class x.y.z.AppleKeyRequest] and content type [application/json;charset=ISO-8859-1]
.It would be nice to have an option to include non compliant JSON encodings for the given default converters or to have the encoding check as opt-in to be on par with previous default behavior.
The text was updated successfully, but these errors were encountered: