Adapt to ProjectCache#get interface change

Change-Id: I3dffde2a05c1ec27c8cbfdf0a2adb1d0724be147
diff --git a/src/main/java/com/googlesource/gerrit/plugins/findowners/Action.java b/src/main/java/com/googlesource/gerrit/plugins/findowners/Action.java
index 409270f..8da0290 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/findowners/Action.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/findowners/Action.java
@@ -14,6 +14,7 @@
 
 package com.googlesource.gerrit.plugins.findowners;
 
+import static com.google.gerrit.server.project.ProjectCache.illegalState;
 import static java.util.stream.Collectors.toList;
 
 import com.google.common.collect.Streams;
@@ -160,7 +161,8 @@
   public Response<RestResult> getChangeData(Parameters params, ChangeData changeData)
       throws BadRequestException {
     int patchset = getValidPatchsetNum(changeData, params.patchset);
-    ProjectState projectState = projectCache.get(changeData.project());
+    ProjectState projectState =
+        projectCache.get(changeData.project()).orElseThrow(illegalState(changeData.project()));
     Boolean useCache = params.nocache == null || !params.nocache;
     OwnersDb db =
         Cache.getInstance(config, repoManager)
diff --git a/src/test/java/com/googlesource/gerrit/plugins/findowners/FindOwners.java b/src/test/java/com/googlesource/gerrit/plugins/findowners/FindOwners.java
index 47620fe..2ad1e67 100644
--- a/src/test/java/com/googlesource/gerrit/plugins/findowners/FindOwners.java
+++ b/src/test/java/com/googlesource/gerrit/plugins/findowners/FindOwners.java
@@ -18,6 +18,7 @@
 import static com.google.gerrit.acceptance.testsuite.project.TestProjectUpdate.block;
 import static com.google.gerrit.entities.RefNames.REFS_CONFIG;
 import static com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS;
+import static com.google.gerrit.server.project.ProjectCache.illegalState;
 import static java.nio.charset.StandardCharsets.UTF_8;
 
 import com.google.gerrit.acceptance.LightweightPluginDaemonTest;
@@ -175,7 +176,7 @@
         cache.get(
             true,
             null,
-            projectCache.get(project),
+            projectCache.get(project).orElseThrow(illegalState(project)),
             accountCache,
             emails,
             repoManager,
@@ -264,7 +265,7 @@
     // This function is called repeatedly in ConfigIT without recreating config.
     // So, here we recreate config, to get the latest owners file name.
     setConfig();
-    return config.getOwnersFileName(projectCache.get(name), null);
+    return config.getOwnersFileName(projectCache.get(name).orElseThrow(illegalState(name)));
   }
 
   protected Cache getCache() {