@@ -25,6 +25,9 @@ public class ReaderBasedJsonParser // final in 2.3, earlier
25
25
@ SuppressWarnings ("deprecation" )
26
26
private final static int FEAT_MASK_LEADING_ZEROS = Feature .ALLOW_NUMERIC_LEADING_ZEROS .getMask ();
27
27
28
+ @ SuppressWarnings ("deprecation" )
29
+ private final static int FEAT_MASK_NON_NUM_NUMBERS = Feature .ALLOW_NON_NUMERIC_NUMBERS .getMask ();
30
+
28
31
// Latin1 encoding is not supported, but we do use 8-bit subset for
29
32
// pre-processing task, to simplify first pass, keep it fast.
30
33
protected final static int [] _icLatin1 = CharTypes .getInputCodeLatin1 ();
@@ -1616,14 +1619,14 @@ protected JsonToken _handleInvalidNumberStart(int ch, boolean negative) throws I
1616
1619
if (ch == 'N' ) {
1617
1620
String match = negative ? "-INF" :"+INF" ;
1618
1621
_matchToken (match , 3 );
1619
- if (isEnabled ( Feature . ALLOW_NON_NUMERIC_NUMBERS ) ) {
1622
+ if (( _features & FEAT_MASK_NON_NUM_NUMBERS ) != 0 ) {
1620
1623
return resetAsNaN (match , negative ? Double .NEGATIVE_INFINITY : Double .POSITIVE_INFINITY );
1621
1624
}
1622
1625
_reportError ("Non-standard token '" +match +"': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow" );
1623
1626
} else if (ch == 'n' ) {
1624
1627
String match = negative ? "-Infinity" :"+Infinity" ;
1625
1628
_matchToken (match , 3 );
1626
- if (isEnabled ( Feature . ALLOW_NON_NUMERIC_NUMBERS ) ) {
1629
+ if (( _features & FEAT_MASK_NON_NUM_NUMBERS ) != 0 ) {
1627
1630
return resetAsNaN (match , negative ? Double .NEGATIVE_INFINITY : Double .POSITIVE_INFINITY );
1628
1631
}
1629
1632
_reportError ("Non-standard token '" +match +"': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow" );
@@ -1869,14 +1872,14 @@ protected JsonToken _handleOddValue(int i) throws IOException
1869
1872
break ;
1870
1873
case 'N' :
1871
1874
_matchToken ("NaN" , 1 );
1872
- if (isEnabled ( Feature . ALLOW_NON_NUMERIC_NUMBERS ) ) {
1875
+ if (( _features & FEAT_MASK_NON_NUM_NUMBERS ) != 0 ) {
1873
1876
return resetAsNaN ("NaN" , Double .NaN );
1874
1877
}
1875
1878
_reportError ("Non-standard token 'NaN': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow" );
1876
1879
break ;
1877
1880
case 'I' :
1878
1881
_matchToken ("Infinity" , 1 );
1879
- if (isEnabled ( Feature . ALLOW_NON_NUMERIC_NUMBERS ) ) {
1882
+ if (( _features & FEAT_MASK_NON_NUM_NUMBERS ) != 0 ) {
1880
1883
return resetAsNaN ("Infinity" , Double .POSITIVE_INFINITY );
1881
1884
}
1882
1885
_reportError ("Non-standard token 'Infinity': enable JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS to allow" );
0 commit comments