I am using display tag in portals(Struts Portal Framework) deployed in websphere portal, using external paging using value list paging (implement PaginatedList) a strong exception has shown up
java.lang.ArithmeticException: divide by zero
in the following lines:
int pageCount = behavioursPaginatedList.getFullListSize() / Math.max(1,behavioursPaginatedList.getObjectsPerPage());
if ((behavioursPaginatedList.getFullListSize() % behavioursPaginatedList.getObjectsPerPage()) > 0)
{
pageCount++;
}
FullListSize = 13
ObjectPerPage = 4
There are two places where divide by zero could occur:
int pageCount = behavioursPaginatedList.getFullListSize() /
Math.max(1,behavioursPaginatedList.getObjectsPerPage());
In this case, Math.max(1, ...)
is guaranteed to deliver a value that is non-zero. So the exception cam't be coming from here
if ((behavioursPaginatedList.getFullListSize() %
behavioursPaginatedList.getObjectsPerPage()) > 0)
In this case, if behavioursPaginatedList.getObjectsPerPage()
returns zero, then you will get a division by zero error.
The fact that you are getting the exception says that division by zero is occurring, and that behavioursPaginatedList.getObjectsPerPage()
is returning zero. You need to find out why that is happening.