File tree 4 files changed +23
-9
lines changed
src/main/java/com/fasterxml/jackson/core/json
4 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -112,3 +112,7 @@ Alex Yursha (AlexYursha@github)
112
112
* Contributed #312: Add `JsonProcessingException.clearLocation()` to allow clearing
113
113
possibly security-sensitive information
114
114
(2.9.0)
115
+
116
+ Brad Hess (bdhess@github)
117
+ * Contributed #323: Add `JsonParser.ALLOW_TRAILING_COMMA` to work for Arrays and Objects
118
+ (2.9.0)
Original file line number Diff line number Diff line change @@ -20,6 +20,8 @@ JSON library.
20
20
#312: Add `JsonProcessingException.clearLocation()` to allow clearing
21
21
possibly security-sensitive information
22
22
(contributed by Alex Y)
23
+ #323: Add `JsonParser.ALLOW_TRAILING_COMMA` to work for Arrays and Objects
24
+ (contributed by Brad H)
23
25
24
26
2.8.4 (14-Oct-2016)
25
27
Original file line number Diff line number Diff line change 19
19
public class ReaderBasedJsonParser // final in 2.3, earlier
20
20
extends ParserBase
21
21
{
22
+ protected final static int FEAT_MASK_TRAILING_COMMA = Feature .ALLOW_TRAILING_COMMA .getMask ();
23
+
22
24
// Latin1 encoding is not supported, but we do use 8-bit subset for
23
25
// pre-processing task, to simplify first pass, keep it fast.
24
26
protected final static int [] _icLatin1 = CharTypes .getInputCodeLatin1 ();
@@ -662,9 +664,11 @@ public final JsonToken nextToken() throws IOException
662
664
i = _skipComma (i );
663
665
664
666
// Was that a trailing comma?
665
- if (isEnabled (Feature .ALLOW_TRAILING_COMMA ) && (i == INT_RBRACKET || i == INT_RCURLY )) {
666
- _closeScope (i );
667
- return _currToken ;
667
+ if ((_features & FEAT_MASK_TRAILING_COMMA ) != 0 ) {
668
+ if ((i == INT_RBRACKET ) || (i == INT_RCURLY )) {
669
+ _closeScope (i );
670
+ return _currToken ;
671
+ }
668
672
}
669
673
}
670
674
@@ -815,9 +819,11 @@ public boolean nextFieldName(SerializableString sstr) throws IOException
815
819
i = _skipComma (i );
816
820
817
821
// Was that a trailing comma?
818
- if (isEnabled (Feature .ALLOW_TRAILING_COMMA ) && (i == INT_RBRACKET || i == INT_RCURLY )) {
819
- _closeScope (i );
820
- return false ;
822
+ if ((_features & FEAT_MASK_TRAILING_COMMA ) != 0 ) {
823
+ if ((i == INT_RBRACKET ) || (i == INT_RCURLY )) {
824
+ _closeScope (i );
825
+ return false ;
826
+ }
821
827
}
822
828
}
823
829
Original file line number Diff line number Diff line change @@ -588,9 +588,11 @@ public JsonToken nextToken() throws IOException
588
588
i = _skipWS ();
589
589
590
590
// Was that a trailing comma?
591
- if (isEnabled (Feature .ALLOW_TRAILING_COMMA ) && (i == INT_RBRACKET || i == INT_RCURLY )) {
592
- _closeScope (i );
593
- return _currToken ;
591
+ if (Feature .ALLOW_TRAILING_COMMA .enabledIn (_features )) {
592
+ if (i == INT_RBRACKET || i == INT_RCURLY ) {
593
+ _closeScope (i );
594
+ return _currToken ;
595
+ }
594
596
}
595
597
}
596
598
You can’t perform that action at this time.
0 commit comments