Skip to content

Commit

Permalink
321 inherit from mismatched input (#325)
Browse files Browse the repository at this point in the history
Fix #321: Make MKPE descend from MismatchedInputException
  • Loading branch information
dinomite authored Apr 23, 2020
1 parent f4912f8 commit d29f739
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
3 changes: 3 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -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
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)
}

0 comments on commit d29f739

Please sign in to comment.