Skip to content
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

StringUtils.parseLocaleString: locale variant cannot contain country code [SPR-11806] #16426

spring-projects-issues opened this issue May 19, 2014 · 1 comment
in: core status: backported type: bug


Copy link

@spring-projects-issues spring-projects-issues commented May 19, 2014

John Olmstead opened SPR-11806 and commented

The StringUtils.parseLocaleString method fails to correctly parse the variant if the variant contains the same characters as the country code. This is due to the fact that the lastIndexOf the country code is used as the dividing point instead of the first indexOf.

Here is the test to add to org.springframework.util.StringUtilsTest:

public void testParseLocaleWithVarientContainingCountryCode() throws Exception {
    final String variant = "GBtest";
    final String localeString = "en_GB_" + variant;
    Locale locale = StringUtils.parseLocaleString(localeString);
    assertEquals("Variant containing country code not extracted correctly.", variant, locale.getVariant());

Affects: 3.2.8, 4.0.4

Backported to: 3.2.9

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented May 19, 2014

Juergen Hoeller commented

Reported just in time for 4.0.5 & 3.2.9... Fixed in master now, to be available in the upcoming 4.0.5 & 3.2.9 snapshots in about an hour.


@spring-projects-issues spring-projects-issues added type: bug status: backported in: core labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.0.5 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: core status: backported type: bug
None yet

No branches or pull requests

2 participants