Issue Details (XML | Word | Printable)

Key: LANG-328
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Emmanuel Bourg
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Commons Lang

LocaleUtils.toLocale() rejects strings with only language+variant

Created: 16/Apr/07 11:11 PM   Updated: 08/Aug/07 03:54 PM
Return to search
Component/s: None
Affects Version/s: 2.3
Fix Version/s: 2.4

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works LANG-328.patch 2007-05-01 11:49 PM Henri Yandell 1 kB

Resolution Date: 01/May/07 11:50 PM


 Description  « Hide
LocaleUtils.toLocale() throws an exception on strings containing a language and a variant but no country code. For example : fr__POSIX

This string can be produced with the JDK by instanciating a Locale with an empty string for the country : new Locale("fr", "", "POSIX").toString(). According to the javadoc for the Locale class a variant is allowed with just a language code or just a country code.

Commons Configuration handles this case in its PropertyConverter.toLocale() method. I'd like to replace our implementation by the one provided by LocaleUtils, but our tests fail due to this case.



 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Henri Yandell added a comment - 01/May/07 07:07 PM
Fix asap issue; so marking for 2.3.1.

Henri Yandell added a comment - 01/May/07 11:49 PM
Attaching a unit test/fix patch for this.

Henri Yandell added a comment - 01/May/07 11:50 PM
svn ci -m "Applying unit test/fix for LANG-328"
Sending src/java/org/apache/commons/lang/LocaleUtils.java
Sending src/test/org/apache/commons/lang/LocaleUtilsTest.java
Transmitting file data ..
Committed revision 534277.