-
Bug
-
Resolution: Fixed
-
P3
-
8
-
b55
-
b65
-
generic
-
generic
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, afterJDK-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.
"Returns an array of all locales for which the getInstance methods of this class can return localized instances."
In JDK 8, after
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.
- relates to
-
JDK-7171324 getAvailableLocales() of locale sensitive services should return the actual availability of locales
-
- Closed
-