commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r534277 - in /jakarta/commons/proper/lang/trunk/src: java/org/apache/commons/lang/LocaleUtils.java test/org/apache/commons/lang/LocaleUtilsTest.java
Date Tue, 01 May 2007 23:50:01 GMT
Author: bayard
Date: Tue May  1 16:50:01 2007
New Revision: 534277

URL: http://svn.apache.org/viewvc?view=rev&rev=534277
Log:
Applying unit test/fix for LANG-328

Modified:
    jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/LocaleUtils.java
    jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/LocaleUtilsTest.java

Modified: jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/LocaleUtils.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/LocaleUtils.java?view=diff&rev=534277&r1=534276&r2=534277
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/LocaleUtils.java (original)
+++ jakarta/commons/proper/lang/trunk/src/java/org/apache/commons/lang/LocaleUtils.java Tue
May  1 16:50:01 2007
@@ -111,6 +111,9 @@
                 throw new IllegalArgumentException("Invalid locale format: " + str);
             }
             char ch3 = str.charAt(3);
+            if (ch3 == '_') {
+                return new Locale(str.substring(0, 2), "", str.substring(4));
+            }
             char ch4 = str.charAt(4);
             if (ch3 < 'A' || ch3 > 'Z' || ch4 < 'A' || ch4 > 'Z') {
                 throw new IllegalArgumentException("Invalid locale format: " + str);

Modified: jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/LocaleUtilsTest.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/LocaleUtilsTest.java?view=diff&rev=534277&r1=534276&r2=534277
==============================================================================
--- jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/LocaleUtilsTest.java
(original)
+++ jakarta/commons/proper/lang/trunk/src/test/org/apache/commons/lang/LocaleUtilsTest.java
Tue May  1 16:50:01 2007
@@ -498,4 +498,11 @@
         } catch (UnsupportedOperationException ex) {}
     }
 
+    /**
+     * Tests #LANG-328 - only language+variant
+     */
+    public void testLang328() {
+        assertValidToLocale("fr__POSIX", "fr", "", "POSIX");
+    }
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message