commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject [43/50] [lang] LANG-1312: LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3 area code followed by variant
Date Mon, 17 Apr 2017 12:20:06 GMT
LANG-1312: LocaleUtils#toLocale does not support language followed by UN M.49 numeric-3 area
code followed by variant


Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/fb480362
Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/fb480362
Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/fb480362

Branch: refs/heads/release
Commit: fb4803623b8f089a8dfd265a68461f4283e7ffad
Parents: dfecbe9
Author: Benedikt Ritter <britter@apache.org>
Authored: Mon Apr 17 12:55:42 2017 +0200
Committer: Benedikt Ritter <britter@apache.org>
Committed: Mon Apr 17 12:55:42 2017 +0200

----------------------------------------------------------------------
 src/changes/changes.xml                                     | 1 +
 src/main/java/org/apache/commons/lang3/LocaleUtils.java     | 2 +-
 src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java | 4 ++++
 3 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-lang/blob/fb480362/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 14f3ca4..5724717 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
   <body>
 
   <release version="3.6" date="2017-MM-DD" description="TBD">
+    <action issue="LANG-1312" type="fix" dev="britter">LocaleUtils#toLocale does not
support language followed by UN M.49 numeric-3 area code followed by variant</action>
     <action issue="LANG-1300" type="fix" dev="chtompki" due-to="Mark Dacek">Clarify
or improve behaviour of int-based indexOf methods in StringUtils</action>
     <action issue="LANG-1299" type="add" dev="djones">Add method for converting string
to an array of code points</action>
     <action issue="LANG-1286" type="fix" dev="djones">RandomStringUtils random method
can overflow and return characters outside of specified range</action>

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/fb480362/src/main/java/org/apache/commons/lang3/LocaleUtils.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/lang3/LocaleUtils.java b/src/main/java/org/apache/commons/lang3/LocaleUtils.java
index 57f5079..af0731f 100644
--- a/src/main/java/org/apache/commons/lang3/LocaleUtils.java
+++ b/src/main/java/org/apache/commons/lang3/LocaleUtils.java
@@ -150,7 +150,7 @@ public class LocaleUtils {
             final String country = segments[1];
             final String variant = segments[2];
             if (isISO639LanguageCode(language) &&
-                    (country.length() == 0 || isISO3166CountryCode(country)) &&
+                    (country.length() == 0 || isISO3166CountryCode(country) || isNumericAreaCode(country))
&&
                     variant.length() > 0) {
                 return new Locale(language, country, variant);
             }

http://git-wip-us.apache.org/repos/asf/commons-lang/blob/fb480362/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java
index 79198af..bbb93de 100644
--- a/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java
+++ b/src/test/java/org/apache/commons/lang3/LocaleUtilsTest.java
@@ -510,6 +510,10 @@ public class LocaleUtilsTest  {
         assertValidToLocale("en_001", "en", "001");
         assertValidToLocale("en_150", "en", "150");
         assertValidToLocale("ar_001", "ar", "001");
+
+        // LANG-1312
+        assertValidToLocale("en_001_GB", "en", "001", "GB");
+        assertValidToLocale("en_150_US", "en", "150", "US");
     }
 
     /**


Mime
View raw message