After Upgrading to 2.11, Cannot construct instance of MyEnum, problem: argument type mismatch. READ_UNKNOWN_ENUM_VALUES_AS_NULL= true does not fix it #2819
Labels
need-test-case
To work on issue, a reproduction (ideally unit test) needed
So this issue only seems to occur on 2.11, 2.10 works fine and does not throw an exception.
I have the following model with the enum Status
Due to an unrelated issue, sometimes an Integer is passed to the Status field, which obviously shouldn't work. However on 2.10, it just ignored it and the field was left as null. Now after upgrading to 2.11 i am having this problem, I see in this linked issue, it seems like that past behaviour was actually a bug #2737
I tried setting READ_UNKNOWN_ENUM_VALUES_AS_NULL=true to allow this to fail gracefully and not throw an exception but it didnt seem to do anything. Am I expecting that config value to do something it doesn't?
Here is my stack trace
Caused by: com.fasterxml.jackson.databind.exc.ValueInstantiationException: Cannot construct instance of
package.StatusEnum
, problem: argument type mismatchat [Source: (PushbackInputStream); line: 1, column: 11] (through reference chain: package.TaskTreeResponseVM["status"])
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.deserializeFromObject(BeanDeserializer.java:371)
at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:164)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4482)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3487)
at org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter.readJavaType(AbstractJackson2HttpMessageConverter.java:269)
... 10 more
The text was updated successfully, but these errors were encountered: