提交 5f3c7ca5 编写于 作者: A Arjen Poutsma

Fix NullPointerException in Jackson2SmileDecoder

Fix uncommon case in Jackson2SmileDecoder, where a null token,
incicating a document separator in streaming mode, is followed by
NOT_AVAILABLE.

Closes gh-24009
上级 a79eaded
......@@ -122,13 +122,18 @@ final class Jackson2Tokenizer {
private List<TokenBuffer> parseTokenBufferFlux() throws IOException {
List<TokenBuffer> result = new ArrayList<>();
while (true) {
// SPR-16151: Smile data format uses null to separate documents
boolean previousNull = false;
while (!this.parser.isClosed()) {
JsonToken token = this.parser.nextToken();
// SPR-16151: Smile data format uses null to separate documents
if (token == JsonToken.NOT_AVAILABLE ||
(token == null && (token = this.parser.nextToken()) == null)) {
token == null && previousNull) {
break;
}
else if (token == null ) { // !previousNull
previousNull = true;
continue;
}
updateDepth(token);
if (!this.tokenizeArrayElements) {
processTokenNormal(token, result);
......@@ -169,6 +174,9 @@ final class Jackson2Tokenizer {
private void processTokenArray(JsonToken token, List<TokenBuffer> result) throws IOException {
if (!isTopLevelArrayToken(token)) {
if (!this.parser.hasCurrentToken()) {
System.out.println("NO CURRENT TOKEN: " + token);
}
this.tokenBuffer.copyCurrentEvent(this.parser);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册