Fixed AAAttribute equals() method.
authorwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 16 Apr 2003 18:09:51 +0000 (18:09 +0000)
committerwassa <wassa@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Wed, 16 Apr 2003 18:09:51 +0000 (18:09 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@567 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

src/edu/internet2/middleware/shibboleth/aa/AAAttribute.java
tests/edu/internet2/middleware/shibboleth/aa/attrresolv/ResolverTests.java

index 0a671c6..a2ab9f6 100644 (file)
@@ -50,6 +50,7 @@
 package edu.internet2.middleware.shibboleth.aa;
 
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Iterator;
@@ -220,19 +221,30 @@ public class AAAttribute extends SAMLAttribute implements ResolverAttribute, Arp
         */
        public boolean equals(Object object) {
 
-               if (!(object instanceof AAAttribute)) {System.err.println("hey hey hey");
+               if (!(object instanceof AAAttribute)) {
                        return false;
                }
-               if (lifetime != ((AAAttribute) object).lifetime) {System.err.println("hey hey hey");
+               if (lifetime != ((AAAttribute) object).lifetime) {
                        return false;
                }
-               if (name != ((AAAttribute) object).name) {System.err.println("hey hey hey");
+               if (name != ((AAAttribute) object).name) {
                        return false;
                }
-               if (!valueHandler.equals(((AAAttribute) object).valueHandler)) {System.err.println("hey hey yo");
+               if (!valueHandler.equals(((AAAttribute) object).valueHandler)) {
                        return false;
                }
-               return values.equals(((AAAttribute) object).values);
+               
+               ArrayList localValues = new ArrayList();
+               for (Iterator iterator = getValues();iterator.hasNext();) {
+                       localValues.add(iterator.next());
+               }
+               
+               ArrayList objectValues = new ArrayList();
+               for (Iterator iterator = ((AAAttribute) object).getValues();iterator.hasNext();) {
+                       objectValues.add(iterator.next());
+               }
+               
+               return localValues.equals(objectValues);
        }
 
 }
index 82de353..1401e72 100644 (file)
@@ -158,9 +158,6 @@ public class ResolverTests extends TestCase {
                                });
 
                        ar.resolveAttributes(new PrincipalImpl("mytestuser"), "shar.example.edu", inputAttributes);
-                       System.err.println(inputAttributes);
-                       System.err.println("---");
-                       System.err.println(outputAttributes);
                        assertEquals("Attribute Resolver returned unexpected attribute set.", inputAttributes, outputAttributes);
 
                } catch (AttributeResolverException e) {