Skip to content

Commit d23d682

Browse files
committed
Minor test improvement
1 parent 9e3a311 commit d23d682

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/test/java/com/fasterxml/jackson/databind/deser/dos/HugeIntegerCoerceTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
package com.fasterxml.jackson.databind.deser.dos;
22

3+
import com.fasterxml.jackson.core.JsonFactory;
4+
import com.fasterxml.jackson.core.StreamReadConstraints;
35
import com.fasterxml.jackson.core.exc.InputCoercionException;
46
import com.fasterxml.jackson.databind.*;
7+
import com.fasterxml.jackson.databind.json.JsonMapper;
58

69
// for [databind#2157]
710
public class HugeIntegerCoerceTest extends BaseMapTest
@@ -15,16 +18,19 @@ public class HugeIntegerCoerceTest extends BaseMapTest
1518
}
1619
BIG_POS_INTEGER = sb.toString();
1720
}
18-
19-
private final ObjectMapper MAPPER = objectMapper(); // shared is fine
2021

2122
public void testMaliciousLongForEnum() throws Exception
2223
{
24+
JsonFactory f = JsonFactory.builder()
25+
.streamReadConstraints(StreamReadConstraints.builder().maxNumberLength(BIG_NUM_LEN + 10).build())
26+
.build();
27+
final ObjectMapper mapper = new JsonMapper(f);
28+
2329
// Note: due to [jackson-core#488], fix verified with streaming over multiple
2430
// parser types. Here we focus on databind-level
2531

2632
try {
27-
/*ABC value =*/ MAPPER.readValue(BIG_POS_INTEGER, ABC.class);
33+
/*ABC value =*/ mapper.readValue(BIG_POS_INTEGER, ABC.class);
2834
fail("Should not pass");
2935
} catch (InputCoercionException e) {
3036
verifyException(e, "out of range of int");

0 commit comments

Comments
 (0)