Skip to content

Commit eeaed56

Browse files
committed
Minor tweaks
1 parent 2cf1592 commit eeaed56

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,9 @@ public void close() throws IOException {
770770
_closed = true;
771771
_symbols.release();
772772
// 30-May-2025, tatu: was missing before 2.20
773-
_currToken = null;
773+
if (JsonParser.Feature.CLEAR_CURRENT_TOKEN_ON_CLOSE.enabledIn(_features)) {
774+
_currToken = null;
775+
}
774776
try {
775777
_closeInput();
776778
} finally {

ion/src/main/java/com/fasterxml/jackson/dataformat/ion/IonParser.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,10 @@ public boolean isClosed() {
254254
@Override
255255
public void close() throws IOException {
256256
if (!_closed) {
257+
// 30-May-2025, tatu: was missing before 2.20
258+
if (JsonParser.Feature.CLEAR_CURRENT_TOKEN_ON_CLOSE.enabledIn(_features)) {
259+
_currToken = null;
260+
}
257261
// should only close if manage the resource
258262
if (_ioContext.isResourceManaged()) {
259263
Object src = _ioContext.contentReference().getRawContent();
@@ -448,6 +452,10 @@ private void _verifyIsNumberToken() throws IOException
448452
}
449453
}
450454

455+
// NOTE: Ion implementation follows original (up to 2.19) JsonParser Javadocs
456+
// behavior (if non-number, return `null`), which is different from other
457+
// backends (if non-number, throw exception). But since 3.0 will switch to
458+
// "return null for non-numbers", Ion behavior is retained in 2.20+.
451459
@Override
452460
public NumberType getNumberType() throws IOException
453461
{

0 commit comments

Comments
 (0)