zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ZOOKEEPER-2804) Node creation fails with NPE if ACLs are null
Date Mon, 10 Jul 2017 17:12:00 GMT

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-2804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16080667#comment-16080667
] 

ASF GitHub Bot commented on ZOOKEEPER-2804:
-------------------------------------------

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);
    `



> Node creation fails with NPE if ACLs are null
> ---------------------------------------------
>
>                 Key: ZOOKEEPER-2804
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2804
>             Project: ZooKeeper
>          Issue Type: Bug
>            Reporter: Bhupendra Kumar Jain
>
> If null ACLs are passed then zk node creation or set ACL fails with NPE
> {code}
> java.lang.NullPointerException
> 	at org.apache.zookeeper.server.PrepRequestProcessor.removeDuplicates(PrepRequestProcessor.java:1301)
> 	at org.apache.zookeeper.server.PrepRequestProcessor.fixupACL(PrepRequestProcessor.java:1341)
> 	at org.apache.zookeeper.server.PrepRequestProcessor.pRequest2Txn(PrepRequestProcessor.java:519)
> 	at org.apache.zookeeper.server.PrepRequestProcessor.pRequest(PrepRequestProcessor.java:1126)
> 	at org.apache.zookeeper.server.PrepRequestProcessor.run(PrepRequestProcessor.java:178)
> {code}
> Expected to handle null in server and return proper error code to client



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message