From f26616cadab124d79365ff34262cb1220c00d6ba Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Thu, 12 Sep 2024 03:09:55 +0100 Subject: [PATCH 1/2] Create BigDecimalParser4694Test.java (#1332) --- .../failing/BigDecimalParser4694Test.java | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/test/java/com/fasterxml/jackson/failing/BigDecimalParser4694Test.java diff --git a/src/test/java/com/fasterxml/jackson/failing/BigDecimalParser4694Test.java b/src/test/java/com/fasterxml/jackson/failing/BigDecimalParser4694Test.java new file mode 100644 index 0000000000..5515fdd747 --- /dev/null +++ b/src/test/java/com/fasterxml/jackson/failing/BigDecimalParser4694Test.java @@ -0,0 +1,25 @@ +package com.fasterxml.jackson.failing; + +import ch.randelshofer.fastdoubleparser.JavaBigDecimalParser; +import com.fasterxml.jackson.core.io.BigDecimalParser; +import org.junit.jupiter.api.Test; + +import java.math.BigDecimal; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class BigDecimalParser4694Test extends com.fasterxml.jackson.core.JUnit5TestBase +{ + // https://github.com/FasterXML/jackson-databind/issues/4694 + @Test + void issueDatabind4694() { + final String str = "-11000.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; + final BigDecimal expected = new BigDecimal(str); + assertEquals(expected, JavaBigDecimalParser.parseBigDecimal(str)); + assertEquals(expected, BigDecimalParser.parse(str)); + assertEquals(expected, BigDecimalParser.parseWithFastParser(str)); + final char[] arr = str.toCharArray(); + assertEquals(expected, BigDecimalParser.parse(arr, 0, arr.length)); + assertEquals(expected, BigDecimalParser.parseWithFastParser(arr, 0, arr.length)); + } +} From af8e0a2d7602e889d8cec1a4f25d3ff1a1ecc2a3 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Fri, 13 Sep 2024 15:23:05 -0700 Subject: [PATCH 2/2] Backport #1331 library upgrade --- pom.xml | 2 +- release-notes/VERSION-2.x | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index d917cfce0b..1e207c0bee 100644 --- a/pom.xml +++ b/pom.xml @@ -293,7 +293,7 @@ com.fasterxml.jackson.core.*;version=${project.version} ch.randelshofer fastdoubleparser - 1.0.0 + 1.0.1 diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index f947c7eb24..8c01d90cac 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -14,6 +14,11 @@ a pure JSON library. === Releases === ------------------------------------------------------------------------ +2.17.3 (not yet released): + +#1331: Update to FastDoubleParser v1.0.1 to fix `BigDecimal` decoding problem + (contributed by @pjfanning) + 2.17.2 (05-Jul-2024) #1308: Relax validation by `NumberInput.looksLikeValidNumber()` to allow