diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 707e6e1fc2..46d2416026 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -23,6 +23,8 @@ JSON library. #733: Add `StreamReadCapability.EXACT_FLOATS` to indicate whether parser reports exact floating-point values or not (contributed Doug R) +#751: Remove workaround for old issue with a particular double + (contributed by @pjfanning) 2.13.3 (not yet released) diff --git a/src/main/java/com/fasterxml/jackson/core/io/NumberInput.java b/src/main/java/com/fasterxml/jackson/core/io/NumberInput.java index 2c45db0c35..5e987a5b28 100644 --- a/src/main/java/com/fasterxml/jackson/core/io/NumberInput.java +++ b/src/main/java/com/fasterxml/jackson/core/io/NumberInput.java @@ -4,12 +4,6 @@ public final class NumberInput { - /** - * Textual representation of a double constant that can cause nasty problems - * with JDK (see http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308). - */ - public final static String NASTY_SMALL_DOUBLE = "2.2250738585072012e-308"; - /** * Constants needed for parsing longs from basic int parsing methods */ @@ -300,13 +294,6 @@ public static double parseAsDouble(String s, double def) } public static double parseDouble(String s) throws NumberFormatException { - // [JACKSON-486]: avoid some nasty float representations... but should it be MIN_NORMAL or MIN_VALUE? - /* as per [JACKSON-827], let's use MIN_VALUE as it is available on all JDKs; normalized - * only in JDK 1.6. In practice, should not really matter. - */ - if (NASTY_SMALL_DOUBLE.equals(s)) { - return Double.MIN_VALUE; - } return Double.parseDouble(s); } diff --git a/src/test/java/com/fasterxml/jackson/core/io/TestNumberInput.java b/src/test/java/com/fasterxml/jackson/core/io/TestNumberInput.java new file mode 100644 index 0000000000..bbfa1b5394 --- /dev/null +++ b/src/test/java/com/fasterxml/jackson/core/io/TestNumberInput.java @@ -0,0 +1,14 @@ +package com.fasterxml.jackson.core.io; + +public class TestNumberInput + extends com.fasterxml.jackson.core.BaseTest +{ + public void testNastySmallDouble() + { + //relates to https://github.com/FasterXML/jackson-core/issues/750 + //prior to jackson v2.14, this value used to be returned as Double.MIN_VALUE + final String nastySmallDouble = "2.2250738585072012e-308"; + assertEquals(Double.parseDouble(nastySmallDouble), NumberInput.parseDouble(nastySmallDouble)); + } +} +