[
https://issues.apache.org/jira/browse/LANG-1260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15433197#comment-15433197
]
Pascal Schumacher commented on LANG-1260:
-----------------------------------------
The description of [LANG-915] claims:
{quote}... parse 3-char locale strings, which are completelly valid BCP47
locales.{quote}
> LocaleUtils.toLocale() produces arbitrary locales
> -------------------------------------------------
>
> Key: LANG-1260
> URL: https://issues.apache.org/jira/browse/LANG-1260
> Project: Commons Lang
> Issue Type: Bug
> Affects Versions: 3.4
> Reporter: Philip Mundt
>
> When passing an invalid locale string ({{len != 2 && len != 5 && len < 7}})
> to {{org.apache.commons.lang3.LocaleUtils#toLocale(String)}} the method would
> previously (3.1) throw an {{IllegalArgumentException}}.
> With version 3.4 the method will – at least for any string with {{len == 3}}
> – create an arbitrary locale:
> {code}
> // GIVEN
> String localeString = "xyz";
> // WHEN
> Locale xyz = LocaleUtils.toLocale(localeString);
> // THEN
> assertEquals(xyz.toString(), localeString); // What?
> {code}
> We are relying on this behaviour ({{IllegalArgumentException}}) and were
> quite surprised to not find any mention in the changelog.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)