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
I am facing an error after updating from Version 2.10.1 to 2.11.3:
com.fasterxml.jackson.databind.exc.ValueInstantiationException: Cannot construct instance of NumberEnum, problem: argument type mismatch
at [Source: (String)"{
"myNumber" : 2
}"; line: 2, column: 16] (through reference chain: Demo["myNumber"])
at com.fasterxml.jackson.databind.exc.ValueInstantiationException.from(ValueInstantiationException.java:47)
at com.fasterxml.jackson.databind.DeserializationContext.instantiationException(DeserializationContext.java:1758)
at com.fasterxml.jackson.databind.DeserializationContext.handleInstantiationProblem(DeserializationContext.java:1128)
at com.fasterxml.jackson.databind.deser.std.FactoryBasedEnumDeserializer.deserialize(FactoryBasedEnumDeserializer.java:159)
at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeAndSet(MethodProperty.java:129)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(BeanDeserializer.java:293)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:156)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4526)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3468)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3436)
at EnumMapperTest.test(EnumMapperTest.java:16)
It seems there was a change in handling the datatype while deserializing an enum (in FactoryBasedEnumSererializer.java).
Using Integer instead of String as an argument of "fromValue" fixes the Problem in both V2.10.1 and V2.11.3.
Unfortunately this code is generated from an openapi schema via swagger-codegen. I will create a similar issue there but want to share this finding here, so you can be beware of it.
I am facing an error after updating from Version 2.10.1 to 2.11.3:
It seems there was a change in handling the datatype while deserializing an enum (in FactoryBasedEnumSererializer.java).
In my case, I annotated a factory method for an Integer-Enum like so:
https://github.com/comlinegmbh/jackson-enum-poc/blob/master/src/main/java/NumberEnum.java
Using Integer instead of String as an argument of "fromValue" fixes the Problem in both V2.10.1 and V2.11.3.
Unfortunately this code is generated from an openapi schema via swagger-codegen. I will create a similar issue there but want to share this finding here, so you can be beware of it.
I have also created a small example-project so you can comprehend this issue easily:
https://github.com/comlinegmbh/jackson-enum-poc
Switching the Version in the pom.xml makes the unit-test succeed.
Feel free to let me know if this is no bug but the new intended behavior.
The text was updated successfully, but these errors were encountered: