Handle missing accounts explicitly and skip accounts without preferred email

The account cache offers 2 methods to lookup accounts, which are both
being renamed in Gerrit core:

1. 'get' (new name 'getEvenIfMissing'):
   Always returns an AccountState, even if the requested account is
   missing. If the account is missing the returned AccountState is
   empty, e.g. it doesn't have a preferred email (preferred email ==
2. 'maybeGet' (new name 'get'):
   Returns an Optional<AccountState>. If the requested account is
   missing, an empty Optional is returned.

So far the find-owners plugin was using method 1. This change migrates
it to using method 2 so that the handling of missing accounts is done
explicitly now. Using method 2 is better because it makes it obvious
that accounts can be missing, e.g. it seems that so far the find-owners
plugin was not aware that method 1 can return an empty AccountState and
hence the preferred email can be null. The preferred email can also be
null for existing accounts. It's a purely optional field in the account
data. It may be null even if the account is linked to emails via
external IDs. So far if the preferred email is null the find-owners
plugin included a null value into the result (e.g. list of reviewers, map of
preferred emails to votes). These null values were not useful and are
skipped now. This is the only change in behaviour.

Change-Id: Ib67642f1d865d0e5217d48d26e7e91087f8174c6
Signed-off-by: Edwin Kempin <ekempin@google.com>
4 files changed
tree: 5d5009d04d7af4904e662bb01dc65a93392417ed
  1. src/
  2. BUILD