Skip to content

Commit 237a2eb

Browse files
committed
Fixes wrt [core#1378]
1 parent a5093a5 commit 237a2eb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/kotlin/tools/jackson/module/kotlin/KotlinDeserializers.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ object RegexDeserializer : StdDeserializer<Regex>(Regex::class.java) {
2727
override fun deserialize(p: JsonParser, ctxt: DeserializationContext): Regex {
2828
val node = ctxt.readTree(p)
2929

30-
if (node.isTextual) {
31-
return Regex(node.asText())
30+
if (node.isString) {
31+
return Regex(node.asString())
3232
} else if (node.isObject) {
33-
val pattern = node.get("pattern").asText()
33+
val pattern = node.get("pattern").asString()
3434
val options = if (node.has("options")) {
3535
val optionsNode = node.get("options")
3636
if (!optionsNode.isArray) {
3737
throw IllegalStateException("Expected an array of strings for RegexOptions, but type was ${node.nodeType}")
3838
}
39-
optionsNode.iterator().asSequence().map { RegexOption.valueOf(it.asText()) }.toSet()
39+
optionsNode.iterator().asSequence().map { RegexOption.valueOf(it.asString()) }.toSet()
4040
} else {
4141
emptySet()
4242
}
@@ -51,7 +51,7 @@ object UByteDeserializer : StdDeserializer<UByte>(UByte::class.java) {
5151
override fun deserialize(p: JsonParser, ctxt: DeserializationContext) =
5252
p.shortValue.asUByte() ?: throw InputCoercionException(
5353
p,
54-
"Numeric value (${p.text}) out of range of UByte (0 - ${UByte.MAX_VALUE}).",
54+
"Numeric value (${p.string}) out of range of UByte (0 - ${UByte.MAX_VALUE}).",
5555
VALUE_NUMBER_INT,
5656
UByte::class.java
5757
)
@@ -61,7 +61,7 @@ object UShortDeserializer : StdDeserializer<UShort>(UShort::class.java) {
6161
override fun deserialize(p: JsonParser, ctxt: DeserializationContext) =
6262
p.intValue.asUShort() ?: throw InputCoercionException(
6363
p,
64-
"Numeric value (${p.text}) out of range of UShort (0 - ${UShort.MAX_VALUE}).",
64+
"Numeric value (${p.string}) out of range of UShort (0 - ${UShort.MAX_VALUE}).",
6565
VALUE_NUMBER_INT,
6666
UShort::class.java
6767
)
@@ -71,7 +71,7 @@ object UIntDeserializer : StdDeserializer<UInt>(UInt::class.java) {
7171
override fun deserialize(p: JsonParser, ctxt: DeserializationContext) =
7272
p.longValue.asUInt() ?: throw InputCoercionException(
7373
p,
74-
"Numeric value (${p.text}) out of range of UInt (0 - ${UInt.MAX_VALUE}).",
74+
"Numeric value (${p.string}) out of range of UInt (0 - ${UInt.MAX_VALUE}).",
7575
VALUE_NUMBER_INT,
7676
UInt::class.java
7777
)
@@ -81,7 +81,7 @@ object ULongDeserializer : StdDeserializer<ULong>(ULong::class.java) {
8181
override fun deserialize(p: JsonParser, ctxt: DeserializationContext) =
8282
p.bigIntegerValue.asULong() ?: throw InputCoercionException(
8383
p,
84-
"Numeric value (${p.text}) out of range of ULong (0 - ${ULong.MAX_VALUE}).",
84+
"Numeric value (${p.string}) out of range of ULong (0 - ${ULong.MAX_VALUE}).",
8585
VALUE_NUMBER_INT,
8686
ULong::class.java
8787
)

0 commit comments

Comments
 (0)