Skip to content

Commit

Permalink
use new token update methods (#4599)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjfanning authored Jun 25, 2024
1 parent d357306 commit c899752
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void close() throws IOException
if (!_closed) {
_closed = true;
_nodeCursor = null;
_currToken = null;
_updateTokenToNull();
}
}

Expand All @@ -105,7 +105,7 @@ public void close() throws IOException
@Override
public JsonToken nextToken() throws IOException
{
_currToken = _nodeCursor.nextToken();
_updateToken(_nodeCursor.nextToken());
if (_currToken == null) {
_closed = true; // if not already set
return null;
Expand Down Expand Up @@ -133,10 +133,10 @@ public JsonParser skipChildren() throws IOException
{
if (_currToken == JsonToken.START_OBJECT) {
_nodeCursor = _nodeCursor.getParent();
_currToken = JsonToken.END_OBJECT;
_updateToken(JsonToken.END_OBJECT);
} else if (_currToken == JsonToken.START_ARRAY) {
_nodeCursor = _nodeCursor.getParent();
_currToken = JsonToken.END_ARRAY;
_updateToken(JsonToken.END_ARRAY);
}
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ public JsonToken nextToken() throws IOException
return null;
}
}
_currToken = _segment.type(_segmentPtr);
_updateToken(_segment.type(_segmentPtr));
// Field name? Need to update context
if (_currToken == JsonToken.FIELD_NAME) {
Object ob = _currentObject();
Expand Down Expand Up @@ -1672,7 +1672,7 @@ public String nextFieldName() throws IOException
int ptr = _segmentPtr+1;
if ((ptr < Segment.TOKENS_PER_SEGMENT) && (_segment.type(ptr) == JsonToken.FIELD_NAME)) {
_segmentPtr = ptr;
_currToken = JsonToken.FIELD_NAME;
_updateToken(JsonToken.FIELD_NAME);
Object ob = _segment.get(ptr); // inlined _currentObject();
String name = (ob instanceof String) ? ((String) ob) : ob.toString();
_parsingContext.setCurrentName(name);
Expand Down

0 comments on commit c899752

Please sign in to comment.