Commit 5b6fdf09 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Return empty collection for blank searches.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1483 b35dd754-fafc-0310-a699-88a17e54d16e
parent 715026bb
...@@ -391,6 +391,9 @@ public class DefaultUserProvider implements UserProvider { ...@@ -391,6 +391,9 @@ public class DefaultUserProvider implements UserProvider {
if (!getSearchFields().containsAll(fields)) { if (!getSearchFields().containsAll(fields)) {
throw new IllegalArgumentException("Search fields " + fields + " are not valid."); throw new IllegalArgumentException("Search fields " + fields + " are not valid.");
} }
if (query == null || "".equals(query)) {
return Collections.emptyList();
}
// SQL LIKE queries don't map directly into a keyword/wildcard search like we want. // SQL LIKE queries don't map directly into a keyword/wildcard search like we want.
// Therefore, we do a best approximiation by replacing '*' with '%' and then // Therefore, we do a best approximiation by replacing '*' with '%' and then
// surrounding the whole query with two '%'. This will return more data than desired, // surrounding the whole query with two '%'. This will return more data than desired,
...@@ -453,6 +456,9 @@ public class DefaultUserProvider implements UserProvider { ...@@ -453,6 +456,9 @@ public class DefaultUserProvider implements UserProvider {
if (!getSearchFields().containsAll(fields)) { if (!getSearchFields().containsAll(fields)) {
throw new IllegalArgumentException("Search fields " + fields + " are not valid."); throw new IllegalArgumentException("Search fields " + fields + " are not valid.");
} }
if (query == null || "".equals(query)) {
return Collections.emptyList();
}
// SQL LIKE queries don't map directly into a keyword/wildcard search like we want. // SQL LIKE queries don't map directly into a keyword/wildcard search like we want.
// Therefore, we do a best approximiation by replacing '*' with '%' and then // Therefore, we do a best approximiation by replacing '*' with '%' and then
// surrounding the whole query with two '%'. This will return more data than desired, // surrounding the whole query with two '%'. This will return more data than desired,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment