Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-9666

NodeImpl.hasNode(String relPath) always retrieves the underlying tree

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • jcr
    • None

    Description

      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:

      @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;
              }
          }
      

      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.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              angela Angela Schreiber
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: