You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by edwardoliveira <gi...@git.apache.org> on 2017/02/01 18:59:46 UTC
[GitHub] zookeeper pull request #160: ZOOKEEPER-2680:Correct DataNode.getChildren() i...
Github user edwardoliveira commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/160#discussion_r98967876
--- Diff: src/java/main/org/apache/zookeeper/server/DataTree.java ---
@@ -1045,18 +1046,16 @@ private void getCounts(String path, Counts counts) {
if (node == null) {
return;
}
- Set<String> children = null;
+ String[] children = null;
int len = 0;
synchronized (node) {
- children = node.getChildren();
+ Set<String> childs = node.getChildren();
+ children = childs.toArray(new String[childs.size()]);
--- End diff --
FYI (only): I *guess* some tests broke 'cause `toArray` copies the contents of `childs` to `children` while `node.getChildren()` returns a internal reference (subject to underneath change) to `children`. So, it would need to be something like `children = new HashSet<>(childs);`
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---