HybridUserProvider throws IndexOutOfBoundsException

HybridUserProvider throws IndexOutOfBoundsException when trying to retrieve users with a paged search.

When using the function UserProvider.findUSers( crit, query, index, maxPage ) and a configured HybridUserProvider, an exception is thrown:

java.lang.IndexOutOfBoundsException: toIndex = 50
at java.util.AbstractList.subListRangeCheck(AbstractList.java:509) ~[?:?]
at java.util.ArrayList.subList(ArrayList.java:1190) ~[?:?]
at org.jivesoftware.openfire.user.UserMultiProvider.findUsers(UserMultiProvider.java:306) ~[xmppserver-5.0.0-alpha-org.jar:5.0.0-alpha]
at org.jivesoftware.openfire.user.UserManager.findUsers(UserManager.java:418) ~[xmppserver-5.0.0-alpha-org.jar:5.0.0-alpha]

Solved by conditionally setting the toIndex value.

I have create a Pull request with a fix.

1 Like

Thanks! I’ve raised a new ticket for this: Jira