You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sc...@apache.org on 2005/05/15 11:22:51 UTC

svn commit: r170210 - in /jakarta/commons/proper/collections/trunk: RELEASE-NOTES.html project.xml src/java/org/apache/commons/collections/map/Flat3Map.java src/test/org/apache/commons/collections/map/TestFlat3Map.java

Author: scolebourne
Date: Sun May 15 02:22:50 2005
New Revision: 170210

URL: http://svn.apache.org/viewcvs?rev=170210&view=rev
Log:
Fix Flat3Map.equals to actually work
bug 34917, from Stanislaw Osinski

Modified:
    jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html
    jakarta/commons/proper/collections/trunk/project.xml
    jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
    jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java

Modified: jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html?rev=170210&r1=170209&r2=170210&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html (original)
+++ jakarta/commons/proper/collections/trunk/RELEASE-NOTES.html Sun May 15 02:22:50 2005
@@ -65,6 +65,7 @@
 <li>BeanMap.initialize() - Internal variable now correctly initialised with only write methods that actually exist [15895]</li>
 <li>TransformedMap.putAll - Now allows putAll of an empty map [34686]</li>
 <li>AbstractHashedMap deserialization - Fix to prevent doubling of internal data array [34265]</li>
+<li>Flat3Map.equals() - Fix to make flat mode comparison actually work [34917]</li>
 </ul>
 
 <center><h3>JAVADOC</h3></center>

Modified: jakarta/commons/proper/collections/trunk/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/project.xml?rev=170210&r1=170209&r2=170210&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/project.xml (original)
+++ jakarta/commons/proper/collections/trunk/project.xml Sun May 15 02:22:50 2005
@@ -246,6 +246,9 @@
       <name>Kasper Nielsen</name>
     </contributor>
     <contributor>
+      <name>Stanislaw Osinski</name>
+    </contributor>
+    <contributor>
       <name>Alban Peignier</name>
     </contributor>
     <contributor>

Modified: jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java?rev=170210&r1=170209&r2=170210&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java (original)
+++ jakarta/commons/proper/collections/trunk/src/java/org/apache/commons/collections/map/Flat3Map.java Sun May 15 02:22:50 2005
@@ -1041,24 +1041,27 @@
             switch (size) {  // drop through
                 case 3:
                     if (other.containsKey(key3) == false) {
-                        otherValue = other.get(key3);
-                        if (value3 == null ? otherValue != null : !value3.equals(otherValue)) {
-                            return false;
-                        }
+                        return false;
+                    }
+                    otherValue = other.get(key3);
+                    if (value3 == null ? otherValue != null : !value3.equals(otherValue)) {
+                        return false;
                     }
                 case 2:
                     if (other.containsKey(key2) == false) {
-                        otherValue = other.get(key2);
-                        if (value2 == null ? otherValue != null : !value2.equals(otherValue)) {
-                            return false;
-                        }
+                        return false;
+                    }
+                    otherValue = other.get(key2);
+                    if (value2 == null ? otherValue != null : !value2.equals(otherValue)) {
+                        return false;
                     }
                 case 1:
                     if (other.containsKey(key1) == false) {
-                        otherValue = other.get(key1);
-                        if (value1 == null ? otherValue != null : !value1.equals(otherValue)) {
-                            return false;
-                        }
+                        return false;
+                    }
+                    otherValue = other.get(key1);
+                    if (value1 == null ? otherValue != null : !value1.equals(otherValue)) {
+                        return false;
                     }
             }
         }

Modified: jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java?rev=170210&r1=170209&r2=170210&view=diff
==============================================================================
--- jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java (original)
+++ jakarta/commons/proper/collections/trunk/src/test/org/apache/commons/collections/map/TestFlat3Map.java Sun May 15 02:22:50 2005
@@ -59,6 +59,26 @@
     }
 
     //-----------------------------------------------------------------------
+    public void testEquals1() {
+        Flat3Map map1 = new Flat3Map();
+        map1.put("a", "testA");
+        map1.put("b", "testB");
+        Flat3Map map2 = new Flat3Map();
+        map2.put("a", "testB");
+        map2.put("b", "testA");
+        assertEquals(false, map1.equals(map2));
+    }
+
+    public void testEquals2() {
+        Flat3Map map1 = new Flat3Map();
+        map1.put("a", "testA");
+        map1.put("b", "testB");
+        Flat3Map map2 = new Flat3Map();
+        map2.put("a", "testB");
+        map2.put("c", "testA");
+        assertEquals(false, map1.equals(map2));
+    }
+
     public void testClone2() {
         Flat3Map map = new Flat3Map();
         assertEquals(0, map.size());



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org