Skip to content

Commit b6846ee

Browse files
committed
Update release notes
1 parent 766089d commit b6846ee

File tree

4 files changed

+23
-9
lines changed

4 files changed

+23
-9
lines changed

release-notes/CREDITS

+4
Original file line numberDiff line numberDiff line change
@@ -112,3 +112,7 @@ Alex Yursha (AlexYursha@github)
112112
* Contributed #312: Add `JsonProcessingException.clearLocation()` to allow clearing
113113
possibly security-sensitive information
114114
(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)

release-notes/VERSION

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ JSON library.
2020
#312: Add `JsonProcessingException.clearLocation()` to allow clearing
2121
possibly security-sensitive information
2222
(contributed by Alex Y)
23+
#323: Add `JsonParser.ALLOW_TRAILING_COMMA` to work for Arrays and Objects
24+
(contributed by Brad H)
2325

2426
2.8.4 (14-Oct-2016)
2527

src/main/java/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.java

+12-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
public class ReaderBasedJsonParser // final in 2.3, earlier
2020
extends ParserBase
2121
{
22+
protected final static int FEAT_MASK_TRAILING_COMMA = Feature.ALLOW_TRAILING_COMMA.getMask();
23+
2224
// Latin1 encoding is not supported, but we do use 8-bit subset for
2325
// pre-processing task, to simplify first pass, keep it fast.
2426
protected final static int[] _icLatin1 = CharTypes.getInputCodeLatin1();
@@ -662,9 +664,11 @@ public final JsonToken nextToken() throws IOException
662664
i = _skipComma(i);
663665

664666
// 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+
}
668672
}
669673
}
670674

@@ -815,9 +819,11 @@ public boolean nextFieldName(SerializableString sstr) throws IOException
815819
i = _skipComma(i);
816820

817821
// 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+
}
821827
}
822828
}
823829

src/main/java/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -588,9 +588,11 @@ public JsonToken nextToken() throws IOException
588588
i = _skipWS();
589589

590590
// 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+
}
594596
}
595597
}
596598

0 commit comments

Comments
 (0)