From d29f739fe449ecc0ebdc3e4d879475b8d7daa710 Mon Sep 17 00:00:00 2001 From: Drew Stephens Date: Thu, 23 Apr 2020 15:17:10 -0400 Subject: [PATCH] 321 inherit from mismatched input (#325) Fix #321: Make MKPE descend from MismatchedInputException --- release-notes/CREDITS-2.x | 3 +++ release-notes/VERSION-2.x | 1 + .../jackson/module/kotlin/Exceptions.kt | 16 ++++++++++++++-- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/release-notes/CREDITS-2.x b/release-notes/CREDITS-2.x index 0e315fa9..b8c606c0 100644 --- a/release-notes/CREDITS-2.x +++ b/release-notes/CREDITS-2.x @@ -47,3 +47,6 @@ Drew Stephens (dinomite@github) * Contributed fix for #281: KotlinObjectSingletonDeserializer fails to deserialize previously serialized JSON as it doesn't delegate deserializeWithType (2.11.0) + +Mateusz Stefek (MateuszStefek@github) +* Reported #321: Make MissingKotlinParameterException a descendant of MismatchedInputException diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 38b99cd9..ea265aec 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -10,6 +10,7 @@ Project: jackson-module-kotlin - Add Builder for KotlinModule #281: Hide singleton deserialization support behind a setting on the module, `singletonSupport` and enum `SingletonSupport`. Defaults to pre-2.10 behavior. +#321: Make MissingKotlinParameterException extend MismatchedInputException Kotlin updated to 1.3.61 diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/Exceptions.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/Exceptions.kt index a95d5064..d52aa122 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/Exceptions.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/Exceptions.kt @@ -1,10 +1,22 @@ package com.fasterxml.jackson.module.kotlin +import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.databind.JsonMappingException +import com.fasterxml.jackson.databind.exc.MismatchedInputException import java.io.Closeable import kotlin.reflect.KParameter /** - * Specialized [JsonMappingException] sub-class used to indicate that a mandatory Kotlin constructor parameter was missing or null. + * Specialized [JsonMappingException] sub-class used to indicate that a mandatory Kotlin constructor + * parameter was missing or null. */ -class MissingKotlinParameterException(val parameter: KParameter, val processor: Closeable? = null, val msg: String) : JsonMappingException(processor, msg) \ No newline at end of file +class MissingKotlinParameterException(val parameter: KParameter, + processor: JsonParser? = null, + msg: String) : MismatchedInputException(processor, msg) { + @Deprecated("Use main constructor", ReplaceWith("MissingKotlinParameterException(KParameter, JsonParser?, String)")) + constructor( + parameter: KParameter, + processor: Closeable? = null, + msg: String + ) : this(parameter, processor as JsonParser, msg) +}