Skip to content

321 inherit from mismatched input #325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,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
1 change: 1 addition & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 14 additions & 2 deletions src/main/kotlin/com/fasterxml/jackson/module/kotlin/Exceptions.kt
Original file line number Diff line number Diff line change
@@ -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)
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)
}