Github user arshadmohammad commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/279#discussion_r126482088
  
    --- Diff: src/java/main/org/apache/zookeeper/ZooKeeper.java ---
    @@ -1535,7 +1535,7 @@ public String create(final String path, byte data[], 
List<ACL> acl,
             RequestHeader h = new RequestHeader();
             setCreateHeader(createMode, h);
             Create2Response response = new Create2Response();
    -        if (acl != null && acl.size() == 0) {
    +        if (acl == null || acl.isEmpty() || acl.contains(null)) {
    --- End diff --
    
    As this Validation we are doing multiple places it would be better if this 
piece of code is extracted to method. Some thing like
     ` private void validateACL(List<ACL> acl) throws InvalidACLException {
            if (acl == null || acl.isEmpty() || acl.contains(null)) {
                throw new KeeperException.InvalidACLException();
            }
        }`
    and put this method along with other validation methods for example 
    `
    PathUtils.validatePath(clientPath, createMode.isSequential());
            EphemeralType.validateTTL(createMode, -1);
            validateACL(acl);
    `



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to