Merge branch 'stable-2.15'
* stable-2.15: ForcePushIT#deleteAllowedWithDeletePermission: Fix permission setting PermissionBackend#filter: Don't fail if project doesn't exist Reload actions when new change is loaded, not on new changeNum Fix lint errors Filter out changes for vanished projects Propagate cause of a project not found in cache Change-Id: I595235f32993802bfc1f27034734abdd4508ce91
This commit is contained in:
@@ -32,13 +32,11 @@ import com.google.gerrit.server.IdentifiedUser;
|
||||
import com.google.gerrit.server.PeerDaemonUser;
|
||||
import com.google.gerrit.server.account.CapabilityCollection;
|
||||
import com.google.gerrit.server.cache.PerThreadCache;
|
||||
import com.google.gerrit.server.project.NoSuchProjectException;
|
||||
import com.google.gerrit.server.project.ProjectCache;
|
||||
import com.google.gerrit.server.project.ProjectState;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import com.google.inject.Singleton;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
@@ -108,16 +106,15 @@ public class DefaultPermissionBackend extends PermissionBackend {
|
||||
public ForProject project(Project.NameKey project) {
|
||||
try {
|
||||
ProjectState state = projectCache.checkedGet(project);
|
||||
if (state != null) {
|
||||
ProjectControl control =
|
||||
PerThreadCache.getOrCompute(
|
||||
PerThreadCache.Key.create(ProjectControl.class, project, user.getCacheKey()),
|
||||
() -> projectControlFactory.create(user, state));
|
||||
return control.asForProject().database(db);
|
||||
}
|
||||
return FailedPermissionBackend.project("not found", new NoSuchProjectException(project));
|
||||
} catch (IOException e) {
|
||||
return FailedPermissionBackend.project("unavailable", e);
|
||||
ProjectControl control =
|
||||
PerThreadCache.getOrCompute(
|
||||
PerThreadCache.Key.create(ProjectControl.class, project, user.getCacheKey()),
|
||||
() -> projectControlFactory.create(user, state));
|
||||
return control.asForProject().database(db);
|
||||
} catch (Exception e) {
|
||||
Throwable cause = e.getCause() != null ? e.getCause() : e;
|
||||
return FailedPermissionBackend.project(
|
||||
"project '" + project.get() + "' is unavailable", cause);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user