@@ -20,12 +20,7 @@ public class ReaderBasedJsonParser
20
20
extends JsonParserBase
21
21
{
22
22
private final static int FEAT_MASK_TRAILING_COMMA = JsonReadFeature .ALLOW_TRAILING_COMMA .getMask ();
23
-
24
23
private final static int FEAT_MASK_ALLOW_MISSING = JsonReadFeature .ALLOW_MISSING_VALUES .getMask ();
25
- private final static int FEAT_MASK_ALLOW_SINGLE_QUOTES = JsonReadFeature .ALLOW_SINGLE_QUOTES .getMask ();
26
-
27
- private final static int FEAT_MASK_ALLOW_JAVA_COMMENTS = JsonReadFeature .ALLOW_JAVA_COMMENTS .getMask ();
28
- private final static int FEAT_MASK_ALLOW_YAML_COMMENTS = JsonReadFeature .ALLOW_YAML_COMMENTS .getMask ();
29
24
30
25
// Latin1 encoding is not supported, but we do use 8-bit subset for
31
26
// pre-processing task, to simplify first pass, keep it fast.
@@ -450,9 +445,8 @@ public byte[] getBinaryValue(Base64Variant b64variant) throws IOException
450
445
} catch (IllegalArgumentException iae ) {
451
446
throw _constructError ("Failed to decode VALUE_STRING as base64 (" +b64variant +"): " +iae .getMessage ());
452
447
}
453
- /* let's clear incomplete only now; allows for accessing other
454
- * textual content in error cases
455
- */
448
+ // let's clear incomplete only now; allows for accessing other
449
+ // textual content in error cases
456
450
_tokenIncomplete = false ;
457
451
} else { // may actually require conversion...
458
452
if (_binaryValue == null ) {
@@ -540,7 +534,7 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buf
540
534
// First branch: can get padding (-> 1 byte)
541
535
if (bits < 0 ) {
542
536
if (bits != Base64Variant .BASE64_VALUE_PADDING ) {
543
- // as per [JACKSON-631], could also just be ' missing' padding
537
+ // could also just be missing padding
544
538
if (ch == '"' && !b64variant .usesPadding ()) {
545
539
decodedData >>= 4 ;
546
540
buffer [outputPtr ++] = (byte ) decodedData ;
@@ -575,7 +569,7 @@ protected int _readBinary(Base64Variant b64variant, OutputStream out, byte[] buf
575
569
bits = b64variant .decodeBase64Char (ch );
576
570
if (bits < 0 ) {
577
571
if (bits != Base64Variant .BASE64_VALUE_PADDING ) {
578
- // as per [JACKSON-631], could also just be ' missing' padding
572
+ // as per could also just be missing padding
579
573
if (ch == '"' && !b64variant .usesPadding ()) {
580
574
decodedData >>= 2 ;
581
575
buffer [outputPtr ++] = (byte ) (decodedData >> 8 );
@@ -1742,7 +1736,7 @@ private String _parseName2(int startPtr, int hash, int endChar) throws IOExcepti
1742
1736
protected String _handleOddName (int i ) throws IOException
1743
1737
{
1744
1738
// Allow single quotes?
1745
- if (i == '\'' && ( _formatReadFeatures & FEAT_MASK_ALLOW_SINGLE_QUOTES ) != 0 ) {
1739
+ if (i == '\'' && isEnabled ( JsonReadFeature . ALLOW_SINGLE_QUOTES ) ) {
1746
1740
return _parseAposName ();
1747
1741
}
1748
1742
// Allow unquoted names if feature enabled:
@@ -1755,7 +1749,7 @@ protected String _handleOddName(int i) throws IOException
1755
1749
// Also: first char must be a valid name char, but NOT be number
1756
1750
boolean firstOk ;
1757
1751
1758
- if (i < maxCode ) { // identifier, or a number ([Issue #102])
1752
+ if (i < maxCode ) { // identifier, or a number ([jackson-core #102])
1759
1753
firstOk = (codes [i ] == 0 );
1760
1754
} else {
1761
1755
firstOk = Character .isJavaIdentifierPart ((char ) i );
@@ -1836,15 +1830,14 @@ protected JsonToken _handleOddValue(int i) throws IOException
1836
1830
* Also, no separation to fast/slow parsing; we'll just do
1837
1831
* one regular (~= slowish) parsing, to keep code simple
1838
1832
*/
1839
- if (( _formatReadFeatures & FEAT_MASK_ALLOW_SINGLE_QUOTES ) != 0 ) {
1833
+ if (isEnabled ( JsonReadFeature . ALLOW_SINGLE_QUOTES ) ) {
1840
1834
return _handleApos ();
1841
1835
}
1842
1836
break ;
1843
1837
case ']' :
1844
- /* 28-Mar-2016: [core#116]: If Feature.ALLOW_MISSING_VALUES is enabled
1845
- * we may allow "missing values", that is, encountering a trailing
1846
- * comma or closing marker where value would be expected
1847
- */
1838
+ // 28-Mar-2016: [core#116]: If Feature.ALLOW_MISSING_VALUES is enabled
1839
+ // we may allow "missing values", that is, encountering a trailing
1840
+ // comma or closing marker where value would be expected
1848
1841
if (!_parsingContext .inArray ()) {
1849
1842
break ;
1850
1843
}
@@ -2401,7 +2394,7 @@ private int _skipWSOrEnd2() throws IOException
2401
2394
2402
2395
private void _skipComment () throws IOException
2403
2396
{
2404
- if (( _formatReadFeatures & FEAT_MASK_ALLOW_JAVA_COMMENTS ) == 0 ) {
2397
+ if (! isEnabled ( JsonReadFeature . ALLOW_JAVA_COMMENTS ) ) {
2405
2398
_reportUnexpectedChar ('/' , "maybe a (non-standard) comment? (not recognized as one since Feature 'ALLOW_COMMENTS' not enabled for parser)" );
2406
2399
}
2407
2400
// First: check which comment (if either) it is:
@@ -2451,7 +2444,7 @@ private void _skipCComment() throws IOException
2451
2444
2452
2445
private boolean _skipYAMLComment () throws IOException
2453
2446
{
2454
- if (( _formatReadFeatures & FEAT_MASK_ALLOW_YAML_COMMENTS ) == 0 ) {
2447
+ if (! isEnabled ( JsonReadFeature . ALLOW_YAML_COMMENTS ) ) {
2455
2448
return false ;
2456
2449
}
2457
2450
_skipLine ();
0 commit comments