You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Pascal Schumacher (JIRA)" <ji...@apache.org> on 2016/08/22 18:03:20 UTC

[jira] [Commented] (LANG-1260) LocaleUtils.toLocale() produces arbitrary locales

    [ https://issues.apache.org/jira/browse/LANG-1260?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15431308#comment-15431308 ] 

Pascal Schumacher commented on LANG-1260:
-----------------------------------------

This was changed with https://github.com/apache/commons-lang/commit/8ea0c0284810bd6ec00f608be31abd20dbd4b72b for [LANG-915]

> 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)