Repository navigation
Report end of input after property name as MismatchedInputException - #6376
Conversation
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>
…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>
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 VerificationRules No rules evaluated Functional validation Not enabledFor more verification details, comment OptionsAuto-apply is off → Gitar will not commit updates to this branch. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
A token stream that ends right after a property name, which is possible with
TokenBuffer, leaves value deserializers with no current token.StdDeserializer._parseString()calledp.currentToken().isScalarValue()without a null check, soStringand other values going through that method failed with aDatabindExceptionwrapping an NPE, instead of reporting a problem with the input.Changes
_parseString()now checks for a null token, and falls through to the existingctxt.handleUnexpectedToken(...)call, which throwsMismatchedInputException.Tests
EndOfInputAfterPropertyNameTest(new) has 52 cases covering primitives and wrappers,String, enums, dates, POJOs, records, collections, maps, arrays,Optional,ObjectandJsonNode. Before the fix 5 cases failed, all at this line; the other 47 already threwMismatchedInputException.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
BeanDeserializerandBuilderBasedDeserializerskip external type id handling when no token remainsByteBufferDeserializerreports an unexpected token when the parser has no current tokencopyCurrentStructure()throwsUnexpectedEndOfInputExceptionwhen input ends after a property nameFactoryBasedEnumDeserializerpasses the token itself into mismatch messages instead oft.name()MismatchedInputException#6376 inrelease-notes/VERSIONThis will update automatically on new commits.