-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Add JsonNodeFeature.FAIL_ON_NAN_TO_BIG_DECIMAL_COERCION
option to fail on attempting to coerce NaN
into BigDecimal
#4194
Comments
+1 Adding an option for backward compatibility and moving-forward to 3.0. I am guessing that...
Then users who want to keep allowing by explicitly enabling the option |
@JooHyukKim Yes. For 3.0 probably want to split |
Just my opinion - but I think we don't need another config. Support for NaN/Infinity are not default in Jackson. You need to enable JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS (on the JsonFactory). So users who want BigDecimals should not enable JsonReadFeature.ALLOW_NON_NUMERIC_NUMBERS. |
This is bit different @pjfanning -- it has to do with what to do when NaNs are accepted from input but there is need to coerce floating-point numbers to
while we could technically just select one of these cases always, it seems like a thing that users might want to select differently. |
JsonNodeFeature
option to fail on attempting to coerce NaN
into BigDecimal
(if DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS
enabled)JsonNodeFeature.FAIL_ON_NAN_TO_BIG_DECIMAL_COERCION
option to fail on attempting to coerce NaN
into BigDecimal
Ok, after re-reading relevant issues, refreshing my memory, I concur with @pjfanning that I filed FasterXML/jackson-core#1149 for some additional work; and there is FasterXML/jackson-core#1137 already. I also think that with changes, we probably want to rename this feature. Why? Because:
Or maybe we want 2 features? This one for |
Describe your Issue
(follow up to #1770)
So, we should not (by default) coerce "NaN"s (infinity, NaN) for
JsonNode
as is done with #1770 fixed.There should probably be a
JsonNodeFeature
to allow such coercion, however.The text was updated successfully, but these errors were encountered: