commit | 8a81e853a07b1bbd28766793e31d44787dfde1f6 | [log] [tgz] |
---|---|---|
author | Luca Milanesio <luca.milanesio@gmail.com> | Sat Sep 14 13:37:40 2019 +0100 |
committer | Luca Milanesio <luca.milanesio@gmail.com> | Sun Sep 15 09:09:58 2019 +0000 |
tree | 9d01faf0f1179f1269ebdc83c84a9647941a1d24 | |
parent | a44478921a407999550a78e3739d249130d5d769 [diff] |
Fix the testAllNumericUserGroup all-numeric username Bug: Issue 11498 Change-Id: Iee6dc050f8d1e97920c3e105af7bd2a69479dcea
diff --git a/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java b/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java index 9f139c1..59e78e0 100644 --- a/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java +++ b/src/main/java/com/googlesource/gerrit/plugins/singleusergroup/SingleUserGroup.java
@@ -103,10 +103,11 @@ @Override public GroupDescription.Basic get(AccountGroup.UUID uuid) { String ident = username(uuid); - Optional<AccountState> state; + Optional<AccountState> state = Optional.empty(); if (ident.matches(ACCOUNT_ID_PATTERN)) { state = accountCache.get(new Account.Id(Integer.parseInt(ident))); - } else if (ExternalId.isValidUsername(ident)) { + } + if (!state.isPresent() && ExternalId.isValidUsername(ident)) { state = accountCache.getByUsername(ident); } else { return null;