harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ndbe...@apache.org
Subject svn commit: r454268 - in /incubator/harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/ResourceBundle.java test/java/tests/api/java/util/MissingResourceExceptionTest.java test/java/tests/api/java/util/ResourceBundleTest.java
Date Mon, 09 Oct 2006 03:38:35 GMT
Author: ndbeyer
Date: Sun Oct  8 20:38:34 2006
New Revision: 454268

URL: http://svn.apache.org/viewvc?view=rev&rev=454268
Log:
Apply patch from HARMONY-1759: [classlib][luni]Compatibility: ClassName of MissingResourceException
thorwn in ResourceBundle.getBundle() methods does not contains Locale

Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ResourceBundle.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/MissingResourceExceptionTest.java
    incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ResourceBundleTest.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ResourceBundle.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ResourceBundle.java?view=diff&rev=454268&r1=454267&r2=454268
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ResourceBundle.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/ResourceBundle.java
Sun Oct  8 20:38:34 2006
@@ -135,7 +135,7 @@
 					"_" + Locale.getDefault(), true, loader)) != null) {
                 return bundle;
             }
-			throw new MissingResourceException(null, bundleName, ""); //$NON-NLS-1$
+			throw new MissingResourceException(null, bundleName + '_' + locale, ""); //$NON-NLS-1$
 		}
         throw new NullPointerException();
 	}
@@ -161,7 +161,7 @@
 			if ((bundle = handleGetBundle(bundleName, localeName, true, loader)) != null) {
                 return bundle;
             }
-			throw new MissingResourceException(null, bundleName, ""); //$NON-NLS-1$
+			throw new MissingResourceException(null, bundleName + '_' + locale , ""); //$NON-NLS-1$
 		}
         throw new NullPointerException();
 	}

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/MissingResourceExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/MissingResourceExceptionTest.java?view=diff&rev=454268&r1=454267&r2=454268
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/MissingResourceExceptionTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/MissingResourceExceptionTest.java
Sun Oct  8 20:38:34 2006
@@ -17,6 +17,7 @@
 
 package tests.api.java.util;
 
+import java.util.Locale;
 import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 
@@ -46,8 +47,8 @@
 		try {
 			ResourceBundle.getBundle("Non-ExistentBundle");
 		} catch (MissingResourceException e) {
-			assertEquals("Returned incorrect class name", "Non-ExistentBundle", e.getClassName()
-					);
+			assertEquals("Returned incorrect class name", "Non-ExistentBundle"
+                    + '_' + Locale.getDefault(), e.getClassName());
 		}
 	}
 

Modified: incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ResourceBundleTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ResourceBundleTest.java?view=diff&rev=454268&r1=454267&r2=454268
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ResourceBundleTest.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/ResourceBundleTest.java
Sun Oct  8 20:38:34 2006
@@ -22,6 +22,7 @@
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.util.Locale;
+import java.util.MissingResourceException;
 import java.util.ResourceBundle;
 import java.util.StringTokenizer;
 import java.util.Vector;
@@ -149,6 +150,35 @@
 		assertEquals("Wrong value child1", 
 				"frFRVARChildValue1", bundle.getString("child1"));
 	}
+
+    public void test_getBundle_getClassName() {
+        // Regression test for Harmony-1759
+        Locale locale = Locale.GERMAN;
+        String nonExistentBundle = "Non-ExistentBundle";
+        try {
+            ResourceBundle.getBundle(nonExistentBundle, locale, this.getClass()
+                    .getClassLoader());
+            fail("MissingResourceException expected!");
+        } catch (MissingResourceException e) {
+            assertEquals(nonExistentBundle + "_" + locale, e.getClassName());
+        }
+        
+        try {
+            ResourceBundle.getBundle(nonExistentBundle, locale);
+            fail("MissingResourceException expected!");
+        } catch (MissingResourceException e) {
+            assertEquals(nonExistentBundle + "_" + locale, e.getClassName());
+        }
+
+        locale = Locale.getDefault();
+        try {
+            ResourceBundle.getBundle(nonExistentBundle);
+            fail("MissingResourceException expected!");
+        } catch (MissingResourceException e) {
+            assertEquals(nonExistentBundle + "_" + locale, e.getClassName());
+        }
+
+    }
 
 	protected void setUp() {
 	}



Mime
View raw message