Merge branch 'stable-2.15'

* stable-2.15:
  Find change via ChangeData.Factory rather than ReviewDb

Change-Id: I31bf514836256bd4189052f32beff7dab593e74b
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ChangeUpdatedListener.java b/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ChangeUpdatedListener.java
index 56ca018..95b5cb8 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ChangeUpdatedListener.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ChangeUpdatedListener.java
@@ -14,7 +14,6 @@
 
 package com.googlesource.gerrit.plugins.reviewersbyblame;
 
-import com.google.gerrit.common.EventListener;
 import com.google.gerrit.extensions.annotations.PluginName;
 import com.google.gerrit.reviewdb.client.Change;
 import com.google.gerrit.reviewdb.client.PatchSet;
@@ -24,6 +23,7 @@
 import com.google.gerrit.server.IdentifiedUser;
 import com.google.gerrit.server.config.PluginConfigFactory;
 import com.google.gerrit.server.events.Event;
+import com.google.gerrit.server.events.EventListener;
 import com.google.gerrit.server.events.PatchSetCreatedEvent;
 import com.google.gerrit.server.git.GitRepositoryManager;
 import com.google.gerrit.server.git.WorkQueue;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ReviewersByBlame.java b/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ReviewersByBlame.java
index 0866648..8af0a7b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ReviewersByBlame.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ReviewersByBlame.java
@@ -23,14 +23,15 @@
 import com.google.gerrit.reviewdb.client.Patch.ChangeType;
 import com.google.gerrit.reviewdb.client.PatchSet;
 import com.google.gerrit.server.account.AccountCache;
+import com.google.gerrit.server.account.AccountState;
 import com.google.gerrit.server.account.Emails;
 import com.google.gerrit.server.change.ChangeResource;
-import com.google.gerrit.server.change.ChangesCollection;
-import com.google.gerrit.server.change.PostReviewers;
 import com.google.gerrit.server.patch.PatchList;
 import com.google.gerrit.server.patch.PatchListCache;
 import com.google.gerrit.server.patch.PatchListEntry;
 import com.google.gerrit.server.patch.PatchListNotAvailableException;
+import com.google.gerrit.server.restapi.change.ChangesCollection;
+import com.google.gerrit.server.restapi.change.PostReviewers;
 import com.google.gwtorm.server.OrmException;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
@@ -40,6 +41,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.Optional;
 import java.util.Set;
 import org.eclipse.jgit.api.BlameCommand;
 import org.eclipse.jgit.api.errors.GitAPIException;
@@ -193,10 +195,13 @@
         try {
           Set<Account.Id> ids = emails.getAccountFor(commit.getAuthorIdent().getEmailAddress());
           for (Account.Id id : ids) {
-            Account account = accountCache.get(id).getAccount();
-            if (account.isActive() && !change.getOwner().equals(account.getId())) {
-              Integer count = reviewers.get(account);
-              reviewers.put(account, count == null ? 1 : count.intValue() + 1);
+            Optional<Account> accountState = accountCache.get(id).map(AccountState::getAccount);
+            if (accountState.isPresent()) {
+              Account account = accountState.get();
+              if (account.isActive() && !change.getOwner().equals(account.getId())) {
+                Integer count = reviewers.get(account);
+                reviewers.put(account, count == null ? 1 : count.intValue() + 1);
+              }
             }
           }
         } catch (IOException | OrmException e) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ReviewersByBlameModule.java b/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ReviewersByBlameModule.java
index 92aba85..7bd13a6 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ReviewersByBlameModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/reviewersbyblame/ReviewersByBlameModule.java
@@ -14,11 +14,11 @@
 
 package com.googlesource.gerrit.plugins.reviewersbyblame;
 
-import com.google.gerrit.common.EventListener;
 import com.google.gerrit.extensions.annotations.Exports;
 import com.google.gerrit.extensions.config.FactoryModule;
 import com.google.gerrit.extensions.registration.DynamicSet;
 import com.google.gerrit.server.config.ProjectConfigEntry;
+import com.google.gerrit.server.events.EventListener;
 
 public class ReviewersByBlameModule extends FactoryModule {
   @Override