Author: niallp Date: Tue Jun 12 05:57:20 2007 New Revision: 546471 URL: http://svn.apache.org/viewvc?view=rev&rev=546471 Log: Restore JDK 1.3 compatibility
Modified: jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/DynaBeanMapDecoratorTestCase.java Modified: jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java?view=diff&rev=546471&r1=546470&r2=546471 ============================================================================== --- jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java (original) +++ jakarta/commons/proper/beanutils/trunk/src/java/org/apache/commons/beanutils/DynaBeanMapDecorator.java Tue Jun 12 05:57:20 2007 @@ -20,7 +20,7 @@ import java.util.List; import java.util.ArrayList; import java.util.Set; -import java.util.LinkedHashSet; +import java.util.HashSet; import java.util.Iterator; import java.util.Collection; import java.util.Collections; @@ -183,7 +183,7 @@ */ public Set entrySet() { DynaProperty[] properties = getDynaProperties(); - Set set = new LinkedHashSet(properties.length); + Set set = new HashSet(properties.length); for (int i = 0; i < properties.length; i++) { String key = properties[i].getName(); Object value = getDynaBean().get(key); @@ -232,7 +232,7 @@ // Create a Set of the keys DynaProperty[] properties = getDynaProperties(); - Set set = new LinkedHashSet(properties.length); + Set set = new HashSet(properties.length); for (int i = 0; i < properties.length; i++) { set.add(properties[i].getName()); } Modified: jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/DynaBeanMapDecoratorTestCase.java URL: http://svn.apache.org/viewvc/jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/DynaBeanMapDecoratorTestCase.java?view=diff&rev=546471&r1=546470&r2=546471 ============================================================================== --- jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/DynaBeanMapDecoratorTestCase.java (original) +++ jakarta/commons/proper/beanutils/trunk/src/test/org/apache/commons/beanutils/DynaBeanMapDecoratorTestCase.java Tue Jun 12 05:57:20 2007 @@ -168,17 +168,21 @@ assertEquals("entrySet size", properties.length, set.size()); - // Set should be ordered in same sequence as properties Iterator iterator = set.iterator(); + List namesList = new ArrayList(); int i = 0; while (iterator.hasNext()) { Map.Entry entry = (Map.Entry)iterator.next(); - String expectName = properties[i].getName(); - Object expectValue = decoratedMap.get(expectName); - assertEquals("entrySet("+i+") key", expectName, entry.getKey()); + String name = (String)entry.getKey(); + namesList.add(name); + Object expectValue = decoratedMap.get(name); assertEquals("entrySet("+i+") val", expectValue, entry.getValue()); i++; } + for (int j = 0; j < properties.length; j++) { + String name = properties[j].getName(); + assertTrue("Check property[" + j + "]", namesList.contains(name)); + } } /** @@ -217,13 +221,9 @@ assertEquals("keySet size", properties.length, set.size()); - // Set should be ordered in same sequence as properties - Iterator iterator = set.iterator(); - int i = 0; - while (iterator.hasNext()) { - String expectName = properties[i].getName(); - assertEquals("keySet("+i+") key", expectName, iterator.next()); - i++; + for (int i = 0; i < properties.length; i++) { + String name = properties[i].getName(); + assertTrue("Check property[" + i + "]", set.contains(name)); } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]