Uploaded image for project: 'Magnolia Standard Templating Kit (closed)'
  1. Magnolia Standard Templating Kit (closed)
  2. MGNLSTK-677

Exception in STKPager::getPageItem()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Trivial Trivial
    • 1.3.6, 1.4.2
    • 1.3.4
    • paragraphs
    • None

      the following line
      subList = ((List)items).subList(offset, limit);

      generates an exception
      java.lang.IllegalArgumentException: fromIndex(4) > toIndex(2)

      if offset is larger than limit.

      FIX:


      public Collection getPageItems() {

      Collection subList = items;
      int offset = getOffset();
      if(count > 0) {
      int limit = maxResultsPerPage + offset;
      if(items.size() < limit)

      { limit = count; }

      if(offset < limit)

      { subList = ((List)items).subList(offset, limit); }

      else

      { subList = items; }

      }
      return subList;
      }

      This error happens if the GET Parameter currentPage is set (for example from an old session or an old link), but there are not enought items in the current Collection.

        Acceptance criteria

              ochytil Ondrej Chytil
              sbaur Stefan Baur
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 0.25h
                  0.25h
                  Remaining:
                  Remaining Estimate - 0.25h
                  0.25h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified