@@ -883,6 +883,19 @@ protected void _parseNumericValue(int expType) throws IOException
883
883
_numTypesValid = NR_LONG ;
884
884
return ;
885
885
}
886
+ // For [core#865]: handle remaining 19-char cases as well
887
+ if (len == 19 ) {
888
+ char [] buf = _textBuffer .getTextBuffer ();
889
+ int offset = _textBuffer .getTextOffset ();
890
+ if (_numberNegative ) {
891
+ ++offset ;
892
+ }
893
+ if (NumberInput .inLongRange (buf , offset , len , _numberNegative )) {
894
+ _numberLong = NumberInput .parseLong19 (buf , offset , _numberNegative );
895
+ _numTypesValid = NR_LONG ;
896
+ return ;
897
+ }
898
+ }
886
899
_parseSlowInt (expType );
887
900
return ;
888
901
}
@@ -956,35 +969,22 @@ private void _parseSlowFloat(int expType) throws IOException
956
969
957
970
private void _parseSlowInt (int expType ) throws IOException
958
971
{
972
+ final String numStr = _textBuffer .contentsAsString ();
959
973
try {
960
- int len = _intLength ;
961
- char [] buf = _textBuffer .getTextBuffer ();
962
- int offset = _textBuffer .getTextOffset ();
963
- if (_numberNegative ) {
964
- ++offset ;
974
+ // 16-Oct-2018, tatu: Need to catch "too big" early due to [jackson-core#488]
975
+ if ((expType == NR_INT ) || (expType == NR_LONG )) {
976
+ _reportTooLongIntegral (expType , numStr );
965
977
}
966
- // Some long cases still...
967
- if (NumberInput .inLongRange (buf , offset , len , _numberNegative )) {
968
- _numberLong = NumberInput .parseLong19 (buf , offset , _numberNegative );
969
- _numTypesValid = NR_LONG ;
978
+ if ((expType == NR_DOUBLE ) || (expType == NR_FLOAT )) {
979
+ _numberDouble = NumberInput .parseDouble (numStr , isEnabled (Feature .USE_FAST_DOUBLE_PARSER ));
980
+ _numTypesValid = NR_DOUBLE ;
970
981
} else {
971
- String numStr = _textBuffer .contentsAsString ();
972
- // 16-Oct-2018, tatu: Need to catch "too big" early due to [jackson-core#488]
973
- if ((expType == NR_INT ) || (expType == NR_LONG )) {
974
- _reportTooLongIntegral (expType , numStr );
975
- }
976
- if ((expType == NR_DOUBLE ) || (expType == NR_FLOAT )) {
977
- _numberDouble = NumberInput .parseDouble (numStr , isEnabled (Feature .USE_FAST_DOUBLE_PARSER ));
978
- _numTypesValid = NR_DOUBLE ;
979
- } else {
980
- // nope, need the heavy guns... (rare case) - since Jackson v2.14, BigInteger parsing is lazy
981
- _numberBigInt = null ;
982
- _numberString = numStr ;
983
- _numTypesValid = NR_BIGINT ;
984
- }
982
+ // nope, need the heavy guns... (rare case) - since Jackson v2.14, BigInteger parsing is lazy
983
+ _numberBigInt = null ;
984
+ _numberString = numStr ;
985
+ _numTypesValid = NR_BIGINT ;
985
986
}
986
987
} catch (NumberFormatException nex ) {
987
- String numStr = _textBuffer .contentsAsString ();
988
988
// Can this ever occur? Due to overflow, maybe?
989
989
_wrapError ("Malformed numeric value (" +_longNumberDesc (numStr )+")" , nex );
990
990
}
0 commit comments