powered by Jive Software

IndexOutOfBoundsException in LdapUserProvider (with patch)

Problem:[/b]

There is an IndexOutOfBoundsException, thrown when using LDAP user provider with client-side sorting enabled. It happens when the Users List in the admin console is set to display a page with more rows than available.

Fix:[/b]

Replace org.jivesoftware.wildfire.ldap.LdapUserProvider, line 232

usernames = usernames.subList(startIndex, startIndex + numResults);

/code

with:

int toIndex = Math.min(startIndex + numResults, usernames.size()-1);

usernames = usernames.subList(startIndex, toIndex);

/code

(line numbers are as in version #3229)

Stacktrace:[/b]

java.lang.IndexOutOfBoundsException: toIndex = 100

at java.util.SubList.(Unknown Source)

at java.util.AbstractList.subList(Unknown Source)

at org.jivesoftware.wildfire.ldap.LdapUserProvider.getUsers(LdapUserProvider.java: 232)

at org.jivesoftware.wildfire.user.UserManager.getUsers(UserManager.java:196)

at org.jivesoftware.wildfire.admin.user_002dsummary_jsp._jspService(user_002dsumma ry_jsp.java:214)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:688)

at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:822)

at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:11 8)

at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:813)

at org.jivesoftware.util.LocaleFilter.doFilter(LocaleFilter.java:43)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:813)

at org.jivesoftware.util.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingF ilter.java:41)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:813)

at org.jivesoftware.admin.AuthCheckFilter.doFilter(AuthCheckFilter.java:98)

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplica tionHandler.java:813)

at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(WebApplicationHandler. java:494)

at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:569)

at org.mortbay.http.HttpContext.handle(HttpContext.java:1482)

at org.mortbay.jetty.servlet.WebApplicationContext.handle(WebApplicationContext.ja va:624)

at org.mortbay.http.HttpContext.handle(HttpContext.java:1434)

at org.mortbay.http.HttpServer.service(HttpServer.java:896)

at org.mortbay.http.HttpConnection.service(HttpConnection.java:814)

at org.mortbay.http.HttpConnection.handleNext(HttpConnection.java:981)

at org.mortbay.http.HttpConnection.handle(HttpConnection.java:831)

at org.mortbay.http.SocketListener.handleConnection(SocketListener.java:244)

at org.mortbay.util.ThreadedServer.handle(ThreadedServer.java:366)

at org.mortbay.util.ThreadPool$PoolThread.run(ThreadPool.java:534)

/code

Thanks for the bug report and fix! This was filed as JM-553 and the fix has been checked in.

Regards,

Matt