@@ -675,7 +675,7 @@ public final JsonToken nextToken() throws IOException
675
675
// Should actually close/release things
676
676
// like input source, symbol table and recyclable buffers now.
677
677
close ();
678
- return ( _currToken = null );
678
+ return _updateTokenToNull ( );
679
679
}
680
680
// clear any data retained so far
681
681
_binaryValue = null ;
@@ -708,7 +708,7 @@ public final JsonToken nextToken() throws IOException
708
708
_updateNameLocation ();
709
709
String name = (i == INT_QUOTE ) ? _parseName () : _handleOddName (i );
710
710
_parsingContext .setCurrentName (name );
711
- _currToken = JsonToken .FIELD_NAME ;
711
+ _updateToken ( JsonToken .FIELD_NAME ) ;
712
712
i = _skipColon ();
713
713
}
714
714
_updateLocation ();
@@ -785,8 +785,7 @@ public final JsonToken nextToken() throws IOException
785
785
_nextToken = t ;
786
786
return _currToken ;
787
787
}
788
- _currToken = t ;
789
- return t ;
788
+ return _updateToken (t );
790
789
}
791
790
792
791
private final JsonToken _nextAfterName () throws IOException
@@ -803,7 +802,7 @@ private final JsonToken _nextAfterName() throws IOException
803
802
} else if (t == JsonToken .START_OBJECT ) {
804
803
createChildObjectContext (_tokenInputRow , _tokenInputCol );
805
804
}
806
- return ( _currToken = t );
805
+ return _updateToken ( t );
807
806
}
808
807
809
808
@ Override
@@ -837,7 +836,7 @@ public boolean nextFieldName(SerializableString sstr) throws IOException
837
836
int i = _skipWSOrEnd ();
838
837
if (i < 0 ) {
839
838
close ();
840
- _currToken = null ;
839
+ _updateTokenToNull () ;
841
840
return false ;
842
841
}
843
842
_binaryValue = null ;
@@ -913,7 +912,7 @@ public String nextFieldName() throws IOException
913
912
int i = _skipWSOrEnd ();
914
913
if (i < 0 ) {
915
914
close ();
916
- _currToken = null ;
915
+ _updateTokenToNull () ;
917
916
return null ;
918
917
}
919
918
_binaryValue = null ;
@@ -939,7 +938,7 @@ public String nextFieldName() throws IOException
939
938
_updateNameLocation ();
940
939
String name = (i == INT_QUOTE ) ? _parseName () : _handleOddName (i );
941
940
_parsingContext .setCurrentName (name );
942
- _currToken = JsonToken .FIELD_NAME ;
941
+ _updateToken ( JsonToken .FIELD_NAME ) ;
943
942
i = _skipColon ();
944
943
945
944
_updateLocation ();
@@ -1007,7 +1006,7 @@ public String nextFieldName() throws IOException
1007
1006
1008
1007
private final void _isNextTokenNameYes (int i ) throws IOException
1009
1008
{
1010
- _currToken = JsonToken .FIELD_NAME ;
1009
+ _updateToken ( JsonToken .FIELD_NAME ) ;
1011
1010
_updateLocation ();
1012
1011
1013
1012
switch (i ) {
@@ -1067,7 +1066,7 @@ protected boolean _isNextTokenNameMaybe(int i, String nameToMatch) throws IOExce
1067
1066
// // // and this is back to standard nextToken()
1068
1067
String name = (i == INT_QUOTE ) ? _parseName () : _handleOddName (i );
1069
1068
_parsingContext .setCurrentName (name );
1070
- _currToken = JsonToken .FIELD_NAME ;
1069
+ _updateToken ( JsonToken .FIELD_NAME ) ;
1071
1070
i = _skipColon ();
1072
1071
_updateLocation ();
1073
1072
if (i == INT_QUOTE ) {
@@ -1133,32 +1132,32 @@ private final JsonToken _nextTokenNotInObject(int i) throws IOException
1133
1132
{
1134
1133
if (i == INT_QUOTE ) {
1135
1134
_tokenIncomplete = true ;
1136
- return ( _currToken = JsonToken .VALUE_STRING );
1135
+ return _updateToken ( JsonToken .VALUE_STRING );
1137
1136
}
1138
1137
switch (i ) {
1139
1138
case '[' :
1140
1139
createChildArrayContext (_tokenInputRow , _tokenInputCol );
1141
- return ( _currToken = JsonToken .START_ARRAY );
1140
+ return _updateToken ( JsonToken .START_ARRAY );
1142
1141
case '{' :
1143
1142
createChildObjectContext (_tokenInputRow , _tokenInputCol );
1144
- return ( _currToken = JsonToken .START_OBJECT );
1143
+ return _updateToken ( JsonToken .START_OBJECT );
1145
1144
case 't' :
1146
1145
_matchToken ("true" , 1 );
1147
- return ( _currToken = JsonToken .VALUE_TRUE );
1146
+ return _updateToken ( JsonToken .VALUE_TRUE );
1148
1147
case 'f' :
1149
1148
_matchToken ("false" , 1 );
1150
- return ( _currToken = JsonToken .VALUE_FALSE );
1149
+ return _updateToken ( JsonToken .VALUE_FALSE );
1151
1150
case 'n' :
1152
1151
_matchToken ("null" , 1 );
1153
- return ( _currToken = JsonToken .VALUE_NULL );
1152
+ return _updateToken ( JsonToken .VALUE_NULL );
1154
1153
case '-' :
1155
- return ( _currToken = _parseSignedNumber (true ));
1154
+ return _updateToken ( _parseSignedNumber (true ));
1156
1155
/* Should we have separate handling for plus? Although
1157
1156
* it is not allowed per se, it may be erroneously used,
1158
1157
* and could be indicated by a more specific error message.
1159
1158
*/
1160
1159
case '.' : // [core#61]]
1161
- return ( _currToken = _parseFloatThatStartsWithPeriod (false ));
1160
+ return _updateToken ( _parseFloatThatStartsWithPeriod (false ));
1162
1161
case '0' :
1163
1162
case '1' :
1164
1163
case '2' :
@@ -1169,7 +1168,7 @@ private final JsonToken _nextTokenNotInObject(int i) throws IOException
1169
1168
case '7' :
1170
1169
case '8' :
1171
1170
case '9' :
1172
- return ( _currToken = _parseUnsignedNumber (i ));
1171
+ return _updateToken ( _parseUnsignedNumber (i ));
1173
1172
/*
1174
1173
* This check proceeds only if the Feature.ALLOW_MISSING_VALUES is enabled
1175
1174
* The Check is for missing values. In case of missing values in an array, the next token will be either ',' or ']'.
@@ -1184,11 +1183,11 @@ private final JsonToken _nextTokenNotInObject(int i) throws IOException
1184
1183
if (!_parsingContext .inRoot ()) {
1185
1184
if ((_features & FEAT_MASK_ALLOW_MISSING ) != 0 ) {
1186
1185
--_inputPtr ;
1187
- return ( _currToken = JsonToken .VALUE_NULL );
1186
+ return _updateToken ( JsonToken .VALUE_NULL );
1188
1187
}
1189
1188
}
1190
1189
}
1191
- return ( _currToken = _handleOddValue (i ));
1190
+ return _updateToken ( _handleOddValue (i ));
1192
1191
}
1193
1192
// note: identical to one in UTF8StreamJsonParser
1194
1193
@ Override
@@ -1198,7 +1197,7 @@ public final String nextTextValue() throws IOException
1198
1197
_nameCopied = false ;
1199
1198
JsonToken t = _nextToken ;
1200
1199
_nextToken = null ;
1201
- _currToken = t ;
1200
+ _updateToken ( t ) ;
1202
1201
if (t == JsonToken .VALUE_STRING ) {
1203
1202
if (_tokenIncomplete ) {
1204
1203
_tokenIncomplete = false ;
@@ -1225,7 +1224,7 @@ public final int nextIntValue(int defaultValue) throws IOException
1225
1224
_nameCopied = false ;
1226
1225
JsonToken t = _nextToken ;
1227
1226
_nextToken = null ;
1228
- _currToken = t ;
1227
+ _updateToken ( t ) ;
1229
1228
if (t == JsonToken .VALUE_NUMBER_INT ) {
1230
1229
return getIntValue ();
1231
1230
}
@@ -1248,7 +1247,7 @@ public final long nextLongValue(long defaultValue) throws IOException
1248
1247
_nameCopied = false ;
1249
1248
JsonToken t = _nextToken ;
1250
1249
_nextToken = null ;
1251
- _currToken = t ;
1250
+ _updateToken ( t ) ;
1252
1251
if (t == JsonToken .VALUE_NUMBER_INT ) {
1253
1252
return getLongValue ();
1254
1253
}
@@ -1271,7 +1270,7 @@ public final Boolean nextBooleanValue() throws IOException
1271
1270
_nameCopied = false ;
1272
1271
JsonToken t = _nextToken ;
1273
1272
_nextToken = null ;
1274
- _currToken = t ;
1273
+ _updateToken ( t ) ;
1275
1274
if (t == JsonToken .VALUE_TRUE ) {
1276
1275
return Boolean .TRUE ;
1277
1276
}
@@ -3024,23 +3023,23 @@ protected void _reportInvalidToken(String matchedPart, String msg) throws IOExce
3024
3023
/**********************************************************
3025
3024
*/
3026
3025
3027
- private void _closeScope (int i ) throws JsonParseException
3026
+ private void _closeScope (int i ) throws IOException
3028
3027
{
3029
3028
if (i == INT_RBRACKET ) {
3030
3029
_updateLocation ();
3031
3030
if (!_parsingContext .inArray ()) {
3032
3031
_reportMismatchedEndMarker (i , '}' );
3033
3032
}
3034
3033
_parsingContext = _parsingContext .clearAndGetParent ();
3035
- _currToken = JsonToken .END_ARRAY ;
3034
+ _updateToken ( JsonToken .END_ARRAY ) ;
3036
3035
}
3037
3036
if (i == INT_RCURLY ) {
3038
3037
_updateLocation ();
3039
3038
if (!_parsingContext .inObject ()) {
3040
3039
_reportMismatchedEndMarker (i , ']' );
3041
3040
}
3042
3041
_parsingContext = _parsingContext .clearAndGetParent ();
3043
- _currToken = JsonToken .END_OBJECT ;
3042
+ _updateToken ( JsonToken .END_OBJECT ) ;
3044
3043
}
3045
3044
}
3046
3045
}
0 commit comments