[
https://issues.apache.org/jira/browse/ZOOKEEPER-2194?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14554836#comment-14554836
]
Chris Nauroth commented on ZOOKEEPER-2194:
------------------------------------------
Hello [~mitake]. This looks like a good idea. I just have a minor nitpick.
Would you please change this...
{code}
if (children == null)
return children;
{code}
...to this...
{code}
if (children == null) {
return children;
}
{code}
In general, the existing code base uses braces even for a one-line block.
For the next revision of the patch, would you please generate it with {{git
diff --no-prefix}}? This is the format that the Jenkins pre-commit test job
expects.
Thanks for the patch!
> Let DataNode.getChildren() return an unmodifiable view of its children set
> --------------------------------------------------------------------------
>
> Key: ZOOKEEPER-2194
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2194
> Project: ZooKeeper
> Issue Type: Improvement
> Reporter: Hitoshi Mitake
> Priority: Trivial
> Attachments: ZOOKEEPER-2194.patch
>
>
> Current DataNode.getChildren() directly returns a pointer of its private
> member, children. However, the member should be modified through addChild()
> and removeChild(). Callers of getChildren() shouldn't modify it directly.
> For preventing the direct modification by the callers, this patch lets
> getChildren() return an unmodifiable view of its children set. If the callers
> try to modify directly, runtime exception will be risen.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)