This looks like bad code to me.

Math.min(currentPage, list.size()/numRowsPerPage)

Should eliminate the loop.

Martijn

On 3/19/09, Julián Mauro Luini (JIRA) <j...@apache.org> wrote:
> Bounds error in PageableListView#getCurrentPage()
> -------------------------------------------------
>
>                  Key: WICKET-2181
>                  URL: https://issues.apache.org/jira/browse/WICKET-2181
>              Project: Wicket
>           Issue Type: Bug
>           Components: wicket
>             Reporter: Julián Mauro Luini
>
>
> In the getCurrentPage() method of class PageableListView, the following
> code:
>
> while ((currentPage * rowsPerPage) > getList().size())
> {
>            currentPage--;
> }
>
> checks if "first cell if out of range". However, the index of that first
> cell is (currentPage * rowsPerPage), and then the comparison with
> getList().size() should use a ">=" instead a ">".
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.5 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.

Reply via email to