-
-
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 #745 #746
Fix #745 #746
Conversation
Hmmh. I am not sure I follow the fix -- why would the change in |
The inner class EnumDeserializer.FactoryBasedDeserializer does not handle Map keys as the JsonParser is positioned on a FIELD_NAME rather than a json value during the call to deserialize. If a module registers a general EnumDeserializer that delegates to an instance of this class obtained via EnumDeserializer.deserializerForCreator, the static factory method of the target enum is called with a null value from JsonParser.getStringValue() instead of the field name from JsonParser.getText() An example of where this happens is in the dropwizard FuzzyEnumModule (included by default). In dropwizard, simply creating a configuration with an EnumMap causes a cryptic exception: "Incorrect type of value at: myConfigurationProperty; is of type: String, expected: MyEnumType |
Thanks -- I'll see if handling of DropWizard's registration of Enum handling has been bit problematic over time, and maybe I should check into that part as well. Goal would just to be sure that core components would take care of things they should, so that external code need not work around deficiencies there. Thank you for submitting this -- I will try to figure out combination of things to solve the problem, and I am not questioning the problem itself at all. It definitely should work like you suggest. |
I looked at changing the behavior of getValueAsString initially, but that Glad to finally contribute something for a project I've loved and used for On Mon, Mar 30, 2015 at 7:51 PM, Tatu Saloranta notifications@github.com
|
@jpmeyer Yes, I totally understand and appreciate your hesitation at core changes. That's partly why I propose it, as I know more about the history and intent. :) But even with that fix there is need for more immediate change since behavior of 2.5 can't be changed. I will work on this later today or tomorrow -- thank you for the contribution, and thank you for sending CLA very fast as well (noticed it just came through, impressive!). |
Thanks again! I'll merge this into 2.5 branch as well, will be in 2.5.3. |
Allow EnumDeserializer.deserializerForCreator to deserialize map keys.