Whenever I am running my xhtml. It is giving me the following exception. The value of statusindex object is 5. I am using JQuery for lazy scrolling,so when my xhml page getMoreS
List.subList()'s documentation is very clear:
Throws:
IndexOutOfBoundsException
- for an illegal endpoint index value (fromIndex < 0 || toIndex > size || fromIndex > toIndex
)
In your case, toIndex > size
:
java.lang.IndexOutOfBoundsException: toIndex = 30
The message says that toIndex
is 30. That means that statusindex
is not 5, as you believe it is, but 25:
java.lang.IndexOutOfBoundsException: toIndex = 30
Side note, you should use named parameters in your queries instead of String concatenation to pass parameters. Your code is vulnerable to SQL injection attacks. It will also fail if the email address happens to contain a single quote.
results = results.subList(index,index+5);
So it would do:
results.subList(25,30);
if passed 25, hence the error.