Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id C4CF9200CC8 for ; Fri, 14 Jul 2017 14:40:05 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id BC26E16DA6D; Fri, 14 Jul 2017 12:40:05 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 105EC16DA6B for ; Fri, 14 Jul 2017 14:40:04 +0200 (CEST) Received: (qmail 25137 invoked by uid 500); 14 Jul 2017 12:40:04 -0000 Mailing-List: contact dev-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@zookeeper.apache.org Delivered-To: mailing list dev@zookeeper.apache.org Received: (qmail 25124 invoked by uid 99); 14 Jul 2017 12:40:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 14 Jul 2017 12:40:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 8CBDC1806BF for ; Fri, 14 Jul 2017 12:40:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -99.202 X-Spam-Level: X-Spam-Status: No, score=-99.202 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id CqTzP9AasbZq for ; Fri, 14 Jul 2017 12:40:02 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id DE7F65FB62 for ; Fri, 14 Jul 2017 12:40:01 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id DC0C3E0D55 for ; Fri, 14 Jul 2017 12:40:00 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 1B1B324746 for ; Fri, 14 Jul 2017 12:40:00 +0000 (UTC) Date: Fri, 14 Jul 2017 12:40:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@zookeeper.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (ZOOKEEPER-2804) Node creation fails with NPE if ACLs are null MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 14 Jul 2017 12:40:06 -0000 [ https://issues.apache.org/jira/browse/ZOOKEEPER-2804?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16087254#comment-16087254 ] ASF GitHub Bot commented on ZOOKEEPER-2804: ------------------------------------------- Github user jainbhupendra24 commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/279#discussion_r127447190 --- Diff: src/java/main/org/apache/zookeeper/ZooKeeper.java --- @@ -1436,7 +1436,7 @@ public String create(final String path, byte data[], List 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 -- Throwing IllegalArgumentException is the correct way but it may break the existing behavior. Consider the case where application code is like zk.create(callBackHandler)` // call to create api and callback handler is passed doSomething(); - - - - // some more stuff At present, if client pass null ACL parameter, the error will be handled by callBackHandler and in application code doSomething() method will execute. But if we throw IllegalArgumentException , then doSomething() method will not execute. So it will change the existing behavior of application code. Please suggest if we really need to handle this case. > 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)