in src/main/java/com/googlesource/gerrit/plugins/gitiles/Resolver.java [50:78]
public Repository open(HttpServletRequest req, String name)
throws RepositoryNotFoundException, ServiceMayNotContinueException,
ServiceNotAuthorizedException {
Project.NameKey oldName = getNameKey(req);
checkState(
oldName == null,
"Resolved multiple repositories on %s: %s, %s",
req.getRequestURL(),
oldName,
name);
Project.NameKey nameKey = Project.nameKey(name);
req.setAttribute(NAME_KEY_ATTRIBUTE, nameKey);
try {
return repoFactory.create(nameKey);
} catch (NoSuchProjectException e) {
if (userProvider.get().isIdentifiedUser()) {
throw new RepositoryNotFoundException(name, e);
}
// Allow anonymous users a chance to login.
// Avoid leaking information by not distinguishing between
// project not existing and no access rights.
throw new ServiceNotAuthorizedException();
} catch (IOException | PermissionBackendException e) {
ServiceMayNotContinueException err =
new ServiceMayNotContinueException("error opening repository " + name);
err.initCause(e);
throw err;
}
}