private Set findAccountsInGroup()

in owners-common/src/main/java/com/googlesource/gerrit/owners/common/AccountsImpl.java [79:100]


  private Set<Id> findAccountsInGroup(String groupNameOrUUID) {
    Optional<InternalGroup> group =
        groupCache
            .get(AccountGroup.nameKey(groupNameOrUUID))
            .map(Optional::of)
            .orElse(groupCache.get(AccountGroup.uuid(groupNameOrUUID)));

    if (!group.isPresent()) {
      log.warn("Group {} was not found", groupNameOrUUID);
      return Collections.emptySet();
    }

    try (ManualRequestContext ctx = oneOffRequestContext.openAs(adminUser.getAccountId())) {

      return groupMembers.listAccounts(group.get().getGroupUUID(), null).stream()
          .map(Account::id)
          .collect(Collectors.toSet());
    } catch (NoSuchProjectException | IOException e) {
      log.error("Unable to list accounts in group " + group, e);
      return Collections.emptySet();
    }
  }