harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r523566 - in /harmony/enhanced/classlib/trunk/modules/luni/src: main/java/java/util/Properties.java test/java/tests/api/java/util/PropertiesTest.java
Date Thu, 29 Mar 2007 05:23:35 GMT
Author: apetrenko
Date: Wed Mar 28 22:23:35 2007
New Revision: 523566

URL: http://svn.apache.org/viewvc?view=rev&rev=523566
Log:
Patch for HARMONY-3518 "java.util.Properties.getProperty(): get() instead of super.get()"

Modified:
    harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java
    harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/PropertiesTest.java

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java?view=diff&rev=523566&r1=523565&r2=523566
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Properties.java Wed
Mar 28 22:23:35 2007
@@ -147,7 +147,7 @@
 	 * @return the named property value
 	 */
 	public String getProperty(String name) {
-		Object result = get(name);
+		Object result = super.get(name);
 		String property = result instanceof String ? (String) result : null;
 		if (property == null && defaults != null) {
 			property = defaults.getProperty(name);
@@ -167,7 +167,7 @@
 	 * @return the named property value
 	 */
 	public String getProperty(String name, String defaultValue) {
-		Object result = get(name);
+		Object result = super.get(name);
 		String property = result instanceof String ? (String) result : null;
 		if (property == null && defaults != null) {
 			property = defaults.getProperty(name);
@@ -195,7 +195,7 @@
 			String key = (String) keys.nextElement();
 			buffer.append(key);
 			buffer.append('=');
-			String property = (String) get(key);
+			String property = (String) super.get(key);
 			Properties def = defaults;
 			while (property == null) {
 				property = (String) def.get(key);
@@ -229,7 +229,7 @@
 			String key = (String) keys.nextElement();
 			buffer.append(key);
 			buffer.append('=');
-			String property = (String) get(key);
+			String property = (String) super.get(key);
 			Properties def = defaults;
 			while (property == null) {
 				property = (String) def.get(key);

Modified: harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/PropertiesTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/PropertiesTest.java?view=diff&rev=523566&r1=523565&r2=523566
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/PropertiesTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/test/java/tests/api/java/util/PropertiesTest.java
Wed Mar 28 22:23:35 2007
@@ -74,6 +74,32 @@
     }
 
     /**
+     * @tests java.util.Properties#getProperty(java.lang.String)
+     */
+    public void test_getPropertyLjava_lang_String2() {
+        // regression test for HARMONY-3518
+        MyProperties props = new MyProperties();
+        assertNull(props.getProperty("key"));
+    }
+
+    /**
+     * @tests java.util.Properties#getProperty(java.lang.String,
+     *        java.lang.String)
+     */
+    public void test_getPropertyLjava_lang_StringLjava_lang_String2() {
+        // regression test for HARMONY-3518
+        MyProperties props = new MyProperties();
+        assertEquals(props.getProperty("key", "defaultValue"), "defaultValue");
+    }
+
+    // regression testing for HARMONY-3518
+    static class MyProperties extends Properties {
+        public synchronized Object get(Object key) {
+            return getProperty((String) key); // assume String
+        }
+    }
+
+    /**
      * @tests java.util.Properties#list(java.io.PrintStream)
      */
     public void test_listLjava_io_PrintStream() {



Mime
View raw message