Skip to content

StdValueInstantiator unwraps exceptions, losing context #432

@milesk-amzn

Description

@milesk-amzn

When using ObjectMapper to create objects, if the constructor throws an exception, it is "unwrapped" such that the JsonMappingException's direct cause is the innermost exception. This potentially loses important context that had been added to the exception chain by the constructor, such as which property the exception applied to.

https://github.com/FasterXML/jackson-databind/blob/master/src/main/java/com/fasterxml/jackson/databind/deser/std/StdValueInstantiator.java#L440

I'm not entirely clear on why StdValueInstantiator is looking for an existing JsonMappingException in the exception chain rather than just unconditionally wrapping the outermost exception directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions