Skip to content

Locale deserialize for java {language}_{country}_({variant}_# | #){script}-{extensions} #1949

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

Closed
wants to merge 1 commit into from

Conversation

takeseem
Copy link

Fix #1948 Locale deserialize for java {language}{country}({variant}_#
| #){script}-{extensions}


int pos1 = value.indexOf('_');
if (pos1 == -1) { // It is not java;
return null;
Copy link
Member

@cowtowncoder cowtowncoder Feb 28, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong. You can not arbitrarily return null for something unrecognized: that should return in an exception.

@@ -142,6 +142,14 @@ public void testLocale() throws IOException
// [databind#1123]
Locale loc = MAPPER.readValue(quote(""), Locale.class);
assertSame(Locale.ROOT, loc);

// [databind #1948]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be better to include a longer list of variants that should be supported.
Also: shouldn't both underscore and hyphen be accepted? If not, why?

config: System.setProperty("jackson.std.locale.de.java", "not empty")
@takeseem
Copy link
Author

takeseem commented Mar 1, 2018

Thank you.

my patch is not mature. I will commit in later.

@takeseem takeseem closed this Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants