commit | 5c50c13f26bf4725b7375fd84d49a719bc7cb963 | [log] [tgz] |
---|---|---|
author | Edwin Kempin <ekempin@google.com> | Tue Jun 01 17:42:49 2021 +0200 |
committer | Edwin Kempin <ekempin@google.com> | Tue Jun 01 17:42:49 2021 +0200 |
tree | 26f228e9a9d578a0dc4be919467c899d84add825 | |
parent | 301f249c0e8652001ede67cc27c2275fe0b79567 [diff] |
Fix ISE when code ownership is assigned to 2 emails of the same account If code ownership is assigned to the primary and secondary email of one account at the same time, there was an ISE in CodeOwnerResolver when trying to create the CodeOwner to annotations map [1] (because it cannot have 2 entries with the same CodeOwner as key). Rewrite this logic to avoid this issue and add tests to cover this case. [1] Caused by: java.lang.IllegalArgumentException: Multiple entries with same key: CodeOwner{accountId=100019}=[] and CodeOwner{accountId=100019}=[] at com.google.common.collect.ImmutableMap.conflictException(ImmutableMap.java:226) at com.google.common.collect.ImmutableMap.checkNoConflict(ImmutableMap.java:220) at com.google.common.collect.RegularImmutableMap.checkNoConflictInKeyBucket(RegularImmutableMap.java:146) at com.google.common.collect.RegularImmutableMap.fromEntryArray(RegularImmutableMap.java:109) at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:405) at java.base/java.util.stream.ReferencePipeline.collect(Unknown Source) at com.google.gerrit.plugins.codeowners.backend.CodeOwnerResolver.resolve(CodeOwnerResolver.java:451) ... Signed-off-by: Edwin Kempin <ekempin@google.com> Change-Id: Ib159ebbd08f92d11945cc74c9774028f93d6722a
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.
IMPORTANT: Before installing/enabling the plugin follow the instructions from the setup guide, see resources/Documentation/setup-guide.md.