Skip to content

Commit bf909b0

Browse files
authored
Add test verifying fix of #4577 (via jackson-core/1308) (#4578)
1 parent a18a482 commit bf909b0

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

release-notes/VERSION-2.x

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ Project: jackson-databind
1515
#4575: StdDelegatingSerializer does not consider a Converter that may
1616
return null for a non-null input
1717
(reported, fix contributed by Peter L)
18+
#4577: Cannot deserialize value of type `java.math.BigDecimal` from
19+
String "3." (not a valid representation)
20+
(reported by @dmelisso)
1821

1922
2.17.1 (04-May-2024)
2023

src/test/java/com/fasterxml/jackson/databind/deser/jdk/BigNumbersDeserTest.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,24 +106,23 @@ public void testBigIntegerUnlimited() throws Exception
106106
@Test
107107
public void testNumberStartingWithDot() throws Exception {
108108
_testNumberWith(".555555555555555555555555555555");
109-
}
110-
111-
// [databind#4435]
112-
@Test
113-
public void testNumberStartingWithMinusDot() throws Exception {
114109
_testNumberWith("-.555555555555555555555555555555");
110+
_testNumberWith("+.555555555555555555555555555555");
115111
}
116112

117-
// [databind#4435]
113+
// [databind#4577]
118114
@Test
119-
public void testNumberStartingWithPlusDot() throws Exception {
120-
_testNumberWith("+.555555555555555555555555555555");
115+
public void testNumberEndingWithDot() throws Exception {
116+
_testNumberWith("55.");
117+
_testNumberWith("-55.");
118+
_testNumberWith("+55.");
121119
}
122-
120+
123121
private void _testNumberWith(String num) throws Exception
124122
{
123+
BigDecimal exp = new BigDecimal(num);
125124
BigDecimalWrapper w = MAPPER.readValue("{\"number\":\"" + num + "\"}", BigDecimalWrapper.class);
126-
assertEquals(new BigDecimal(num), w.number);
125+
assertEquals(exp, w.number);
127126
}
128127

129128
private String generateJson(final String fieldName) {

0 commit comments

Comments
 (0)