Validate emails when parsing find-owner code owner configuration files
Emails in code owner configurations must be resolveable to Gerrit
accounts. This means any email that is invalid for Gerrit accounts, is
also invalid as code owner (if an email cannot be added to a Gerrit
account, it can never be resolved to a Gerrit account and hence it makes
no sense to allow it as code owner). Since emails for Gerrit accounts
are validated by OutgoingEmailValidator we should use the same validator
for code owner emails although it's not only checking if the email is
valid, but also if the email is allowed to receive email notifications.
Alternatively we considered to use
org.apache.commons.validator.routines.EmailValidator, which is used by
OutgoingEmailValidator internally, but this is not possible since it is
a singleton with some static initialization and hence we can't use an
EmailValidator instance that is different from the one that is used in
OutgoingEmailValidator. This means we must use OutgoingEmailValidator,
as this class takes care to do the static setup which must be done
before the first use of the EmailValidator singleton instance.
Signed-off-by: Edwin Kempin <ekempin@google.com>
Change-Id: I6669dd56459bdd1af4a0d6031446f3b56ee413ec
2 files changed
tree: 4c0897ef24701bd7d3bee44e177fffc94ee0c74d
-
java/
-
javatests/
-
resources/
-
.gitreview
-
BUILD
-
LICENSE
-
README.md
README.md
Gerrit Code Review code-owners plugin
This plugin provides support for defining code owners for files in a repository.
If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners.
Also see resources/Documentation/about.md