RefUpdateListener: Adapt to removal of ProjectCache.checkedGet

Bug: Issue 12652
Change-Id: I2a8bf0b1e672aaae29305746c18aabd3fba487cb
diff --git a/src/main/java/com/googlesource/gerrit/plugins/refprotection/RefUpdateListener.java b/src/main/java/com/googlesource/gerrit/plugins/refprotection/RefUpdateListener.java
index 987ead7..674e880 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/refprotection/RefUpdateListener.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/refprotection/RefUpdateListener.java
@@ -41,6 +41,7 @@
 import com.google.gerrit.server.project.ProjectState;
 import com.google.inject.Inject;
 import java.io.IOException;
+import java.util.Optional;
 import org.eclipse.jgit.errors.RepositoryNotFoundException;
 import org.eclipse.jgit.lib.ObjectId;
 import org.eclipse.jgit.lib.Repository;
@@ -95,12 +96,12 @@
   }
 
   private ProjectResource getProjectResource(Project.NameKey nameKey)
-      throws IOException, NoSuchProjectException {
-    ProjectState state = projectCache.checkedGet(nameKey);
-    if (state == null) {
+      throws NoSuchProjectException {
+    Optional<ProjectState> state = projectCache.get(nameKey);
+    if (!state.isPresent()) {
       throw new NoSuchProjectException(nameKey);
     }
-    return new ProjectResource(state, user);
+    return new ProjectResource(state.get(), user);
   }
 
   /**