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
When using @JsonCreator based classes and @ObjectId there is an UnsupportedOperationException when trying to set the returned ObjectId.
This is because of JacksonCodec:120 :
beanPropertyDefinition.getMutator().setValue(
getMutator returns by default the constructor parameter, and jackson cannot mutate (setValue) on a constructor parameter, so the exception is raised.
A simple fix would be to use the alternative method getNonConstructorMutator() in which we can get the Setter and thus, change the value without raising an exception.
In my case I'm not entirely interested in mutating the inserted POJO, but the main problem I have is the exception is constantly being written to stderr because of the line 126:
I released 4.11.0, with this addition of SLF4J. If you would like to provide a fix to the underlying issue along with tests via PR, please feel free to do so.
Hi,
When using @JsonCreator based classes and
@ObjectId
there is an UnsupportedOperationException when trying to set the returned ObjectId.This is because of JacksonCodec:120 :
getMutator
returns by default the constructor parameter, and jackson cannot mutate (setValue) on a constructor parameter, so the exception is raised.A simple fix would be to use the alternative method
getNonConstructorMutator()
in which we can get the Setter and thus, change the value without raising an exception.In my case I'm not entirely interested in mutating the inserted POJO, but the main problem I have is the exception is constantly being written to stderr because of the line 126:
Everytime the exception is raised is written to stderr and there is no logger support to disable this.
The text was updated successfully, but these errors were encountered: