in src/main/java/com/googlesource/gerrit/plugins/quota/MaxRepositoriesQuotaValidator.java [37:61]
public void validateNewProject(CreateProjectArgs args) throws ValidationException {
QuotaSection quotaSection = quotaFinder.firstMatching(args.getProject());
if (quotaSection != null) {
Integer maxProjects = quotaSection.getMaxProjects();
if (maxProjects != null) {
int count = 0;
for (Project.NameKey p : projectCache.all()) {
if (quotaSection.matches(p)) {
count++;
}
}
if (count >= maxProjects) {
StringBuilder msg = new StringBuilder();
msg.append("Project cannot be created because a quota for the namespace '");
msg.append(quotaSection.getNamespace());
msg.append("' allows at most ");
msg.append(maxProjects);
msg.append(" projects and ");
msg.append(count);
msg.append(" projects already exist.");
throw new ValidationException(msg.toString());
}
}
}
}