Allow GitRepositoryManager methods to throw IOExceptions
RepositoryNotFoundException should really mean "this repository definitely doesn't exist", not "something went wrong when we tried to read this repo (maybe it doesn't exist?)". Since GitRepositoryManager could only throw RepositoryNotFoundExceptions, the easiest implementation was to wrap *all* exceptions in that class, i.e. to take the latter interpretation. We have some downstream caching code that treated RepositoryNotFoundExceptions as definite negatives, i.e. the former interpretation. This was causing poisoned caches on otherwise mostly harmless transient errors. Change GitRepositoryManager to distinguish between these two cases by using IOException for "something went wrong". This complicates the signature, but since RepositoryNotFound derives from IOException, many callers that just want to wrap-and-throw can still do so with minimal changes. Change-Id: Ib2aa2e2443cc3b530ae7fc50fe4eb20059bb16de
This commit is contained in:

committed by
gerrit code review

parent
e0d188ffd5
commit
7f4fbc8756
@@ -28,7 +28,6 @@ import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import org.eclipse.jgit.errors.MissingObjectException;
|
||||
import org.eclipse.jgit.errors.RepositoryNotFoundException;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.PersonIdent;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
@@ -83,7 +82,7 @@ public class PatchSetInfoFactory {
|
||||
Repository repo;
|
||||
try {
|
||||
repo = repoManager.openRepository(change.getProject());
|
||||
} catch (RepositoryNotFoundException e) {
|
||||
} catch (IOException e) {
|
||||
throw new PatchSetInfoNotAvailableException(e);
|
||||
}
|
||||
try {
|
||||
|
Reference in New Issue
Block a user