6986612: pit jdk7 b112: java.util.Locale getDisplayVariant() sqe test getDisplayVariantTests.java fails
Reviewed-by: dougfelt
Contributed-by: Yoshito Umaoka <y.umaoka@gmail.com>
--- a/jdk/src/share/classes/java/util/Locale.java Tue Sep 21 10:04:41 2010 +0400
+++ b/jdk/src/share/classes/java/util/Locale.java Thu Sep 23 20:05:20 2010 -0700
@@ -569,6 +569,9 @@
* @exception NullPointerException thrown if any argument is null.
*/
public Locale(String language, String country, String variant) {
+ if (language== null || country == null || variant == null) {
+ throw new NullPointerException();
+ }
_baseLocale = BaseLocale.getInstance(convertOldISOCodes(language), "", country, variant);
_extensions = getCompatibilityExtensions(language, "", country, variant);
}
--- a/jdk/src/share/classes/sun/util/locale/BaseLocale.java Tue Sep 21 10:04:41 2010 +0400
+++ b/jdk/src/share/classes/sun/util/locale/BaseLocale.java Thu Sep 23 20:05:20 2010 -0700
@@ -64,12 +64,14 @@
public static BaseLocale getInstance(String language, String script, String region, String variant) {
// JDK uses deprecated ISO639.1 language codes for he, yi and id
- if (AsciiUtil.caseIgnoreMatch(language, "he")) {
- language = "iw";
- } else if (AsciiUtil.caseIgnoreMatch(language, "yi")) {
- language = "ji";
- } else if (AsciiUtil.caseIgnoreMatch(language, "id")) {
- language = "in";
+ if (language != null) {
+ if (AsciiUtil.caseIgnoreMatch(language, "he")) {
+ language = "iw";
+ } else if (AsciiUtil.caseIgnoreMatch(language, "yi")) {
+ language = "ji";
+ } else if (AsciiUtil.caseIgnoreMatch(language, "id")) {
+ language = "in";
+ }
}
Key key = new Key(language, script, region, variant);