Make sure all exceptions during GC are caught and logged
Change-Id: I607d60b938c57d84a3590af9bd779e22f028da16
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
(cherry picked from commit 4519a9054920cdb1b95c4c6e7e34211022846e3b)
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/GarbageCollection.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/GarbageCollection.java
index 685e87c..24af14d 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/GarbageCollection.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/GarbageCollection.java
@@ -21,8 +21,6 @@
import org.eclipse.jgit.api.GarbageCollectCommand;
import org.eclipse.jgit.api.Git;
-import org.eclipse.jgit.api.errors.GitAPIException;
-import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.errors.RepositoryNotFoundException;
import org.eclipse.jgit.lib.Config;
import org.eclipse.jgit.lib.ConfigConstants;
@@ -33,7 +31,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Properties;
@@ -91,15 +88,7 @@
result.addError(new GarbageCollectionResult.Error(
GarbageCollectionResult.Error.Type.REPOSITORY_NOT_FOUND,
p));
- } catch (IOException e) {
- logGcError(writer, p, e);
- result.addError(new GarbageCollectionResult.Error(
- GarbageCollectionResult.Error.Type.GC_FAILED, p));
- } catch (GitAPIException e) {
- logGcError(writer, p, e);
- result.addError(new GarbageCollectionResult.Error(
- GarbageCollectionResult.Error.Type.GC_FAILED, p));
- } catch (JGitInternalException e) {
+ } catch (Exception e) {
logGcError(writer, p, e);
result.addError(new GarbageCollectionResult.Error(
GarbageCollectionResult.Error.Type.GC_FAILED, p));