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

Bhupendra Kumar Jain commented on ZOOKEEPER-2804:
-------------------------------------------------

After I rechecked the code, I noticed that all create APIs and also SetACL API 
have the NPE issue. Server must throw InvalidACLException in the null case. 

Apart from this, Currently client side ACL null parameter validation is 
missing. We can probably add client side validation also to throw 
IllegalArgumentException for null 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 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}
> Below APIs have problem.
> {code}
> public void create(final String path, byte data[], List<ACL> acl,
>             CreateMode createMode, StringCallback cb, Object ctx)
> public void create(final String path, byte data[], List<ACL> acl,
>             CreateMode createMode, Create2Callback cb, Object ctx)
> {code}
> Solution: 
> a)  Need to handle NULL ACLs in removeDuplicates method in server.  
> b) Also add the client side validation for null / empty ACL for above API 
> similar to other create API



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to