Skip to content

Commit 006cfba

Browse files
committed
Update parsers to use _updateTokenToNull() instead of _currToken = null
1 parent e4eb941 commit 006cfba

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3804,7 +3804,7 @@ protected JsonToken _eofAsNextToken() throws IOException {
38043804
// 30-Jan-2021, tatu: But also MUST verify that end-of-content is actually
38053805
// allowed (see [dataformats-binary#240] for example)
38063806
_handleEOF();
3807-
return (_currToken = null);
3807+
return _updateTokenToNull();
38083808
}
38093809

38103810
/*

smile/src/main/java/com/fasterxml/jackson/dataformat/smile/SmileParser.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ public JsonToken nextToken() throws IOException
487487
if (_currToken == null) {
488488
return _nextAfterHeader();
489489
}
490-
return (_currToken = null);
490+
return _updateTokenToNull();
491491
}
492492
_reportError("Unrecognized token byte 0x3A (malformed segment header?");
493493
}
@@ -547,7 +547,7 @@ public JsonToken nextToken() throws IOException
547547
_tokenIncomplete = true;
548548
return (_currToken = JsonToken.VALUE_EMBEDDED_OBJECT);
549549
case 0x1F: // 0xFF, end of content
550-
return (_currToken = null);
550+
return _updateTokenToNull();
551551
}
552552
break;
553553
}
@@ -577,7 +577,7 @@ private JsonToken _nextAfterHeader() throws IOException
577577
if ((_inputPtr < _inputEnd) || _loadMore()) {
578578
if (_inputBuffer[_inputPtr] == SmileConstants.HEADER_BYTE_1) {
579579
// danger zone; just set and return null token
580-
return (_currToken = null);
580+
return _updateTokenToNull();
581581
}
582582
}
583583
// Otherwise safe enough to do recursion
@@ -3117,7 +3117,7 @@ private final JsonToken _eofAsNextToken() throws IOException {
31173117
_handleEOF();
31183118
}
31193119
close();
3120-
return (_currToken = null);
3120+
return _updateTokenToNull();
31213121
}
31223122

31233123
private void createChildArrayContext(final int lineNr, final int colNr) throws IOException {

smile/src/main/java/com/fasterxml/jackson/dataformat/smile/async/NonBlockingByteArrayParser.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ protected JsonToken _finishHeader(int state) throws IOException
388388
_mayContainRawBinary = ((ch & SmileConstants.HEADER_BIT_HAS_RAW_BINARY) != 0);
389389
}
390390
_majorState = MAJOR_ROOT;
391-
_currToken = null;
391+
_updateTokenToNull();
392392

393393
// Mild difference here: initial marker not reported separately, but in-line
394394
// ones need to be reported as `null` tokens as they are logical document end
@@ -503,7 +503,7 @@ private final JsonToken _startValue(int ch) throws IOException
503503
// should we validate this is legal? (as per header)
504504
return _startRawBinary();
505505
case 0x1F: // 0xFF, end of content
506-
return (_currToken = null);
506+
return _updateTokenToNull();
507507
}
508508
break;
509509
}

smile/src/main/java/com/fasterxml/jackson/dataformat/smile/async/NonBlockingParserBase.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ protected NonBlockingParserBase(IOContext ctxt, int parserFeatures, int smileFea
148148
// We don't need a lot; for most things maximum known a-priori length below 70 bytes
149149
_inputCopy = ctxt.allocReadIOBuffer(500);
150150

151-
_currToken = null;
151+
_updateTokenToNull();
152152
_majorState = MAJOR_INITIAL;
153153
}
154154

@@ -590,7 +590,7 @@ protected final JsonToken _eofAsNextToken() throws IOException {
590590
_handleEOF();
591591
}
592592
close();
593-
return (_currToken = null);
593+
return _updateTokenToNull();
594594
}
595595

596596
protected final JsonToken _valueComplete(JsonToken t) throws IOException

0 commit comments

Comments
 (0)