-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Buffering needed for @JsonTypeInfo
property breaks parsing of Floats (depending on property order) (dup of #3133)
#3202
Comments
Yes, there are challenges in buffering and There is at least one other issue for the general problem and there is no immediate solution. FasterXML/jackson-modules-java8#307 is related for example. Ultimately this could mean one of:
|
@JsonTypeInfo
property breaks parsing of Floats (depending on property order)
I think #3730 that was just added should help here. |
I think this may have been fixed for 2.17 (2.17.2) or 2.18 (2.18.0-rc1). Would need a verification: if I have time, I'll try that with given test case. |
Ok looking at existing tests, #3133 seems to be the same issue, fixed for 2.15. |
Test passes, closing as dup. |
@JsonTypeInfo
property breaks parsing of Floats (depending on property order)@JsonTypeInfo
property breaks parsing of Floats (depending on property order) (dup of #3133)
We're using a class structure similar to the following one using the
@JsonTypeInfo
to determine various SubTypes possible for that JSON:Now we were facing problems because we cannot ensure the order of the properties of the incoming JSONs. Unfortunately it turned out that Jackson would parse Doubles as BigDecimals depending of the order of the type info. E.g.:
During my diggings I found that
jackson-databind/src/main/java/com/fasterxml/jackson/databind/jsontype/impl/AsPropertyTypeDeserializer.java
Line 105 in 0e23195
_deserializeTypedForId(p, ctxt, tb, p.getText());
which then somehow triggers aParserBase.resetFloats()
, which setsthis._numTypesValid = 0;
where I'd say this then causes_parseSlowFloat(16)
then to parse everything as BigDecimal. (...but I'm certainly no expert there...)About the context: we're using Java 15 with the current Spring Boot V 2.5.2 which contains Jackson V 2.12.3. (...and I consciously used
new ObjectMapper()
to bypass the Spring wirings...)The text was updated successfully, but these errors were encountered: