summaryrefslogtreecommitdiffstats
path: root/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountResolver.java
diff options
context:
space:
mode:
Diffstat (limited to 'gerrit-server/src/main/java/com/google/gerrit/server/account/AccountResolver.java')
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/account/AccountResolver.java19
1 files changed, 17 insertions, 2 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountResolver.java b/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountResolver.java
index 8367885ca1..7bfd58570c 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountResolver.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/account/AccountResolver.java
@@ -45,8 +45,9 @@ public class AccountResolver {
* Locate exactly one account matching the name or name/email string.
*
* @param nameOrEmail a string of the format
- * "Full Name <email@example>", or just the email address
- * ("email@example"), or a full name, or an account id.
+ * "Full Name <email@example>", just the email address
+ * ("email@example"), a full name ("Full Name"), or an account id
+ * ("18419").
* @return the single account that matches; null if no account matches or
* there are multiple candidates.
*/
@@ -60,6 +61,20 @@ public class AccountResolver {
return byId.get(Account.Id.parse(nameOrEmail)).getAccount();
}
+ return findByNameOrEmail(nameOrEmail);
+ }
+
+ /**
+ * Locate exactly one account matching the name or name/email string.
+ *
+ * @param nameOrEmail a string of the format
+ * "Full Name <email@example>", just the email address
+ * ("email@example"), a full name ("Full Name").
+ * @return the single account that matches; null if no account matches or
+ * there are multiple candidates.
+ */
+ public Account findByNameOrEmail(final String nameOrEmail)
+ throws OrmException {
final int lt = nameOrEmail.indexOf('<');
final int gt = nameOrEmail.indexOf('>');
if (lt >= 0 && gt > lt && nameOrEmail.contains("@")) {