changeset 2931:39351e11b8f9

6986612: pit jdk7 b112: java.util.Locale getDisplayVariant() sqe test getDisplayVariantTests.java fails Reviewed-by: dougfelt Contributed-by: Yoshito Umaoka <y.umaoka@gmail.com>
author naoto
date Thu, 23 Sep 2010 20:05:20 -0700
parents c650dd9e6be2
children b57ca6031a35
files src/share/classes/java/util/Locale.java src/share/classes/sun/util/locale/BaseLocale.java
diffstat 2 files changed, 11 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/util/Locale.java	Tue Sep 21 10:04:41 2010 +0400
+++ b/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/src/share/classes/sun/util/locale/BaseLocale.java	Tue Sep 21 10:04:41 2010 +0400
+++ b/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);