unico       2004/11/23 04:57:13

  Modified:    webdavclient/clientlib/src/java/org/apache/webdav/lib
                        Ace.java
  Log:
  fix bugzilla bug 32357, correctly implement Ace.equals
  
  Revision  Changes    Path
  1.5       +19 -9     
jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/Ace.java
  
  Index: Ace.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/webdavclient/clientlib/src/java/org/apache/webdav/lib/Ace.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Ace.java  28 Jul 2004 09:31:40 -0000      1.4
  +++ Ace.java  23 Nov 2004 12:57:13 -0000      1.5
  @@ -251,18 +251,28 @@
               equals &= isProtected() == otherAce.isProtected();
               equals &= isInherited() == otherAce.isInherited();
               if (equals && isInherited()) {
  -                equals &= 
getInheritedFrom().equals(otherAce.getInheritedFrom());
  +                equals = 
getInheritedFrom().equals(otherAce.getInheritedFrom());
               }
               equals &= getPrincipal().equals(otherAce.getPrincipal());
               if (equals && getPrincipal().equals("property")) {
  -                getProperty().equals(otherAce.getProperty());
  +                equals = getProperty().equals(otherAce.getProperty());
               }
               if (equals) {
                   Enumeration privileges = enumeratePrivileges();
  -                Enumeration otherPrivileges = enumeratePrivileges();
  +                Enumeration otherPrivileges = otherAce.enumeratePrivileges();
                   while (equals && privileges.hasMoreElements()) {
  -                    equals &= otherPrivileges.hasMoreElements();
  -                    equals &= 
privileges.nextElement().equals(otherPrivileges.nextElement());
  +                    equals = otherPrivileges.hasMoreElements();
  +                    // Only access otherPrivileges if there are more elements
  +                    if (equals)
  +                    {
  +                        equals = 
privileges.nextElement().equals(otherPrivileges.nextElement());
  +                    }
  +                }
  +                if (equals)
  +                {
  +                    // No more elements in privileges, so there should be no
  +                    // more elements in otherPrivileges
  +                    equals = !otherPrivileges.hasMoreElements();
                   }
               }
               return equals;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to