Skip to content

Commit 43a2e8a

Browse files
authored
Merge branch '2.17' into 2.17
2 parents 2668e5f + 6224569 commit 43a2e8a

File tree

7 files changed

+54
-46
lines changed

7 files changed

+54
-46
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ jobs:
2323

2424
steps:
2525
- name: Checkout repository
26-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
26+
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
2727

2828
# Initializes the CodeQL tools for scanning.
2929
- name: Initialize CodeQL
30-
uses: github/codeql-action/init@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
30+
uses: github/codeql-action/init@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7
3131
with:
3232
languages: ${{ matrix.language }}
3333

3434
- name: Autobuild
35-
uses: github/codeql-action/autobuild@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
35+
uses: github/codeql-action/autobuild@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7
3636

3737
- name: Perform CodeQL Analysis
38-
uses: github/codeql-action/analyze@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6
38+
uses: github/codeql-action/analyze@3ab4101902695724f9365a384f86c1074d94e18c # v3.24.7

.github/workflows/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
env:
3131
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
3232
steps:
33-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
33+
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
3434
- name: Set up JDK
35-
uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
35+
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
3636
with:
3737
distribution: 'temurin'
3838
java-version: ${{ matrix.java_version }}

.github/workflows/win.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ jobs:
2929
env:
3030
JAVA_OPTS: "-XX:+TieredCompilation -XX:TieredStopAtLevel=1"
3131
steps:
32-
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
32+
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
3333
- name: Set up JDK
34-
uses: actions/setup-java@9704b39bf258b59bc04b50fa2dd55e9ed76b47a8 # v4.1.0
34+
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
3535
with:
3636
distribution: 'temurin'
3737
java-version: ${{ matrix.java_version }}

release-notes/VERSION-2.x

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ Project: jackson-databind
1212

1313
#4428: `ByteBuddy` scope went beyond `test` in version 2.17.0
1414
(reported by Miguel M-R)
15-
(fix contributed by Joo-Hyuk K)
15+
(fix by Joo-Hyuk K)
16+
#4435: Cannot deserialize value of type `java.math.BigDecimal` from
17+
String ".05": not a valid representation
18+
(reported by @EAlf91)
19+
(fix by @pjfanning)
1620

1721
2.17.0 (12-Mar-2024)
1822

@@ -99,7 +103,7 @@ Project: jackson-databind
99103
100104
#1770: Incorrect deserialization for `BigDecimal` numbers
101105
(reported by @cristian-mocanu-mob)
102-
(fix contributed by @pjfanning)
106+
(fix by @pjfanning)
103107
#2502: Add a way to configure caches Jackson uses
104108
(contributed by Joo-Hyuk K)
105109
#2787: Mix-ins do not work for `Enum`s

src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -657,9 +657,7 @@ protected final Float _parseFloat(JsonParser p, DeserializationContext ctxt)
657657
p.streamReadConstraints().validateFPLength(text.length());
658658
try {
659659
return NumberInput.parseFloat(text, p.isEnabled(StreamReadFeature.USE_FAST_DOUBLE_PARSER));
660-
} catch (IllegalArgumentException iae) {
661-
if (true) throw new Error();
662-
}
660+
} catch (IllegalArgumentException iae) { }
663661
}
664662
return (Float) ctxt.handleWeirdStringValue(_valueClass, text,
665663
"not a valid `Float` value");

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

Lines changed: 36 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.fasterxml.jackson.databind.deser;
1+
package com.fasterxml.jackson.databind.deser.jdk;
22

33
import java.math.BigDecimal;
44
import java.math.BigInteger;
@@ -11,47 +11,26 @@
1111

1212
import com.fasterxml.jackson.databind.ObjectMapper;
1313
import com.fasterxml.jackson.databind.json.JsonMapper;
14-
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil.DoubleWrapper;
14+
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
1515

