FasterXML / FasterXML/jackson-module-kotlin

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

Aperta
#875 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Kotlin
Stelle
1.2k
Fork
187
Merge medio
9h 48m
PR unite (30g)
16

Descrizione

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.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.