Commit 6f700ccd authored by Rakesh Radhakrishnan's avatar Rakesh Radhakrishnan
Browse files

ZOOKEEPER-1222. getACL should only call DataTree.copyStat when passed in stat...

ZOOKEEPER-1222. getACL should only call DataTree.copyStat when passed in stat is not null (Michi Mutsuzaki via rakeshr)

git-svn-id: https://svn.apache.org/repos/asf/zookeeper/trunk@1608872 13f79535-47bb-0310-9956-ffa450edef68
parent f494a565
......@@ -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,
......
......@@ -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();
}
......
......@@ -162,6 +162,12 @@ public class ClientTest extends ClientBase {
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) {
......
......@@ -424,7 +424,7 @@ public class ReconfigTest extends ZKTestCase implements DataCallback{
// 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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment