Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-328

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3
    • Fix Version/s: 2.4
    • Component/s: None
    • Labels:
      None

      Description

      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.

        Attachments

        1. LANG-328.patch
          1 kB
          Henri Yandell

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ebourg Emmanuel Bourg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: