Adapt to ProjectCache interface change
Change-Id: I667b6e203e6ca22326c1be232d72ecd7b91823d2
diff --git a/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java b/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java
index 7c761fa..59c537a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/gitiles/FilteredRepository.java
@@ -35,6 +35,7 @@
import java.util.Collection;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import org.eclipse.jgit.attributes.AttributesNodeProvider;
import org.eclipse.jgit.lib.ObjectDatabase;
import org.eclipse.jgit.lib.Ref;
@@ -67,12 +68,15 @@
FilteredRepository create(Project.NameKey name)
throws NoSuchProjectException, IOException, PermissionBackendException {
- ProjectState projectState = projectCache.checkedGet(name);
- if (projectState == null || !projectState.getProject().getState().permitsRead()) {
+ Optional<ProjectState> projectState = projectCache.get(name);
+ if (!projectState.get().statePermitsRead()) {
throw new NoSuchProjectException(name);
}
return new FilteredRepository(
- projectState, userProvider.get(), repoManager.openRepository(name), permissionBackend);
+ projectState.get(),
+ userProvider.get(),
+ repoManager.openRepository(name),
+ permissionBackend);
}
}