Skip to content

Commit c899752

Browse files
authored
use new token update methods (#4599)
1 parent d357306 commit c899752

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main/java/com/fasterxml/jackson/databind/node/TreeTraversingParser.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public void close() throws IOException
9292
if (!_closed) {
9393
_closed = true;
9494
_nodeCursor = null;
95-
_currToken = null;
95+
_updateTokenToNull();
9696
}
9797
}
9898

@@ -105,7 +105,7 @@ public void close() throws IOException
105105
@Override
106106
public JsonToken nextToken() throws IOException
107107
{
108-
_currToken = _nodeCursor.nextToken();
108+
_updateToken(_nodeCursor.nextToken());
109109
if (_currToken == null) {
110110
_closed = true; // if not already set
111111
return null;
@@ -133,10 +133,10 @@ public JsonParser skipChildren() throws IOException
133133
{
134134
if (_currToken == JsonToken.START_OBJECT) {
135135
_nodeCursor = _nodeCursor.getParent();
136-
_currToken = JsonToken.END_OBJECT;
136+
_updateToken(JsonToken.END_OBJECT);
137137
} else if (_currToken == JsonToken.START_ARRAY) {
138138
_nodeCursor = _nodeCursor.getParent();
139-
_currToken = JsonToken.END_ARRAY;
139+
_updateToken(JsonToken.END_ARRAY);
140140
}
141141
return this;
142142
}

src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1641,7 +1641,7 @@ public JsonToken nextToken() throws IOException
16411641
return null;
16421642
}
16431643
}
1644-
_currToken = _segment.type(_segmentPtr);
1644+
_updateToken(_segment.type(_segmentPtr));
16451645
// Field name? Need to update context
16461646
if (_currToken == JsonToken.FIELD_NAME) {
16471647
Object ob = _currentObject();
@@ -1672,7 +1672,7 @@ public String nextFieldName() throws IOException
16721672
int ptr = _segmentPtr+1;
16731673
if ((ptr < Segment.TOKENS_PER_SEGMENT) && (_segment.type(ptr) == JsonToken.FIELD_NAME)) {
16741674
_segmentPtr = ptr;
1675-
_currToken = JsonToken.FIELD_NAME;
1675+
_updateToken(JsonToken.FIELD_NAME);
16761676
Object ob = _segment.get(ptr); // inlined _currentObject();
16771677
String name = (ob instanceof String) ? ((String) ob) : ob.toString();
16781678
_parsingContext.setCurrentName(name);

0 commit comments

Comments
 (0)