Hi,

An IKVM user reported a bug that was caused by the default Locale not being 
equal to a manually constructed Locale with the same properties.

It looks like this is caused by the fact that the Locale constructor doesn't 
intern the strings passed in when it is constructing the default Locale. I'm a 
bit surprised that this hasn't been caught earlier though, so I'm wondering if 
there is something I'm missing.

Anyway, attached is a patch that fixes this. If nobody objects I will commit 
this.

Regards,
Jeroen

2007-11-08  Jeroen Frijters  <[EMAIL PROTECTED]>

        * java/util/Locale.java
        (Locale): Always intern strings.

Index: Locale.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/Locale.java,v
retrieving revision 1.38
diff -u -r1.38 Locale.java
--- Locale.java 2 Jan 2007 21:40:20 -0000       1.38
+++ Locale.java 8 Nov 2007 06:10:53 -0000
@@ -324,13 +324,12 @@
     // default locale.
     if (defaultLocale != null)
       {
-        language = convertLanguage(language).intern();
-        country = country.toUpperCase().intern();
-        variant = variant.intern();
-      }
-    this.language = language;
-    this.country = country;
-    this.variant = variant;
+        language = convertLanguage(language);
+        country = country.toUpperCase();
+      }
+    this.language = language.intern();
+    this.country = country.intern();
+    this.variant = variant.intern();
     hashcode = language.hashCode() ^ country.hashCode() ^ variant.hashCode();
   }
 

Reply via email to