Skip to content

Wrap non-Jackson exceptions from unknown-property handlers with property path (#6375) - #6411

Merged
cowtowncoder merged 11 commits into
3.xfrom
fix/unknown-property-exceptions-6375
Nov 7, 2026
Merged

cowtowncoder merged 11 commits into
3.xfrom
fix/unknown-property-exceptions-6375

Conversation

@cowtowncoder

Copy link
Copy Markdown
Member

Fixes #6375. Supersedes #6378: it includes all of that PR's commits by @wozhenbang2004, plus follow-up changes. #6378's branch does not allow maintainer edits, so the follow-ups could not be pushed there.

Changes on top of #6378:

  • Moved wrapping into DeserializationContext.handleUnknownProperty(), around the DeserializationProblemHandler loop, instead of the BeanDeserializerBase override. All callers now get the same handling, including non-bean ones such as MapEntryDeserializer. The default UnrecognizedPropertyException and skipChildren() failures are no longer intercepted.
  • Jackson exceptions from handlers are left unmodified. Only non-Jackson exceptions are wrapped with the bean/property path, and only when WRAP_EXCEPTIONS is enabled. This removes the "path already present" heuristic, which could drop a path level for nested reads of the same type and property name.
  • Tests simplified (13 → 5) and switched to text blocks; added coverage for POJO-shaped Map.Entry.
  • Release notes reworded to reference DeserializationProblemHandler.handleUnknownProperty().

Full test suite passes locally on JDK 17 (./mvnw clean test).

🤖 Generated with Claude Code

wozhenbang2004 and others added 8 commits November 2, 2026 01:46
Enhance error handling in handleUnknownProperty method to catch and rethrow exceptions with additional context.
…own-property-exceptions-6375

# Conflicts:
#	release-notes/CREDITS
…Context

Wrap/annotate exceptions thrown by `DeserializationProblemHandler.handleUnknownProperty()`
in `DeserializationContext.handleUnknownProperty()` instead of the
`BeanDeserializerBase` override, so that all callers (like `MapEntryDeserializer`)
get the same handling, and the default `UnrecognizedPropertyException` and
`skipChildren()` failures are no longer touched.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Only wrap non-Jackson exceptions thrown by
`DeserializationProblemHandler.handleUnknownProperty()`: Jackson exceptions are
rethrown as-is, without adding a path entry. This removes the heuristic
"already has this path entry" check, which could drop a path level for nested
reads of the same type and property. Simplify tests accordingly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cowtowncoder cowtowncoder added this to the 3.3.0 milestone Nov 7, 2026
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 83.12% 📈 +0.000%
Branches branches 77.33% 📈 +0.000%

Coverage data generated from JaCoCo test results

1 similar comment
@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 83.12% 📈 +0.000%
Branches branches 77.33% 📈 +0.000%

Coverage data generated from JaCoCo test results

cowtowncoder and others added 2 commits November 6, 2026 20:03
…erty handlers

- Take location of wrapped exception from the parser passed to the handler
  (may be a TokenBuffer replay parser), not the context's top-level parser
- Also wrap (sneaky-thrown) checked exceptions from handlers
- Simplify handler loop to a single try/catch
- Add tests for location, checked exceptions and path through outer levels

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…terXML/jackson-databind into fix/unknown-property-exceptions-6375
@gitar-bot

gitar-bot Bot commented Nov 7, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Wrapping non-Jackson exceptions from unknown-property handlers as path-bearing DatabindExceptions could change caller exception handling during deserialization.

Wraps non-Jackson exceptions thrown by unknown-property handlers with the bean and property path, moving the logic into DeserializationContext.handleUnknownProperty() so all callers are covered, and leaves Jackson exceptions unmodified. 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

@github-actions

github-actions Bot commented Nov 7, 2026

Copy link
Copy Markdown

🧪 Code Coverage Report

Metric Coverage Change
Instructions coverage 83.12% 📈 +0.000%
Branches branches 77.32% 📉 -0.010%

Coverage data generated from JaCoCo test results

@cowtowncoder
cowtowncoder merged commit ed64ebe into 3.x Nov 7, 2026
7 checks passed
@cowtowncoder
cowtowncoder deleted the fix/unknown-property-exceptions-6375 branch November 7, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wrap non-Jackson exceptions from BeanDeserializerBase.handleUnknownProperty()

2 participants