Update release notes
diff --git a/release-notes/CREDITS b/release-notes/CREDITS
index bcb11a7..d83c59c 100644
--- a/release-notes/CREDITS
+++ b/release-notes/CREDITS
@@ -112,3 +112,7 @@
* Contributed #312: Add `JsonProcessingException.clearLocation()` to allow clearing
possibly security-sensitive information
(2.9.0)
+
+Brad Hess (bdhess@github)
+ * Contributed #323: Add `JsonParser.ALLOW_TRAILING_COMMA` to work for Arrays and Objects
+ (2.9.0)
diff --git a/release-notes/VERSION b/release-notes/VERSION
index cdb5e2e..7a836d2 100644
--- a/release-notes/VERSION
+++ b/release-notes/VERSION
@@ -20,6 +20,8 @@
#312: Add `JsonProcessingException.clearLocation()` to allow clearing
possibly security-sensitive information
(contributed by Alex Y)
+#323: Add `JsonParser.ALLOW_TRAILING_COMMA` to work for Arrays and Objects
+ (contributed by Brad H)
2.8.4 (14-Oct-2016)
diff --git a/src/main/java/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.java b/src/main/java/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.java
index b27de2e..4c45a07 100644
--- a/src/main/java/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.java
+++ b/src/main/java/com/fasterxml/jackson/core/json/ReaderBasedJsonParser.java
@@ -19,6 +19,8 @@
public class ReaderBasedJsonParser // final in 2.3, earlier
extends ParserBase
{
+ protected final static int FEAT_MASK_TRAILING_COMMA = Feature.ALLOW_TRAILING_COMMA.getMask();
+
// Latin1 encoding is not supported, but we do use 8-bit subset for
// pre-processing task, to simplify first pass, keep it fast.
protected final static int[] _icLatin1 = CharTypes.getInputCodeLatin1();
@@ -662,9 +664,11 @@
i = _skipComma(i);
// Was that a trailing comma?
- if (isEnabled(Feature.ALLOW_TRAILING_COMMA) && (i == INT_RBRACKET || i == INT_RCURLY)) {
- _closeScope(i);
- return _currToken;
+ if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) {
+ if ((i == INT_RBRACKET) || (i == INT_RCURLY)) {
+ _closeScope(i);
+ return _currToken;
+ }
}
}
@@ -815,9 +819,11 @@
i = _skipComma(i);
// Was that a trailing comma?
- if (isEnabled(Feature.ALLOW_TRAILING_COMMA) && (i == INT_RBRACKET || i == INT_RCURLY)) {
- _closeScope(i);
- return false;
+ if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) {
+ if ((i == INT_RBRACKET) || (i == INT_RCURLY)) {
+ _closeScope(i);
+ return false;
+ }
}
}
diff --git a/src/main/java/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.java b/src/main/java/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.java
index de5d081..dcd13a3 100644
--- a/src/main/java/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.java
+++ b/src/main/java/com/fasterxml/jackson/core/json/UTF8DataInputJsonParser.java
@@ -588,9 +588,11 @@
i = _skipWS();
// Was that a trailing comma?
- if (isEnabled(Feature.ALLOW_TRAILING_COMMA) && (i == INT_RBRACKET || i == INT_RCURLY)) {
- _closeScope(i);
- return _currToken;
+ if (Feature.ALLOW_TRAILING_COMMA.enabledIn(_features)) {
+ if (i == INT_RBRACKET || i == INT_RCURLY) {
+ _closeScope(i);
+ return _currToken;
+ }
}
}