16+
import static org.junit.jupiter.api.Assertions.assertEquals;
1617
import static org.junit.jupiter.api.Assertions.assertNotNull;
1718
import static org.junit.jupiter.api.Assertions.fail;
1819

19-
import static com.fasterxml.jackson.databind.testutil.DatabindTestUtil.newJsonMapper;
20-
import static com.fasterxml.jackson.databind.testutil.DatabindTestUtil.verifyException;
21-
2220
public class BigNumbersDeserTest
21+
extends DatabindTestUtil
2322
{
24-
static class BigDecimalWrapper {
25-
BigDecimal number;
26-
27-
public BigDecimalWrapper() {}
28-
29-
public BigDecimalWrapper(BigDecimal number) {
30-
this.number = number;
31-
}
32-
33-
public void setNumber(BigDecimal number) {
34-
this.number = number;
35-
}
36-
}
37-
3823
static class BigIntegerWrapper {
39-
BigInteger number;
40-
41-
public BigIntegerWrapper() {}
42-
43-
public BigIntegerWrapper(BigInteger number) {
44-
this.number = number;
45-
}
24+
public BigInteger number;
25+
}
4626

47-
public void setNumber(BigInteger number) {
48-
this.number = number;
49-
}
27+
static class BigDecimalWrapper {
28+
public BigDecimal number;
5029
}
5130

5231
/*
5332
/**********************************************************
54-
/* Tests
33+
/* Test methods
5534
/**********************************************************
5635
*/
5736

@@ -123,6 +102,33 @@ public void testBigIntegerUnlimited() throws Exception
123102
assertNotNull(bdw);
124103
}
125104

105+
// [databind#4435]
106+
@Test
107+
public void testNumberStartingWithDot() throws Exception
108+
{
109+
String num = ".555555555555555555555555555555";
110+
BigDecimalWrapper w = MAPPER.readValue("{\"number\":\"" + num + "\"}", BigDecimalWrapper.class);
111+
assertEquals(new BigDecimal(num), w.number);
112+
}
113+
114+
// [databind#4435]
115+
@Test
116+
public void testNumberStartingWithMinusDot() throws Exception
117+
{
118+
String num = "-.555555555555555555555555555555";
119+
BigDecimalWrapper w = MAPPER.readValue("{\"number\":\"" + num + "\"}", BigDecimalWrapper.class);
120+
assertEquals(new BigDecimal(num), w.number);
121+
}
122+
123+
// [databind#4435]
124+
@Test
125+
public void testNumberStartingWithPlusDot() throws Exception
126+
{
127+
String num = "+.555555555555555555555555555555";
128+
BigDecimalWrapper w = MAPPER.readValue("{\"number\":\"" + num + "\"}", BigDecimalWrapper.class);
129+
assertEquals(new BigDecimal(num), w.number);
130+
}
131+
126132
private String generateJson(final String fieldName) {
127133
final int len = 1200;
128134
final StringBuilder sb = new StringBuilder();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@
1616
import com.fasterxml.jackson.databind.*;
1717
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
1818
import com.fasterxml.jackson.databind.exc.MismatchedInputException;
19+
import com.fasterxml.jackson.databind.testutil.DatabindTestUtil;
1920

2021
import static org.junit.jupiter.api.Assertions.*;
2122

22-
import static com.fasterxml.jackson.databind.testutil.DatabindTestUtil.*;
23-
2423
public class JDKNumberDeserTest
24+
extends DatabindTestUtil
2525
{
2626
/*
2727
/**********************************************************************
@@ -104,7 +104,7 @@ public MyBeanValue deserialize(JsonParser jp, DeserializationContext ctxt)
104104
/**********************************************************************
105105
*/
106106

107-
final ObjectMapper MAPPER = new ObjectMapper();
107+
private final ObjectMapper MAPPER = new ObjectMapper();
108108

109109
@Test
110110
public void testNaN() throws Exception

0 commit comments

Comments
 (0)