in src/main/java/com/googlesource/gerrit/plugins/findowners/OwnersValidator.java [214:249]
void checkEmails(Emails emails) {
List<String> owners = new ArrayList<>(email2lines.keySet());
if (owners.isEmpty()) {
return;
}
if (verbose) {
for (String owner : owners) {
addMsg("owner: " + owner);
}
}
if (emails == null) {
addError("cannot check owner emails with null Emails cache.");
}
String[] ownerEmailsAsArray = new String[owners.size()];
owners.toArray(ownerEmailsAsArray);
try {
Multimap<String, Account.Id> email2ids = emails.getAccountsFor(ownerEmailsAsArray);
for (String owner : ownerEmailsAsArray) {
boolean wrongEmail = (email2ids == null);
if (!wrongEmail) {
try {
Collection<Account.Id> ids = email2ids.get(owner);
wrongEmail = (ids == null || ids.isEmpty());
} catch (Exception e) {
wrongEmail = true;
}
}
if (wrongEmail) {
String locations = String.join(" ", email2lines.get(owner));
addError("unknown: " + owner + " at " + locations);
}
}
} catch (Exception e) {
addError("checkEmails failed.");
}
}