Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-4500

ACL Lists cannot be validated when they are immutable

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

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

       

      if (acl == null || acl.isEmpty() || acl.contains(null)) {
        throw new KeeperException.InvalidACLException();
      } 

      However the contains() method for an ImmutableCollection validates that the argument is non-null: (Note, contains(){} calls {{indexOf(){}}})

       

       

      @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;
      } 

      Therefore if you try to pass an immutable collection for ACLs, you will get a null-pointer exception.

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              houston Houston Putman
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated: