Skip to content

Report end of input after property name as MismatchedInputException - #6376

Merged
cowtowncoder merged 3 commits into
3.xfrom
fix-eoi-after-property-name
Nov 2, 2026
Merged

cowtowncoder merged 3 commits into
3.xfrom
fix-eoi-after-property-name

Conversation

@cowtowncoder

@cowtowncoder cowtowncoder commented Nov 2, 2026 •

Copy link
Copy Markdown
Member

A token stream that ends right after a property name, which is possible with TokenBuffer, leaves value deserializers with no current token. StdDeserializer._parseString() called p.currentToken().isScalarValue() without a null check, so String and other values going through that method failed with a DatabindException wrapping an NPE, instead of reporting a problem with the input.

Changes

  • _parseString() now checks for a null token, and falls through to the existing ctxt.handleUnexpectedToken(...) call, which throws MismatchedInputException.

Tests

EndOfInputAfterPropertyNameTest (new) has 52 cases covering primitives and wrappers, String, enums, dates, POJOs, records, collections, maps, arrays, Optional, Object and JsonNode. Before the fix 5 cases failed, all at this line; the other 47 already threw MismatchedInputException.

The full suite passes locally on the default JDK: 7725 tests, 1 skipped, no failures.

Found while working on FasterXML/jackson-modules-base#371, where Afterburner matches this stock behavior.

🤖 Generated with Claude Code


Summary by Gitar

  • Null token checks:
    • BeanDeserializer and BuilderBasedDeserializer skip external type id handling when no token remains
    • ByteBufferDeserializer reports an unexpected token when the parser has no current token
  • TokenBuffer:
    • copyCurrentStructure() throws UnexpectedEndOfInputException when input ends after a property name
  • Enum errors:
    • FactoryBasedEnumDeserializer passes the token itself into mismatch messages instead of t.name()
  • Release notes:

This will update automatically on new commits.

cowtowncoder and others added 2 commits November 1, 2026 18:05
A token stream ending right after a property name (possible with `TokenBuffer`)
left `StdDeserializer._parseString()` with no current token: resulting NPE got
wrapped as `DatabindException`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 83.02% 📈 +0.010%
Branches branches 77.18% 📈 +0.070%

Coverage data generated from JaCoCo test results

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 83.02% 📈 +0.010%
Branches branches 77.16% 📈 +0.050%

Coverage data generated from JaCoCo test results

…paths

Same problem as with `StdDeserializer._parseString()`: token stream ending right
after a property name leaves no current token, resulting in NPE (or, for
`ByteBuffer`, low-level parser exception). Covers regular properties of types with
External Type Id (POJO, Creator- and Builder-based), Enums with factory Creators,
`ByteBuffer` and `TokenBuffer.copyCurrentStructure()`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gitar-bot

gitar-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Handling missing tokens in deserialization paths changes malformed-input exceptions, which could affect callers that distinguish exception types.

Reports end of input after a property name as MismatchedInputException instead of a wrapped NPE, with null-token guards added to _parseString(), BeanDeserializer, BuilderBasedDeserializer, and ByteBufferDeserializer, and TokenBuffer.copyCurrentStructure() now throwing UnexpectedEndOfInputException in that case. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@cowtowncoder
cowtowncoder merged commit 67af1ef into 3.x Nov 2, 2026
5 checks passed
@cowtowncoder
cowtowncoder deleted the fix-eoi-after-property-name branch November 2, 2026 02:51
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 83.03% 📈 +0.020%
Branches branches 77.20% 📈 +0.090%

Coverage data generated from JaCoCo test results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant