You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When trying to parse a class with a field of type UShort, the parsing fails when the value is larger than the range of a (Java) Short, but is still in the range of a UShort.
To Reproduce
Execute the following Testcase:
classTestUnsigned {
classTestClass(@JsonProperty("id") varid:UShort) {
// Empty constructorconstructor() :this(1u)
}
// Value fits into UShort, but not (Java) Shortprivateval jsonData =""" { "id": 50000 }"""
@Test
funtestJsonParsing() {
val mapper = jacksonObjectMapper()
// This will fail:val dataClassInstance = mapper.readValue<TestClass>(jsonData)
}
}
The exception is: com.fasterxml.jackson.databind.JsonMappingException: Numeric value (50000) out of range of Java short
Expected behavior
This works without exception and the value is parsed properly
Versions
Kotlin: 1.5.32
Jackson-module-kotlin: 2.15.0 (snapshot)
Jackson-databind: not sure, probably 2.15.0 as well
Describe the bug
When trying to parse a class with a field of type
UShort
, the parsing fails when the value is larger than the range of a (Java)Short
, but is still in the range of aUShort
.To Reproduce
Execute the following Testcase:
The exception is:
com.fasterxml.jackson.databind.JsonMappingException: Numeric value (50000) out of range of Java short
Expected behavior
This works without exception and the value is parsed properly
Versions
Kotlin:
1.5.32
Jackson-module-kotlin:
2.15.0
(snapshot)Jackson-databind: not sure, probably
2.15.0
as wellAdditional context
This testcase still seems to work:
https://github.com/FasterXML/jackson-module-kotlin/blob/2.15/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/UnsignedNumbersTests.kt#L36-L40
So maybe the issue does not exist for
UShort
in general but rather when they're embedded as fields into a class.The text was updated successfully, but these errors were encountered: