Skip to content

Commit

Permalink
First part of fix for #2525 (wrt TokenBuffer)
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 25, 2019
1 parent 86f8560 commit d569992
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1583,6 +1583,8 @@ public JsonToken nextToken() throws IOException
|| _currToken == JsonToken.END_ARRAY) {
// Closing JSON Object/Array? Close matching context
_parsingContext = _parsingContext.parentOrCopy();
} else {
_parsingContext.updateForValue();
}
return _currToken;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@ public static TokenBufferReadContext createRootContext(JsonStreamContext origCon
}

public TokenBufferReadContext createChildArrayContext() {
// For current context there will be one next Array value, first:
++_index;
return new TokenBufferReadContext(this, TYPE_ARRAY, -1);
}

public TokenBufferReadContext createChildObjectContext() {
// For current context there will be one next Object value, first:
++_index;
return new TokenBufferReadContext(this, TYPE_OBJECT, -1);
}

Expand Down Expand Up @@ -132,4 +136,17 @@ public TokenBufferReadContext parentOrCopy() {
public void setCurrentName(String name) throws JsonProcessingException {
_currentName = name;
}

/*
/**********************************************************
/* Extended support for context updates
/**********************************************************
*/

/**
* @since 2.10.1
*/
public void updateForValue() {
++_index;
}
}

0 comments on commit d569992

Please sign in to comment.