-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DeserializationFeature.READ_ENUMS_USING_TO_STRING
not dynamically changeable with 2.7
#1161
Comments
That certainly sounds like a bug: the whole idea of |
This is a tricky problem to resolve. The underlying problem is not so much that the setting was not propagated, but rather combination of this feature being used during construction of deserializer (i.e. not changeable once setting first observed, and deserialized cached), and auto-fetching of said deserializer. For the specific case you have, a work-around would be to change construction order to: MappingIterator<Data1161> iterator = mapper
.reader()
.with(DeserializationFeature.READ_ENUMS_USING_TO_STRING)
.forType(Data1161.class)
.readValues(src); which would prevent pre-fetch of deserializer before configuration values are complete. I will keep this issue open and try to figure out proper fix. |
DeserializationFeature.READ_ENUMS_USING_TO_STRING
not dynamically changeable with 2.7
hiya,
UPDATE: I cloned the master branch and tried the above proposal. it seems to have solved the issue without any regression that I could see. If you need a PR, just let me know against which branch I should send it. |
@asa-git Functionally, yes, but performance is rather bad, so deserializer uses lookup tables. |
Tks a lot for the quick patch. |
@asa-git yes, absolutely, it is better to have a work-around than failure so it's great you have one. |
Hiya,
There seems to be an issue with the ObjectReader objects not taking into account the configuration set in them instead of the main object mapper instance.
Here is a simple example:
Having this inner class:
The following will fail with an exception when parsing the enum:
to get it to work it seems we need to move the DeserializationFeature configuration to the ObjectMapper itself:
Tested with both version 2.7.1-1 and 2.7.2.
The text was updated successfully, but these errors were encountered: