AccountQueryBuilder: Don't use regex to match account ID
Instead just check with Ints.tryParse(...) if it is an integer and thus a (potential) account ID. Change-Id: I50fc579a174a80d0c16d1cd0c2782372eab095a9 Signed-off-by: Edwin Kempin <ekempin@google.com>
This commit is contained in:
@@ -86,8 +86,9 @@ public class AccountQueryBuilder extends QueryBuilder<AccountState> {
|
||||
if ("self".equalsIgnoreCase(query)) {
|
||||
return new AccountIdPredicate(self());
|
||||
}
|
||||
if (query.matches("^[1-9][0-9]*$")) {
|
||||
return new AccountIdPredicate(Account.Id.parse(query));
|
||||
Integer id = Ints.tryParse(query);
|
||||
if (id != null) {
|
||||
return new AccountIdPredicate(new Account.Id(id));
|
||||
}
|
||||
throw error("User " + query + " not found");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user