From commits-return-3865-apmail-zookeeper-commits-archive=zookeeper.apache.org@zookeeper.apache.org Tue Jul 8 18:18:53 2014 Return-Path: X-Original-To: apmail-zookeeper-commits-archive@www.apache.org Delivered-To: apmail-zookeeper-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id E7BE811B4F for ; Tue, 8 Jul 2014 18:18:53 +0000 (UTC) Received: (qmail 17680 invoked by uid 500); 8 Jul 2014 18:18:53 -0000 Delivered-To: apmail-zookeeper-commits-archive@zookeeper.apache.org Received: (qmail 17651 invoked by uid 500); 8 Jul 2014 18:18:53 -0000 Mailing-List: contact commits-help@zookeeper.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ Delivered-To: mailing list commits@zookeeper.apache.org Received: (qmail 17630 invoked by uid 99); 8 Jul 2014 18:18:53 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jul 2014 18:18:53 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 08 Jul 2014 18:18:52 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 4EC14238899C; Tue, 8 Jul 2014 18:18:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: svn commit: r1608872 - in /zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/ZooKeeper.java src/java/test/org/apache/zookeeper/test/ClientTest.java src/java/test/org/apache/zookeeper/test/ReconfigTest.java Date: Tue, 08 Jul 2014 18:18:32 -0000 To: commits@zookeeper.apache.org From: rakeshr@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140708181832.4EC14238899C@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rakeshr Date: Tue Jul 8 18:18:31 2014 New Revision: 1608872 URL: http://svn.apache.org/r1608872 Log: ZOOKEEPER-1222. getACL should only call DataTree.copyStat when passed in stat is not null (Michi Mutsuzaki via rakeshr) Modified: zookeeper/trunk/CHANGES.txt zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ReconfigTest.java Modified: zookeeper/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1608872&r1=1608871&r2=1608872&view=diff ============================================================================== --- zookeeper/trunk/CHANGES.txt (original) +++ zookeeper/trunk/CHANGES.txt Tue Jul 8 18:18:31 2014 @@ -686,6 +686,9 @@ BUGFIXES: ZOOKEEPER-1810. Add version to FLE notifications for trunk Germán Blanco via michim) + ZOOKEEPER-1222. getACL should only call DataTree.copyStat when passed in + stat is not null (Michi Mutsuzaki via rakeshr) + IMPROVEMENTS: ZOOKEEPER-1170. Fix compiler (eclipse) warnings: unused imports, Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java?rev=1608872&r1=1608871&r2=1608872&view=diff ============================================================================== --- zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java (original) +++ zookeeper/trunk/src/java/main/org/apache/zookeeper/ZooKeeper.java Tue Jul 8 18:18:31 2014 @@ -1791,6 +1791,8 @@ public class ZooKeeper { * a comma separated list of new membership (non-incremental reconfiguration) * @param fromConfig * version of the current configuration (optional - causes reconfiguration to throw an exception if configuration is no longer current) + * @param stat the stat of /zookeeper/config znode will be copied to this + * parameter if not null. * @return new configuration * @throws InterruptedException If the server transaction is interrupted. * @throws KeeperException If the server signals an error with a non-zero error code. @@ -1805,7 +1807,9 @@ public class ZooKeeper { if (r.getErr() != 0) { throw KeeperException.create(KeeperException.Code.get(r.getErr()), ""); } - DataTree.copyStat(response.getStat(), stat); + if (stat != null) { + DataTree.copyStat(response.getStat(), stat); + } return response.getData(); } @@ -1940,7 +1944,8 @@ public class ZooKeeper { * @param path * the given path for the node * @param stat - * the stat of the node will be copied to this parameter. + * the stat of the node will be copied to this parameter if + * not null. * @return the ACL array of the given node. * @throws InterruptedException If the server transaction is interrupted. * @throws KeeperException If the server signals an error with a non-zero error code. @@ -1964,7 +1969,9 @@ public class ZooKeeper { throw KeeperException.create(KeeperException.Code.get(r.getErr()), clientPath); } - DataTree.copyStat(response.getStat(), stat); + if (stat != null) { + DataTree.copyStat(response.getStat(), stat); + } return response.getAcl(); } Modified: zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java?rev=1608872&r1=1608871&r2=1608872&view=diff ============================================================================== --- zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java (original) +++ zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ClientTest.java Tue Jul 8 18:18:31 2014 @@ -162,6 +162,12 @@ public class ClientTest extends ClientBa List acls = zk.getACL("/acltest", new Stat()); Assert.assertEquals(1, acls.size()); Assert.assertEquals(Ids.OPEN_ACL_UNSAFE, acls); + + // The stat parameter should be optional. + acls = zk.getACL("/acltest", null); + Assert.assertEquals(1, acls.size()); + Assert.assertEquals(Ids.OPEN_ACL_UNSAFE, acls); + zk.close(); } finally { if (zk != null) { Modified: zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ReconfigTest.java URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ReconfigTest.java?rev=1608872&r1=1608871&r2=1608872&view=diff ============================================================================== --- zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ReconfigTest.java (original) +++ zookeeper/trunk/src/java/test/org/apache/zookeeper/test/ReconfigTest.java Tue Jul 8 18:18:31 2014 @@ -424,7 +424,7 @@ public class ReconfigTest extends ZKTest // We try to remove server 3, which requires a quorum of {1,2,3} // (we have that) and of {1,2}, but 2 is down so we won't get a // quorum of new config ACKs. - zkArr[1].reconfig(null, leavingServers, null, -1, new Stat()); + zkArr[1].reconfig(null, leavingServers, null, -1, null); Assert.fail("Reconfig should have failed since we don't have quorum of new config"); } catch (KeeperException.ConnectionLossException e) { // We expect leader to loose quorum of proposed config and time out