Repository navigation
Wrap non-Jackson exceptions from unknown-property handlers with property path (#6375) - #6411
Conversation
Enhance error handling in handleUnknownProperty method to catch and rethrow exceptions with additional context.
…own-property-exceptions-6375
…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]>
1 similar comment
…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
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 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 |
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:
DeserializationContext.handleUnknownProperty(), around theDeserializationProblemHandlerloop, instead of theBeanDeserializerBaseoverride. All callers now get the same handling, including non-bean ones such asMapEntryDeserializer. The defaultUnrecognizedPropertyExceptionandskipChildren()failures are no longer intercepted.WRAP_EXCEPTIONSis enabled. This removes the "path already present" heuristic, which could drop a path level for nested reads of the same type and property name.Map.Entry.DeserializationProblemHandler.handleUnknownProperty().Full test suite passes locally on JDK 17 (
./mvnw clean test).🤖 Generated with Claude Code