Houston Putman created ZOOKEEPER-4500:
-----------------------------------------

             Summary: ACL Lists cannot be validated when they are immutable
                 Key: ZOOKEEPER-4500
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4500
             Project: ZooKeeper
          Issue Type: Bug
            Reporter: Houston Putman


Currently the validateACL() method in Zookeeper.java looks like this:

 
{code:java}
if (acl == null || acl.isEmpty() || acl.contains(null)) {
  throw new KeeperException.InvalidACLException();
} {code}
However the {{contains()}} method for an {{ImmutableCollection}} validates that 
the argument is non-null: (Note, {{contains()}}{{{} calls 
{{indexOf()}}{}}}{{{}){}}}

 

 
{code:java}
@Override
public int indexOf(Object o) {
    Objects.requireNonNull(o);
    for (int i = 0, s = size(); i < s; i++) {
        if (o.equals(get(i))) {
            return i;
        }
    }
    return -1;
} {code}
Therefore if you try to pass an immutable collection for ACLs, you will get a 
null-pointer exception.

 



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to