Remove ProjectCache#checkedGet and move callers to #get
In an effort to make it impossible to use the ProjectCache interface the wrong way, we are simplifying the interface to just a single option for getting a project. The #get method throws a StorageException in case loading failed and returns Optional#empty in case the project does not exist. Change-Id: I7e3ecf2de3bc975d1c35ee8a848ac61def7af252
This commit is contained in:
		| @@ -34,6 +34,7 @@ import com.google.gerrit.server.permissions.PermissionBackendException; | ||||
| import com.google.gerrit.server.project.InvalidChangeOperationException; | ||||
| import com.google.gerrit.server.project.NoSuchChangeException; | ||||
| import com.google.gerrit.server.project.ProjectCache; | ||||
| import com.google.gerrit.server.project.ProjectState; | ||||
| import com.google.inject.Provider; | ||||
| import com.google.inject.assistedinject.Assisted; | ||||
| import com.google.inject.assistedinject.AssistedInject; | ||||
| @@ -102,7 +103,10 @@ public class PatchScriptFactoryForAutoFix implements Callable<PatchScript> { | ||||
|       throw new NoSuchChangeException(changeId, e); | ||||
|     } | ||||
|  | ||||
|     if (!projectCache.checkedGet(notes.getProjectName()).statePermitsRead()) { | ||||
|     if (!projectCache | ||||
|         .get(notes.getProjectName()) | ||||
|         .map(ProjectState::statePermitsRead) | ||||
|         .orElse(false)) { | ||||
|       throw new NoSuchChangeException(changeId); | ||||
|     } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Patrick Hiesel
					Patrick Hiesel