while (n.getDepth() > 0) {
if (n instanceof TreeAwareNode) {
JcrTreeNode result = ((TreeAwareNode) n).getTreeNode(node);
if (result != null) {
if (filter != null) {
result = new FilteredJcrTreeNode(result, filter);
}
return result;
}
}
n = (BrixNode) n.getParent();