[
https://issues.apache.org/jira/browse/ZOOKEEPER-2804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16081647#comment-16081647
]
ASF GitHub Bot commented on ZOOKEEPER-2804:
-------------------------------------------
Github user hanm commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/279#discussion_r126593104
--- Diff: src/java/main/org/apache/zookeeper/ZooKeeper.java ---
@@ -1436,7 +1436,7 @@ public String create(final String path, byte data[],
List<ACL> acl,
request.setData(data);
request.setFlags(createMode.toFlag());
request.setPath(serverPath);
- if (acl != null && acl.size() == 0) {
+ if (acl == null || acl.isEmpty() || acl.contains(null)) {
--- End diff --
+1 on this. We can throw IllegalArgumentException instead of
KeeperException (which would change API signature) on async methods. It's good
to catch the bad arguments at client side.
> 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)