[
https://issues.apache.org/jira/browse/ZOOKEEPER-2804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16079316#comment-16079316
]
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_r126290078
--- Diff: src/java/test/org/apache/zookeeper/test/ACLTest.java ---
@@ -189,4 +191,110 @@ public void process(WatchedEvent event) {
}
}
}
+
+ @Test
+ public void testNullACL() throws Exception {
+ File tmpDir = ClientBase.createTmpDir();
+ ClientBase.setupTestEnv();
+ ZooKeeperServer zks = new ZooKeeperServer(tmpDir, tmpDir, 3000);
+ final int PORT = Integer.parseInt(HOSTPORT.split(":")[1]);
+ ServerCnxnFactory f = ServerCnxnFactory.createFactory(PORT, -1);
+ f.startup(zks);
+ ZooKeeper zk = ClientBase.createZKClient(HOSTPORT);
+ try {
+ // case 1 : null ACL with create
+ try {
+ zk.create("/foo", "foo".getBytes(), null,
CreateMode.PERSISTENT);
--- End diff --
All tests can be consolidated into a single try block to avoid duplicate
the boilerplate code.
> 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)