Skip to content

Commit ce70782

Browse files
committed
Start work on #563
1 parent 1c852df commit ce70782

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

src/main/java/com/fasterxml/jackson/core/json/async/NonBlockingJsonParser.java

+13-9
Original file line numberDiff line numberDiff line change
@@ -636,11 +636,11 @@ private final JsonToken _startValue(int ch) throws IOException
636636
return _startTrueToken();
637637
case '[':
638638
return _startArrayScope();
639-
case ']':
639+
case INT_RBRACKET:
640640
return _closeArrayScope();
641641
case '{':
642642
return _startObjectScope();
643-
case '}':
643+
case INT_RCURLY:
644644
return _closeObjectScope();
645645
default:
646646
}
@@ -676,6 +676,10 @@ private final JsonToken _startValueExpectComma(int ch) throws IOException
676676
}
677677
_reportUnexpectedChar(ch, "was expecting comma to separate "+_parsingContext.typeDesc()+" entries");
678678
}
679+
680+
// 17-Sep-2019, tatu: [core#563] Need to call this to update index within array
681+
_parsingContext.expectComma();
682+
679683
int ptr = _inputPtr;
680684
if (ptr >= _inputEnd) {
681685
_minorState = MINOR_VALUE_WS_AFTER_COMMA;
@@ -722,15 +726,15 @@ private final JsonToken _startValueExpectComma(int ch) throws IOException
722726
return _startTrueToken();
723727
case '[':
724728
return _startArrayScope();
725-
case ']':
729+
case INT_RBRACKET:
726730
// Was that a trailing comma?
727731
if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) {
728732
return _closeArrayScope();
729733
}
730734
break;
731735
case '{':
732736
return _startObjectScope();
733-
case '}':
737+
case INT_RCURLY:
734738
// Was that a trailing comma?
735739
if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) {
736740
return _closeObjectScope();
@@ -866,15 +870,15 @@ private final JsonToken _startValueAfterComma(int ch) throws IOException
866870
return _startTrueToken();
867871
case '[':
868872
return _startArrayScope();
869-
case ']':
873+
case INT_RBRACKET:
870874
// Was that a trailing comma?
871875
if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) {
872876
return _closeArrayScope();
873877
}
874878
break;
875879
case '{':
876880
return _startObjectScope();
877-
case '}':
881+
case INT_RCURLY:
878882
// Was that a trailing comma?
879883
if ((_features & FEAT_MASK_TRAILING_COMMA) != 0) {
880884
return _closeObjectScope();
@@ -888,7 +892,7 @@ private final JsonToken _startValueAfterComma(int ch) throws IOException
888892
protected JsonToken _startUnexpectedValue(boolean leadingComma, int ch) throws IOException
889893
{
890894
switch (ch) {
891-
case ']':
895+
case INT_RBRACKET:
892896
if (!_parsingContext.inArray()) {
893897
break;
894898
}
@@ -902,7 +906,7 @@ protected JsonToken _startUnexpectedValue(boolean leadingComma, int ch) throws I
902906
return _valueComplete(JsonToken.VALUE_NULL);
903907
}
904908
// fall through
905-
case '}':
909+
case INT_RCURLY:
906910
// Error: neither is valid at this point; valid closers have
907911
// been handled earlier
908912
break;
@@ -2071,7 +2075,7 @@ private JsonToken _handleOddName(int ch) throws IOException
20712075
return _finishAposName(0, 0, 0);
20722076
}
20732077
break;
2074-
case ']': // for better error reporting...
2078+
case INT_RBRACKET: // for better error reporting...
20752079
return _closeArrayScope();
20762080
}
20772081
// allow unquoted names if feature enabled:

0 commit comments

Comments
 (0)