Skip to content

Fix MappingIterator trailing-token checks for root arrays - #6336

Open
king-wwwhhh wants to merge 1 commit into
FasterXML:3.xfrom
king-wwwhhh:codex/mapping-iterator-trailing-6334
Open

king-wwwhhh wants to merge 1 commit into
FasterXML:3.xfrom
king-wwwhhh:codex/mapping-iterator-trailing-6334

Conversation

@king-wwwhhh

Copy link
Copy Markdown

Fixes #6334.

MappingIterator now validates content after the closing token of a root-level wrapper array when FAIL_ON_TRAILING_TOKENS is enabled. A second root value is reported through DeserializationContext.reportTrailingTokens(), while malformed trailing input raises the parser error instead of being silently ignored.

The check is limited to root-level arrays. Nested arrays remain usable with caller-owned parsers, and disabling FAIL_ON_TRAILING_TOKENS preserves the previous behavior. Managed parsers are still closed when the trailing-content check fails.

Regression coverage includes:

  • managed root-array iteration with a second array;
  • malformed content after a managed root array;
  • a caller-owned parser with a cleared root START_ARRAY;
  • disabled-feature and nested-array controls.

Validation:

  • before the implementation, the focused suite had 2 failing regression methods and 8 passing controls;
  • FullStreamReadTest, ReadValuesTest, and ReadValuesLeakTest: 30 passed;
  • complete jackson-databind module: 7,580 passed, 0 failures, 0 errors, 1 pre-existing skip.

Local JaCoCo collection was disabled because its Windows agent could not create the workspace output file. Tests ran on Eclipse Temurin 17.0.18. Other OS/JDK combinations were not run locally.

AI assistance: Codex helped investigate, implement, and run the test matrix; the resulting behavior and diff were reviewed against the issue scope.

@gitar-bot

gitar-bot Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Checking tokens after root-array iteration when FAIL_ON_TRAILING_TOKENS is enabled could reject inputs containing additional root values or malformed trailing data.

Adds trailing-token validation for root-level wrapper arrays in MappingIterator when FAIL_ON_TRAILING_TOKENS is enabled, reporting a second root value via DeserializationContext.reportTrailingTokens() and surfacing malformed trailing input as a parser error. 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

This branch has not been deployed

No deployments
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.

MappingIterator should fail on trailing tokens after wrapper Array if FAIL_ON_TRAILING_TOKENS enabled

1 participant