unico 2004/11/23 04:57:16
Modified: webdavclient/clientlib/src/java/org/apache/webdav/lib Tag:
SLIDE_2_1_RELEASE_BRANCH Ace.java
Log:
fix bugzilla bug 32357, correctly implement Ace.equals
Revision Changes Path
No revision
No revision
1.4.2.1 +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.4.2.1
diff -u -r1.4 -r1.4.2.1
--- Ace.java 28 Jul 2004 09:31:40 -0000 1.4
+++ Ace.java 23 Nov 2004 12:57:16 -0000 1.4.2.1
@@ -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]