harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r494397 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/ main/java/org/apache/harmony/luni/internal/locale/ test/java/tests/api/java/util/
Date Tue, 09 Jan 2007 13:01:26 GMT
Author: tellison
Date: Tue Jan  9 05:01:23 2007
New Revision: 494397

URL: http://svn.apache.org/viewvc?view=rev&rev=494397
Log:
Apply patch HARMONY-2953 ([luni][util]Locale lacks some ISO countries and languages)

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Locale.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/locale/ISO3Languages.java
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/locale/Language.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LocaleTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Locale.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Locale.java?view=diff&rev=494397&r1=494396&r2=494397
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Locale.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Locale.java Tue Jan
 9 05:01:23 2007
@@ -612,31 +612,19 @@
 	 * @return an array of String
 	 */
 	public static String[] getISOCountries() {
-		ListResourceBundle bundle = new Country();
+        ListResourceBundle bundle = new Country();
 
-		boolean hasCS = false;
-		try {
-			bundle.getString("CS"); //$NON-NLS-1$
-			hasCS = true;
-		} catch (MissingResourceException e) {
-            //Empty
-		}
-
-		Enumeration<String> keys = bundle.getKeys(); // to initialize the table
-		int size = bundle.table.size();
-		if (hasCS) {
-            size--;
+        // To initialize the table
+        Enumeration<String> keys = bundle.getKeys(); 
+        int size = bundle.table.size();
+        String[] result = new String[size];
+        int index = 0;
+        while (keys.hasMoreElements()) {
+            String element = keys.nextElement();
+            result[index++] = element;
         }
-		String[] result = new String[size];
-		int index = 0;
-		while (keys.hasMoreElements()) {
-			String element = keys.nextElement();
-			if (!element.equals("CS")) {//$NON-NLS-1$
-                result[index++] = element;
-            }
-		}
-		return result;
-	}
+        return result;
+    }
 
 	/**
 	 * Gets the list of two letter ISO language codes which can be used as the

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/locale/ISO3Languages.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/locale/ISO3Languages.java?view=diff&rev=494397&r1=494396&r2=494397
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/locale/ISO3Languages.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/locale/ISO3Languages.java
Tue Jan  9 05:01:23 2007
@@ -21,14 +21,16 @@
 
 public class ISO3Languages extends java.util.ListResourceBundle {
 
+@SuppressWarnings("nls")
 protected Object[][] getContents() {
 	Object [][] contents = {
 		{"aa", "aar"},
 		{"ab", "abk"},
         {"ae", "ave"},
 		{"af", "afr"},
-        {"ak", "aka"}, //$NON-NLS-1$ //$NON-NLS-2$
+        {"ak", "aka"},
 		{"am", "amh"},
+        {"an", "arg"},
 		{"ar", "ara"},
 		{"as", "asm"},
 		{"ay", "aym"},

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/locale/Language.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/locale/Language.java?view=diff&rev=494397&r1=494396&r2=494397
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/locale/Language.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/org/apache/harmony/luni/internal/locale/Language.java
Tue Jan  9 05:01:23 2007
@@ -21,12 +21,14 @@
 
 public class Language extends java.util.ListResourceBundle {
 
+@SuppressWarnings("nls")
 protected Object[][] getContents() {
 	Object [][] contents = {
 		{"aa", "Afar"},
 		{"ab", "Abkhazian"},
         {"ae", "Avestan"},
 		{"af", "Afrikaans"},
+        {"ak", "Akan"},
 		{"am", "Amharic"},
 		{"ar", "Arabic"},
 		{"as", "Assamese"},

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LocaleTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LocaleTest.java?view=diff&rev=494397&r1=494396&r2=494397
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LocaleTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/LocaleTest.java
Tue Jan  9 05:01:23 2007
@@ -19,6 +19,7 @@
 
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Locale;
 import java.util.Set;
 
@@ -357,6 +358,21 @@
         assertEquals("Wrong representation 8", "", l.toString());
 
 	}
+    
+    // Regression Test for HARMONY-2953
+    public void test_getISO() {
+        Locale locale = new Locale("an");
+        assertEquals("arg", locale.getISO3Language());
+
+        locale = new Locale("PS");
+        assertEquals("pus", locale.getISO3Language());
+
+        List<String> languages = Arrays.asList(Locale.getISOLanguages());
+        assertTrue(languages.contains("ak"));
+
+        List<String> countries = Arrays.asList(Locale.getISOCountries());
+        assertTrue(countries.contains("CS"));
+    }
 
 	/**
 	 * Sets up the fixture, for example, open a network connection. This method



Mime
View raw message