Handle new exception thrown by ChangeData#currentFilePaths
Change-Id: I3357b90ba7153b4787ccfe7d232d878ff15ec4a6
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 f4dbca4..70c343a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/findowners/Action.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/findowners/Action.java
@@ -169,7 +169,7 @@
/** REST API to return owners info of a change. */
public Response<RestResult> getChangeData(
Repository repository, Parameters params, ChangeData changeData)
- throws OrmException, BadRequestException {
+ throws OrmException, BadRequestException, IOException {
int patchset = getValidPatchsetNum(changeData, params.patchset);
OwnersDb db = Cache.getInstance().get(accountCache, emails, repository, changeData, patchset);
Collection<String> changedFiles = changeData.currentFilePaths();
diff --git a/src/main/java/com/googlesource/gerrit/plugins/findowners/Cache.java b/src/main/java/com/googlesource/gerrit/plugins/findowners/Cache.java
index 79068b3..43b685a 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/findowners/Cache.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/findowners/Cache.java
@@ -22,6 +22,7 @@
import com.google.gerrit.server.account.Emails;
import com.google.gerrit.server.query.change.ChangeData;
import com.google.gwtorm.server.OrmException;
+import java.io.IOException;
import java.util.Collection;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
@@ -88,7 +89,7 @@
/** Returns a cached or new OwnersDb, for the current patchset. */
OwnersDb get(AccountCache accountCache, Emails emails, Repository repo, ChangeData changeData)
- throws OrmException {
+ throws OrmException, IOException {
return get(accountCache, emails, repo, changeData, changeData.currentPatchSet().getId().get());
}
@@ -99,7 +100,7 @@
Repository repository,
ChangeData changeData,
int patchset)
- throws OrmException {
+ throws OrmException, IOException {
Project.NameKey project = changeData.change().getProject();
String branch = changeData.change().getDest().get();
String dbKey = Cache.makeKey(changeData.getId().get(), patchset, branch);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/findowners/Checker.java b/src/main/java/com/googlesource/gerrit/plugins/findowners/Checker.java
index 8ecca66..5d71c92 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/findowners/Checker.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/findowners/Checker.java
@@ -85,7 +85,7 @@
}
/** Returns 1 if owner approval is found, -1 if missing, 0 if unneeded. */
- int findApproval(AccountCache accountCache, OwnersDb db) throws OrmException {
+ int findApproval(AccountCache accountCache, OwnersDb db) throws OrmException, IOException {
Map<String, Set<String>> file2Owners = db.findOwners(changeData.currentFilePaths());
if (file2Owners.size() == 0) { // do not need owner approval
return 0;
@@ -107,7 +107,7 @@
ChangeData changeData = StoredValues.CHANGE_DATA.get(engine);
Repository repository = StoredValues.REPOSITORY.get(engine);
return new Checker(repository, changeData, minVoteLevel).findApproval(accountCache, emails);
- } catch (OrmException e) {
+ } catch (OrmException | IOException e) {
log.error("Exception", e);
return 0; // owner approval may or may not be required.
}
@@ -129,7 +129,7 @@
return (status == Status.ABANDONED || status == Status.MERGED);
}
- int findApproval(AccountCache accountCache, Emails emails) throws OrmException {
+ int findApproval(AccountCache accountCache, Emails emails) throws OrmException, IOException {
if (isExemptFromOwnerApproval(changeData)) {
return 0;
}