public List onCommitReceived()

in src/main/java/com/googlesource/gerrit/plugins/uploadvalidator/FileExtensionValidator.java [96:123]


  public List<CommitValidationMessage> onCommitReceived(CommitReceivedEvent receiveEvent)
      throws CommitValidationException {
    try {
      PluginConfig cfg =
          cfgFactory.getFromProjectConfigWithInheritance(
              receiveEvent.project.getNameKey(), pluginName);
      if (isActive(cfg)
          && validatorConfig.isEnabled(
              receiveEvent.user,
              receiveEvent.getProjectNameKey(),
              receiveEvent.getRefName(),
              KEY_BLOCKED_FILE_EXTENSION,
              receiveEvent.pushOptions)) {
        try (Repository repo = repoManager.openRepository(receiveEvent.project.getNameKey())) {
          List<CommitValidationMessage> messages =
              performValidation(
                  repo, receiveEvent.commit, receiveEvent.revWalk, getBlockedExtensions(cfg));
          if (!messages.isEmpty()) {
            throw new CommitValidationException(
                "contains files with blocked file extensions", messages);
          }
        }
      }
    } catch (NoSuchProjectException | IOException e) {
      throw new CommitValidationException("failed to check on file extensions", e);
    }
    return Collections.emptyList();
  }