You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Angela Schreiber (Jira)" <ji...@apache.org> on 2022/01/14 15:06:00 UTC
[jira] [Created] (OAK-9666) NodeImpl.hasNode(String relPath) always retrieves the underlying tree
Angela Schreiber created OAK-9666:
-------------------------------------
Summary: NodeImpl.hasNode(String relPath) always retrieves the underlying tree
Key: OAK-9666
URL: https://issues.apache.org/jira/browse/OAK-9666
Project: Jackrabbit Oak
Issue Type: Improvement
Components: jcr
Reporter: Angela Schreiber
while discussing JCR-4759 with [~joerghoh], i had a look at _oak-jcr_ and the implementation of {{javax.jcr.Node#hasNode(String relPath)}}, which looks as follows:
{code}
@Override
public boolean hasNode(String relPath) throws RepositoryException {
try {
final String oakPath = getOakPathOrThrow(relPath);
return perform(new NodeOperation<Boolean>(dlg, "hasNode") {
@NotNull
@Override
public Boolean perform() throws RepositoryException {
return node.getChild(oakPath) != null;
}
});
} catch (PathNotFoundException e) {
return false;
}
}
{code}
this means that the underlaying child tree is always retrieved by calling {{Tree.getChild}} even for those cases where calling {{Tree.hasChild}} would be possible. I don't recall why exactly {{Tree.hasChild}} is never used here but it might we worth taking a look if this would be a performance improvement.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)