User[] users;
try {
String filterText = accountsForm.getFilterText();
String filter = Util.isNullOrTrimmedBlank(filterText) ? UserDatabase.WILDCARD_SEARCH : filterText;
int maxUserResults = userDatabase.getMaxUserResults();
users = userDatabase.listAllUsers(filter, maxUserResults + 1);
if (users.length > maxUserResults) {
int newLength = users.length - 1;
User[] copy = new User[newLength];
System.arraycopy(users, 0, copy, 0, newLength);