File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed
main/java/com/fasterxml/jackson/core
test/java/com/fasterxml/jackson/core/read Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -9,17 +9,24 @@ public class StreamReadConfig {
9
9
10
10
private static final int DEFAULT_MAX_NUM_LEN = 1000 ;
11
11
12
- private int _maxNumLen = DEFAULT_MAX_NUM_LEN ;
12
+ private int _maxNumLen ;
13
+
14
+ public StreamReadConfig () {
15
+ _maxNumLen = DEFAULT_MAX_NUM_LEN ;
16
+ }
17
+
18
+ private StreamReadConfig (int maxNumLen ) {
19
+ _maxNumLen = maxNumLen ;
20
+ }
13
21
14
22
/**
15
23
* Sets the maximum number length (in chars). The default is 1000 (since Jackson 2.14)
16
24
* @param maxNumLen the maximum number length (in chars)
17
25
* @return this config
18
26
* @since 2.15
19
27
*/
20
- public StreamReadConfig maxNumberLength (int maxNumLen ) {
21
- _maxNumLen = maxNumLen ;
22
- return this ;
28
+ public StreamReadConfig withMaxNumberLength (int maxNumLen ) {
29
+ return new StreamReadConfig (maxNumLen );
23
30
}
24
31
25
32
public int getMaxNumberLength () {
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ public class NumberOverflowTest
9
9
extends com .fasterxml .jackson .core .BaseTest
10
10
{
11
11
private final JsonFactory FACTORY = JsonFactory .builder ()
12
- .streamReadConfig (new StreamReadConfig ().maxNumberLength (1000000 ))
12
+ .streamReadConfig (new StreamReadConfig ().withMaxNumberLength (1000000 ))
13
13
.build ();
14
14
15
15
// NOTE: this should be long enough to trigger perf problems
Original file line number Diff line number Diff line change @@ -709,7 +709,7 @@ public void testLongNumbers2() throws Exception
709
709
}
710
710
final String DOC = input .toString ();
711
711
JsonFactory f = JsonFactory .builder ()
712
- .streamReadConfig (new StreamReadConfig ().maxNumberLength (10000 ))
712
+ .streamReadConfig (new StreamReadConfig ().withMaxNumberLength (10000 ))
713
713
.build ();
714
714
_testIssue160LongNumbers (f , DOC , false );
715
715
_testIssue160LongNumbers (f , DOC , true );
You can’t perform that action at this time.
0 commit comments