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

Version and Version History nodes don't implement the proper interfaces when found via Node.getNodes()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 1.0.33, 1.2.19, 1.5.10, 1.6.0
    • None
    • jcr
    • None

    Description

      The JCR spec says in section 15.6:
      When an nt:versionHistory or nt:version node is acquired through a query or directly through a getNode, the actual Java type of the returned object must be VersionHistory (in the case nt:versionHistory nodes) or Version (in the case of nt:version nodes).

      While this doesn't explicitly mention the getNodes() method, I believe it's a reasonable expectation that this method should work the same way, i.e. make the actual Java type of the returned child object Version or VersionHistory where applicable. Oak currently doesn't work this way; the iterator returned by either getNodes() overload will always yield NodeImpl instances.

      I will attach a suggested patch to fix this, including addition to the unit tests to catch any regressions in the future. The patch is against the latest trunk, but the same behavior seems to be present in all past versions as well, so if it's not a big problem, could you also backport this to older stable versions as well? (My employer is using AEM 6.1 currently, so we would be interested in getting this backported to 1.2 at least.)

      Attachments

        1. version-traversal-issue.patch
          4 kB
          Csaba Varga

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Csaba Varga Csaba Varga
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: