You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by ra...@apache.org on 2014/07/08 20:27:37 UTC

svn commit: r1608873 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/java/main/org/apache/zookeeper/ZooKeeper.java src/java/test/org/apache/zookeeper/test/ClientTest.java

Author: rakeshr
Date: Tue Jul  8 18:27:36 2014
New Revision: 1608873

URL: http://svn.apache.org/r1608873
Log:
ZOOKEEPER-1222. getACL should only call DataTree.copyStat when passed in stat is not null (Michi Mutsuzaki via rakeshr)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/java/main/org/apache/zookeeper/ZooKeeper.java
    zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/ClientTest.java

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1608873&r1=1608872&r2=1608873&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Tue Jul  8 18:27:36 2014
@@ -37,6 +37,9 @@ BUGFIXES:
   ZOOKEEPER-1939. ReconfigRecoveryTest.testNextConfigUnreachable is
   failing (Rakesh R via phunt)
 
+  ZOOKEEPER-1222. getACL should only call DataTree.copyStat when passed in
+  stat is not null (Michi Mutsuzaki via rakeshr)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1575. adding .gitattributes to prevent CRLF and LF mismatches for

Modified: zookeeper/branches/branch-3.4/src/java/main/org/apache/zookeeper/ZooKeeper.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/java/main/org/apache/zookeeper/ZooKeeper.java?rev=1608873&r1=1608872&r2=1608873&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/java/main/org/apache/zookeeper/ZooKeeper.java (original)
+++ zookeeper/branches/branch-3.4/src/java/main/org/apache/zookeeper/ZooKeeper.java Tue Jul  8 18:27:36 2014
@@ -1306,7 +1306,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.
@@ -1330,7 +1331,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/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/ClientTest.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/ClientTest.java?rev=1608873&r1=1608872&r2=1608873&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/ClientTest.java (original)
+++ zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/ClientTest.java Tue Jul  8 18:27:36 2014
@@ -162,6 +162,12 @@ public class ClientTest extends ClientBa
             List<ACL> 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) {