FasterXML / FasterXML/jackson-module-kotlin

`DecerializationProblemHandler` is ignored when the input is invalid `null` in `KotlinValueInstantiator`

Offen
#875 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Kotlin
Sterne
1.2k
Forks
187
Ø Merge
9 Std. 48 Min.
Gemergte PRs (30 T.)
16

Beschreibung

This is an issue regarding the following comment.
https://github.com/FasterXML/jackson-module-kotlin/issues/806#issuecomment-2567288527

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.

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.