-
Notifications
You must be signed in to change notification settings - Fork 256
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
JacksonJsonNodeJsonProvider throws class cast exceptions #1369
Comments
Where is this cast to a List happening? |
The cast itself is implicit and part of
the line it starts is here: logbook/logbook-json/src/main/java/org/zalando/logbook/json/JsonPathBodyFilters.java Line 58 in 7867917
|
Sounds like a bug in json-path then. Maybe there was a change in Jackson which caused this incompatibility? |
I got the same error in the logs. The class cast exception does also occurs when trying to delete a node that does not exists. The following test shows an error: void test(){ |
I have run into this issue as well. There is a bug report on the json-path project json-path/JsonPath#678 that looks to be related. |
I've tried copying the JsonPathBodyFilters to a new class and changing the implementation to the |
In the meantime, as a workaround I've used the
|
Also this log can be supressed by adding this to your logback.xml for now: <!-- quiet down the logging for logbook json filters -->
<logger name="org.zalando.logbook.json.JsonPathBodyFilters" level="INFO"/> |
In order to prioritize the support for Logbook, we would like to check whether the old issues are still relevant.
|
logbook/logbook-json/src/main/java/org/zalando/logbook/json/JsonPathBodyFilters.java
Line 92 in bc4afe1
This JacksonJsonNodeJsonProvider throws class cast exceptions:
class com.fasterxml.jackson.databind.node.ArrayNode cannot be cast to class java.util.List (com.fasterxml.jackson.databind.node.ArrayNode is in unnamed module of loader 'app'; java.util.List is in module java.base of loader 'bootstrap')
Resulting that the body is never transformed when there is one rule applied that handels arrays. Once the exception is throw the original body is returned (and this line also hides the exception pretty well...)
logbook/logbook-json/src/main/java/org/zalando/logbook/json/JsonPathBodyFilters.java
Lines 112 to 113 in 7867917
Issue is that the expected type of (T) would be List but JacksonJsonNodeJsonProvider on createArray() is returning an ArrayNode which is not castable to List.
A solution would be to use JacksonJsonProvider instead of JacksonJsonNodeJsonProvider
The text was updated successfully, but these errors were encountered: