Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8001562

Collator.getAvailableLocales() doesn't return all locales for which localized instances are available

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Introduced In Build:
      b55
    • Introduced In Version:
      8
    • Resolved In Build:
      b65
    • CPU:
      generic
    • OS:
      generic

      Description

      The javadoc for Collator.getAvailableLocales() says:

      "Returns an array of all locales for which the getInstance methods of this class can return localized instances."

      In JDK 8, after JDK-7171324, many locales have been removed from the returned array, but localized instances could still be obtained for them.

      For example, both Collator.newInstance(Locale.JAPAN) and Collator.newInstance(Locale.JAPANESE) return a collator localized for Japanese, but only Locale.JAPANESE is in the returned array, so getAvailableLocales() doesn't return *all* locales for which localized instances could be obtained.

      This may cause compatibility problems for existing applications that use collators. If they check getAvailableLocales() before creating collators, they may work fine in ja_JP locale (and others) on JDK 7 and earlier, and stop working in that locale when they upgrade to JDK 8.

      For the applications that check the return value of getAvailableLocales() it's probably better if it returns all the locales it used to return in JDK 7.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                naoto Naoto Sato
                Reporter:
                khatlen Knut Anders Hatlen
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: