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 88
99public final class NumberInput
1010{
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-
1511 /**
1612 * Formerly used constant for a value that was problematic on certain
1713 * pre-1.8 JDKs.
@@ -398,10 +394,7 @@ public static BigDecimal parseBigDecimal(char[] ch) throws NumberFormatException
398394 * @throws NumberFormatException if string cannot be represented by a BigInteger
399395 * @since v2.14
400396 */
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 {
405398 return new BigInteger (s );
406399 }
407400}
Original file line number Diff line number Diff line change @@ -41,5 +41,15 @@ public void testParseLongBigInteger()
4141 String test2000 = stringBuilder .toString ();
4242 assertEquals (new BigInteger (test2000 ), NumberInput .parseBigInteger (test2000 ));
4343 }
44+
45+ public void testParseBigIntegerFailsWithENotation ()
46+ {
47+ try {
48+ NumberInput .parseBigInteger ("1e10" );
49+ fail ("expected NumberFormatException" );
50+ } catch (NumberFormatException nfe ) {
51+ // expected
52+ }
53+ }
4454}
4555
You can’t perform that action at this time.
0 commit comments