-
-
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
Use locale passed to ObjectMapper configuration everywhere #2554
Conversation
} | ||
|
||
@Deprecated // since 2.8 | ||
public BeanPropertyMap(boolean caseInsensitive, Collection<SettableBeanProperty> props) | ||
{ | ||
this(caseInsensitive, props, Collections.<String,List<PropertyName>>emptyMap()); | ||
//TODO what to do here? can I change the constructor even though it's deprecated? |
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.
What to do here? can I change the constructor even though it's deprecated?
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.
Odd, 3.0 should not have any deprecated ones, must have leaked via merge from 2.x (where addition of new constructor does lead to marking of old ones as deprecated). Signatures of deprecated methods should not be changed in most cases as they are strictly left for backwards compatibility (for old code that is compiled to access them).
But at the same time, deprecated methods need not support new features so using bogus (or default) Locale
would be fine.
@@ -5,6 +5,7 @@ | |||
import com.fasterxml.jackson.annotation.JsonCreator; | |||
import com.fasterxml.jackson.annotation.JsonValue; | |||
|
|||
//TODO what to do here |
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.
I'm not sure how to approach this one. We can't really pass the locale here.
But at the same time it's not causing (known) problems yet
Ok, one quick comment: one immediate problem is that we can not just change |
Hm, and when is 3.0 planned to be released? Another option would be to not change the |
@Dimezis 3.0 is still quite long from being released, at least 6 months out, so I think it would be good to address the issue in 2.x too. But I'll continue reading the code to see what other mechanisms there could be and what challenges are, and possible alternative approaches. |
Ok. So the general approach is to pass configured |
One more significant problem: currently |
Another problem: use of |
AFAIR, |
@Dimezis I am not sure I fully understand the semantics, but it seems as if At this I wonder if reducing the scope of fix would make sense: instead of fixing the name mangling rules (to correctly detect and handle lower casing, detecting boundary), perhaps it should first focus on handling "case-insensitive" use case and leaving other parts as they are. I will file a new issue for 3.0 to move |
Ok, with some tweaks I was able to reproduce the failing case for case-insensitive case. Will check that in under failing, targeting fix for 2.11. |
Allows to fix Turkish i parsing #953 (comment).
So the idea behind this fix is to propagate a proper Locale that user set during
ObjectMapper
configuration. This way, the user can decide if he wants to parse in a particular Locale.There's another consequence as well, previously, because the Json readers are cached, we could end up in a state when
Locale.getDefault()
is different than it was during reader creation. So the same reader would fail during parsing of the exact same Json it tried to parse before.Example:
Bean.class
having uppercase I in the property nameBean.class
againI deliberately didn't create unit tests for classes that use
toLowerCase(locale)
, and decided to test the wholeObjectMapper
integrated with real implementations of those.Apologies if I didn't follow some other conventions of the project, or if I'm targetting the wrong branch.