[
http://jira.magnolia-cms.com/browse/MGNLSTK-677?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=30014#action_30014
]
Bert Leunis commented on MGNLSTK-677:
-------------------------------------
I am not convinced that the suggested solution is the best one. The problem
with the larger offset occurs when in an overview a paged page is requested
that does not exist. So if you have 5 paged pages, and you request page 6 the
calculation here goes wrong. (Example:
http://tegenlicht.vpro.nl/nieuws/?currentPage=1000).
The fix suggests that now the complete list is returned. That is fine if you
have only 30 articles, but not if you have a much larger number.
There's several other options: return 404, return the last paged page, return
'no results for this page'.
> 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: Ondřej Chytil
> Priority: Trivial
> Fix For: 1.3.x
>
> Original Estimate: 0.25h
> Remaining Estimate: 0.25h
>
> 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]>
----------------------------------------------------------------