@@ -675,7 +675,7 @@ public final JsonToken nextToken() throws IOException
675675 // Should actually close/release things
676676 // like input source, symbol table and recyclable buffers now.
677677 close ();
678- return ( _currToken = null );
678+ return _updateTokenToNull ( );
679679 }
680680 // clear any data retained so far
681681 _binaryValue = null ;
@@ -708,7 +708,7 @@ public final JsonToken nextToken() throws IOException
708708 _updateNameLocation ();
709709 String name = (i == INT_QUOTE ) ? _parseName () : _handleOddName (i );
710710 _parsingContext .setCurrentName (name );
711- _currToken = JsonToken .FIELD_NAME ;
711+ _updateToken ( JsonToken .FIELD_NAME ) ;
712712 i = _skipColon ();
713713 }
714714 _updateLocation ();
@@ -785,8 +785,7 @@ public final JsonToken nextToken() throws IOException
785785 _nextToken = t ;
786786 return _currToken ;
787787 }
788- _currToken = t ;
789- return t ;
788+ return _updateToken (t );
790789 }
791790
792791 private final JsonToken _nextAfterName () throws IOException
@@ -803,7 +802,7 @@ private final JsonToken _nextAfterName() throws IOException
803802 } else if (t == JsonToken .START_OBJECT ) {
804803 createChildObjectContext (_tokenInputRow , _tokenInputCol );
805804 }
806- return ( _currToken = t );
805+ return _updateToken ( t );
807806 }
808807
809808 @ Override
@@ -837,7 +836,7 @@ public boolean nextFieldName(SerializableString sstr) throws IOException
837836 int i = _skipWSOrEnd ();
838837 if (i < 0 ) {
839838 close ();
840- _currToken = null ;
839+ _updateTokenToNull () ;
841840 return false ;
842841 }
843842 _binaryValue = null ;
@@ -913,7 +912,7 @@ public String nextFieldName() throws IOException
913912 int i = _skipWSOrEnd ();
914913 if (i < 0 ) {
915914 close ();
916- _currToken = null ;
915+ _updateTokenToNull () ;
917916 return null ;
918917 }
919918 _binaryValue = null ;
@@ -939,7 +938,7 @@ public String nextFieldName() throws IOException
939938 _updateNameLocation ();
940939 String name = (i == INT_QUOTE ) ? _parseName () : _handleOddName (i );
941940 _parsingContext .setCurrentName (name );
942- _currToken = JsonToken .FIELD_NAME ;
941+ _updateToken ( JsonToken .FIELD_NAME ) ;
943942 i = _skipColon ();
944943
945944 _updateLocation ();
@@ -1007,7 +1006,7 @@ public String nextFieldName() throws IOException
10071006
10081007 private final void _isNextTokenNameYes (int i ) throws IOException
10091008 {
1010- _currToken = JsonToken .FIELD_NAME ;
1009+ _updateToken ( JsonToken .FIELD_NAME ) ;
10111010 _updateLocation ();
10121011
10131012 switch (i ) {
@@ -1067,7 +1066,7 @@ protected boolean _isNextTokenNameMaybe(int i, String nameToMatch) throws IOExce
10671066 // // // and this is back to standard nextToken()
10681067 String name = (i == INT_QUOTE ) ? _parseName () : _handleOddName (i );
10691068 _parsingContext .setCurrentName (name );
1070- _currToken = JsonToken .FIELD_NAME ;
1069+ _updateToken ( JsonToken .FIELD_NAME ) ;
10711070 i = _skipColon ();
10721071 _updateLocation ();
10731072 if (i == INT_QUOTE ) {
@@ -1133,32 +1132,32 @@ private final JsonToken _nextTokenNotInObject(int i) throws IOException
11331132 {
11341133 if (i == INT_QUOTE ) {
11351134 _tokenIncomplete = true ;
1136- return ( _currToken = JsonToken .VALUE_STRING );
1135+ return _updateToken ( JsonToken .VALUE_STRING );
11371136 }
11381137 switch (i ) {
11391138 case '[' :
11401139 createChildArrayContext (_tokenInputRow , _tokenInputCol );
1141- return ( _currToken = JsonToken .START_ARRAY );
1140+ return _updateToken ( JsonToken .START_ARRAY );
11421141 case '{' :
11431142 createChildObjectContext (_tokenInputRow , _tokenInputCol );
1144- return ( _currToken = JsonToken .START_OBJECT );
1143+ return _updateToken ( JsonToken .START_OBJECT );
11451144 case 't' :
11461145 _matchToken ("true" , 1 );
1147- return ( _currToken = JsonToken .VALUE_TRUE );
1146+ return _updateToken ( JsonToken .VALUE_TRUE );
11481147 case 'f' :
11491148 _matchToken ("false" , 1 );
1150- return ( _currToken = JsonToken .VALUE_FALSE );
1149+ return _updateToken ( JsonToken .VALUE_FALSE );
11511150 case 'n' :
11521151 _matchToken ("null" , 1 );
1153- return ( _currToken = JsonToken .VALUE_NULL );
1152+ return _updateToken ( JsonToken .VALUE_NULL );
11541153 case '-' :
1155- return ( _currToken = _parseSignedNumber (true ));
1154+ return _updateToken ( _parseSignedNumber (true ));
11561155 /* Should we have separate handling for plus? Although
11571156 * it is not allowed per se, it may be erroneously used,
11581157 * and could be indicated by a more specific error message.
11591158 */
11601159 case '.' : // [core#61]]
1161- return ( _currToken = _parseFloatThatStartsWithPeriod (false ));
1160+ return _updateToken ( _parseFloatThatStartsWithPeriod (false ));
11621161 case '0' :
11631162 case '1' :
11641163 case '2' :
@@ -1169,7 +1168,7 @@ private final JsonToken _nextTokenNotInObject(int i) throws IOException
11691168 case '7' :
11701169 case '8' :
11711170 case '9' :
1172- return ( _currToken = _parseUnsignedNumber (i ));
1171+ return _updateToken ( _parseUnsignedNumber (i ));
11731172 /*
11741173 * This check proceeds only if the Feature.ALLOW_MISSING_VALUES is enabled
11751174 * 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
11841183 if (!_parsingContext .inRoot ()) {
11851184 if ((_features & FEAT_MASK_ALLOW_MISSING ) != 0 ) {
11861185 --_inputPtr ;
1187- return ( _currToken = JsonToken .VALUE_NULL );
1186+ return _updateToken ( JsonToken .VALUE_NULL );
11881187 }
11891188 }
11901189 }
1191- return ( _currToken = _handleOddValue (i ));
1190+ return _updateToken ( _handleOddValue (i ));
11921191 }
11931192 // note: identical to one in UTF8StreamJsonParser
11941193 @ Override
@@ -1198,7 +1197,7 @@ public final String nextTextValue() throws IOException
11981197 _nameCopied = false ;
11991198 JsonToken t = _nextToken ;
12001199 _nextToken = null ;
1201- _currToken = t ;
1200+ _updateToken ( t ) ;
12021201 if (t == JsonToken .VALUE_STRING ) {
12031202 if (_tokenIncomplete ) {
12041203 _tokenIncomplete = false ;
@@ -1225,7 +1224,7 @@ public final int nextIntValue(int defaultValue) throws IOException
12251224 _nameCopied = false ;
12261225 JsonToken t = _nextToken ;
12271226 _nextToken = null ;
1228- _currToken = t ;
1227+ _updateToken ( t ) ;
12291228 if (t == JsonToken .VALUE_NUMBER_INT ) {
12301229 return getIntValue ();
12311230 }
@@ -1248,7 +1247,7 @@ public final long nextLongValue(long defaultValue) throws IOException
12481247 _nameCopied = false ;
12491248 JsonToken t = _nextToken ;
12501249 _nextToken = null ;
1251- _currToken = t ;
1250+ _updateToken ( t ) ;
12521251 if (t == JsonToken .VALUE_NUMBER_INT ) {
12531252 return getLongValue ();
12541253 }
@@ -1271,7 +1270,7 @@ public final Boolean nextBooleanValue() throws IOException
12711270 _nameCopied = false ;
12721271 JsonToken t = _nextToken ;
12731272 _nextToken = null ;
1274- _currToken = t ;
1273+ _updateToken ( t ) ;
12751274 if (t == JsonToken .VALUE_TRUE ) {
12761275 return Boolean .TRUE ;
12771276 }
@@ -3024,23 +3023,23 @@ protected void _reportInvalidToken(String matchedPart, String msg) throws IOExce
30243023 /**********************************************************
30253024 */
30263025
3027- private void _closeScope (int i ) throws JsonParseException
3026+ private void _closeScope (int i ) throws IOException
30283027 {
30293028 if (i == INT_RBRACKET ) {
30303029 _updateLocation ();
30313030 if (!_parsingContext .inArray ()) {
30323031 _reportMismatchedEndMarker (i , '}' );
30333032 }
30343033 _parsingContext = _parsingContext .clearAndGetParent ();
3035- _currToken = JsonToken .END_ARRAY ;
3034+ _updateToken ( JsonToken .END_ARRAY ) ;
30363035 }
30373036 if (i == INT_RCURLY ) {
30383037 _updateLocation ();
30393038 if (!_parsingContext .inObject ()) {
30403039 _reportMismatchedEndMarker (i , ']' );
30413040 }
30423041 _parsingContext = _parsingContext .clearAndGetParent ();
3043- _currToken = JsonToken .END_OBJECT ;
3042+ _updateToken ( JsonToken .END_OBJECT ) ;
30443043 }
30453044 }
30463045}
0 commit comments