Skip to content

DecerializationProblemHandler is ignored when the input is invalid null in KotlinValueInstantiator #875

Description

@k163377

This is an issue regarding the following comment.
#806 (comment)

Currently KotlinValueInstantiator.createFromObjectWith throws an exception directly if the input is an illegal null.
https://github.com/FasterXML/jackson-module-kotlin/blob/9d4ad6a5e85bc5eb58f69700199c7cee776d2f86/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinValueInstantiator.kt

On the other hand, databind calls DeserializationContext.handleInstantiationProblem(DeserializationProblemHandler.handleInstantiationProblem).
https://github.com/FasterXML/jackson-databind/blob/f624751d3c4c13405c8d07051b8954a691f265f7/src/main/java/com/fasterxml/jackson/databind/deser/std/StdValueInstantiator.java#L284-L295

Therefore, KotlinValueInstantiator should be modified as follows

  1. If paramVal is an illegal null, call DeserializationContext.handleInstantiationProblem
    • If not handled or if it is a custom error, throw and exit
  2. If the result of the call of 1 was a value, continue deserialization using that value

Note that the error caused by strictNullCheck is assumed to be excluded from the correction because the process will be eliminated from KotlinValueInstantiator when the #719 correction is made.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions