Exception in STKPager::getPageItem()
------------------------------------

                 Key: MGNLSTK-677
                 URL: http://jira.magnolia-cms.com/browse/MGNLSTK-677
             Project: Magnolia Standard Templating Kit
          Issue Type: Bug
          Components: paragraphs
    Affects Versions: 1.3.4
            Reporter: Stefan Baur
            Assignee: Philipp Bärfuss
            Priority: Trivial


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.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.magnolia-cms.com/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira




----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------

Reply via email to