File tree Expand file tree Collapse file tree 2 files changed +11
-8
lines changed
main/java/com/fasterxml/jackson/core/io
test/java/com/fasterxml/jackson/core/io Expand file tree Collapse file tree 2 files changed +11
-8
lines changed Original file line number Diff line number Diff line change 8
8
9
9
public final class NumberInput
10
10
{
11
- // numbers with more than these characters are better parsed with BigDecimalParser
12
- // parsing numbers with many digits in Java is slower than O(n)
13
- private final static int LARGE_INT_SIZE = 1250 ;
14
-
15
11
/**
16
12
* Formerly used constant for a value that was problematic on certain
17
13
* pre-1.8 JDKs.
@@ -398,10 +394,7 @@ public static BigDecimal parseBigDecimal(char[] ch) throws NumberFormatException
398
394
* @throws NumberFormatException if string cannot be represented by a BigInteger
399
395
* @since v2.14
400
396
*/
401
- public static BigInteger parseBigInteger (String s ) throws NumberFormatException {
402
- if (s .length () > LARGE_INT_SIZE ) {
403
- return BigDecimalParser .parse (s ).toBigInteger ();
404
- }
397
+ public static BigInteger parseBigInteger (final String s ) throws NumberFormatException {
405
398
return new BigInteger (s );
406
399
}
407
400
}
Original file line number Diff line number Diff line change @@ -41,5 +41,15 @@ public void testParseLongBigInteger()
41
41
String test2000 = stringBuilder .toString ();
42
42
assertEquals (new BigInteger (test2000 ), NumberInput .parseBigInteger (test2000 ));
43
43
}
44
+
45
+ public void testParseBigIntegerFailsWithENotation ()
46
+ {
47
+ try {
48
+ NumberInput .parseBigInteger ("1e10" );
49
+ fail ("expected NumberFormatException" );
50
+ } catch (NumberFormatException nfe ) {
51
+ // expected
52
+ }
53
+ }
44
54
}
45
55
You can’t perform that action at this time.
0 commit comments