-
-
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
Fix : Case insensitive and number based enum deserialization #3802
Fix : Case insensitive and number based enum deserialization #3802
Conversation
For above reason, if we are not confident about test cases, we might want to approach like below. } else {
if (Boolean.TRUE.equals(_caseInsensitive)) {
Object match = lookup.findCaseInsensitive(name);
if (match != null) {
return match;
}
// newly added ----------------------------------------
if (!ctxt.isEnabled(DeserializationFeature.FAIL_ON_NUMBERS_FOR_ENUMS)
&& !_isFromIntValue) {
<< same index parsing logic like below >>
}
} else if (!ctxt.isEnabled(DeserializationFeature.FAIL_ON_NUMBERS_FOR_ENUMS)
&& !_isFromIntValue) {
<< index parsing logic that already existed >>
}
} |
If anyone upgrades jackson and have been inadvertently relying on the broken logic in the old versions, they can change their mapper config to fix things (by changing which DeserializationFeatures they set). |
True true 👍🏻 Thanks, @pjfanning ! |
/********************************************************** | ||
*/ | ||
|
||
public void testCaseSensitive() throws JsonProcessingException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Going forward, let's just expose Exception
-- this only because 3.0 (master
) removes JsonProcessingException
(and makes Jackson exceptions unchecked) and using Exception
removes one incompatibility wrt merging of changes.
(I'll change this no need to modify PR)
Thank you @JooHyukKim ! |
Summary
Description
if (!ctxt.isEnabled(DeserializationFeature.FAIL_ON_NUMBERS_FOR_ENUMS) && !_isFromIntValue) {
part to outer.