-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Error in deserialization of JSON #451
Comments
I have the same problem. Any ideas to fix this error? |
Hi @IgorMaksymov , To what I have seen at the moment, it seems that the problem is for the com.fasterxml.jackson.core:jackson-databind:2.9.4 library. For the moment to bypass the error I have forced the use of the com.fasterxml.jackson.core:jackson-databind:2.9.3 library. |
@CarlosLoboZamarro thanks! |
Sorry @IgorMaksymov , I wanted to say com.fasterxml.jackson.core:jackson-databind:2.9.3 library. |
For more data, here's the code that di thrown an error for me : oauthServer.when(
request("/oauth/v2/access_token")
.withMethod("GET")
.withHeader("X-Correlation-Id", "70b10973-a064-41da-8a5b-5a4dacca9d15")
.withQueryStringParameter("grant_type", "client_credentials")
.withQueryStringParameter("scope", "SCOPE")
.withHeader("authorization", "Basic Y2xpZW50SWQ6Y2xpZW50U2VjcmV0"))
.respond(response().withStatusCode(200)
.withBody("{\"access_token\":\"the_great_access_token\",\"expires_in\":1000}")); Upon debugging the deserializer complains about deserializing this array Here's a whole stack trace :
Here's what changed with jackson-databind 2.9.4 : https://github.com/FasterXML/jackson-databind/blob/jackson-databind-2.9.5/release-notes/VERSION-2.x#L31-L61 |
I wonder if this was introduced by this issue / change FasterXML/jackson-databind#1853 |
I used version 5.1.1 and it worked.
|
Also fails for jackson 2.8.11, which is a hotfix for a CVE. And the issue is gone in 2.9.2 (which doesn't have a hotfix for the CVE), and then fails again in 2.9.5. I didn't try 2.9.3 or 2.9.4 yet though. But the hotfix in 2.8.11 may be a clue. |
Jackson 2.9.3 does work fine, as mentioned here previously. |
Agreed, 2.9.3 does work. 2.9.4 doesn't. |
2.9.5 doesn't work either. Same error as 2.9.4 |
There is a bug in Jackson from version 2.9.4 onwards. The bug is because Jackson invalidly prevents deserialisation of JSON fields names for objects unless those objects are deserialised as a Map. I have however worked around this bug with d267a2d. |
@jamesbloomnektan Do you have the jackson issue ticket ? |
@jamesbloomnektan Did your fix get released to maven central yet? |
Version 5.4.1 is available on maven central
…On Mon, Jul 2, 2018, 21:29 Nathan ***@***.***> wrote:
@jamesbloomnektan <https://github.com/jamesbloomnektan> Did your fix get
released to maven yet?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#451 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/Aas2ydyFBKBvFqVV7Wp5my4RO0Mi0vp8ks5uCmaCgaJpZM4SsKUp>
.
|
Works great! Thanks (Side note: You changed the names of some methods without having some deprecation period. I was on 5.3.0 and the method |
Is there plans to update the mockserver maven plugin soon to use the latest version and to pull in this fix? |
i'm trying to send
application/x-www-form-urlencoded
request with bodyto:[email protected]
this is the test code:
new MockServerClient("localhost", 1080) .when(request("/messages") .withMethod("POST") .withQueryStringParameter(Parameter.param("to","[email protected]")) ) .respond(response().withStatusCode(200));
And when this code is executed, i have this exception:
IllegalArgumentException: Exception while parsing [{ "httpRequest" : { "method" : "POST", "path" : "/messages", "queryStringParameters" : { "to" : [ "[email protected]" ] } }, "httpResponse" : { "statusCode" : 200 }, "times" : { "remainingTimes" : 0, "unlimited" : true }, "timeToLive" : { "unlimited" : true } }] for Expectation
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of
java.lang.Stringout of FIELD_NAME token at [Source: (String)"{ "httpRequest" : { "method" : "POST", "path" : "/messages", "queryStringParameters" : { "to" : [ "[email protected]" ] } }, "httpResponse" : { "statusCode" : 200 }, "times" : { "remainingTimes" : 0, "unlimited" : true }, "timeToLive" : { "unlimited" : true } }"
How can i bypass or fix this?
The text was updated successfully, but these errors were encountered: