@@ -826,7 +826,7 @@ private void _parseSlowFloat(int expType) throws IOException
826
826
_wrapError ("Malformed numeric value '" +_textBuffer .contentsAsString ()+"'" , nex );
827
827
}
828
828
}
829
-
829
+
830
830
private void _parseSlowInt (int expType ) throws IOException
831
831
{
832
832
String numStr = _textBuffer .contentsAsString ();
@@ -843,6 +843,10 @@ private void _parseSlowInt(int expType) throws IOException
843
843
_numberLong = Long .parseLong (numStr );
844
844
_numTypesValid = NR_LONG ;
845
845
} else {
846
+ // 16-Oct-2018, tatu: Need to catch "too big" early due to... issues
847
+ if ((expType == NR_INT ) || (expType == NR_LONG )) {
848
+ _reportTooLongInt (expType , numStr );
849
+ }
846
850
// nope, need the heavy guns... (rare case)
847
851
_numberBigInt = new BigInteger (numStr );
848
852
_numTypesValid = NR_BIGINT ;
@@ -852,7 +856,17 @@ private void _parseSlowInt(int expType) throws IOException
852
856
_wrapError ("Malformed numeric value '" +numStr +"'" , nex );
853
857
}
854
858
}
855
-
859
+
860
+ // @since 2.9.8
861
+ protected void _reportTooLongInt (int expType , String rawNum ) throws IOException
862
+ {
863
+ String numDesc = (rawNum .length () > 1000 )
864
+ ? String .format ("[Integer with %d digits]" , rawNum .length ())
865
+ : rawNum ;
866
+ _reportError ("Numeric value (%s) out of range of %s" , numDesc ,
867
+ (expType == NR_LONG ) ? "long" : "int" );
868
+ }
869
+
856
870
/*
857
871
/**********************************************************
858
872
/* Numeric conversions
0 commit comments