Uploaded image for project: 'Repository'
  1. Repository
  2. REPOSITORY-173

Since the upgrade to JCR 2, calls to AmetysObjectIterable.getSize() should be avoided

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 2.3
    • None
    • Plugin
    • None

      Since the upgrade to jackrabbit 2.2 (REPOSITORY-142), the NodeIterator.getSize() call is much more unreliable. If the NodeIterator comes from a result of a JCR query, the result is -1, unless a result order has been specified in the query.
      Therefore, the result of AmetysObjectIterable.getSize() can't be trusted, as it delegates to NodeIterator.getSize() when the iterable is backed by a NodeIterator (for instance, when calling AmetysObjectResolver.query()).

      AmetysObjectIterable.getSize() should be avoided when a reliable result is wanted.
      Most of all, it's often called to know if there are results in the iterable (getSize() == 0, getSize() > 0). Those tests should be replaced by calls to hasNext(), which returns always a valid result.

            ngavalda Nicolas Gavalda (Inactive)
            ngavalda Nicolas Gavalda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: