aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java
diff options
context:
space:
mode:
authorGravatar Kristina Chodorow <kchodorow@google.com>2015-12-10 20:31:09 +0000
committerGravatar David Chen <dzc@google.com>2015-12-11 17:06:49 +0000
commit984846173bd04057a7ae8d90919137cfcbd0a739 (patch)
treecf582606c9109b1c4fdd1f412fe1c051b832bd87 /src/main/java
parenta41b5c1d8a21063eb114438f10dab4a8c29d03a3 (diff)
Prevent jgit from dumping stack traces all over the place
Fixes #650, #551, and the stack trace parts of #625 and #330. -- MOS_MIGRATED_REVID=109925156
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/bazel/repository/GitCloneFunction.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/bazel/repository/GitCloneFunction.java b/src/main/java/com/google/devtools/build/lib/bazel/repository/GitCloneFunction.java
index c1961b95a4..08028c23fd 100644
--- a/src/main/java/com/google/devtools/build/lib/bazel/repository/GitCloneFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/bazel/repository/GitCloneFunction.java
@@ -33,6 +33,7 @@ import org.eclipse.jgit.api.Status;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.api.errors.InvalidRefNameException;
import org.eclipse.jgit.api.errors.InvalidRemoteException;
+import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.api.errors.RefNotFoundException;
import org.eclipse.jgit.lib.Constants;
import org.eclipse.jgit.lib.ObjectId;
@@ -154,6 +155,12 @@ public class GitCloneFunction implements SkyFunction {
} catch (GitAPIException e) {
throw new RepositoryFunctionException(
new IOException(e.getMessage()), Transience.TRANSIENT);
+ } catch (JGitInternalException e) {
+ // This is a lame catch-all for jgit throwing RuntimeExceptions all over the place because,
+ // as the docs put it, "a lot of exceptions are so low-level that is is unlikely that the
+ // caller of the command can handle them effectively." Thanks, jgit.
+ throw new RepositoryFunctionException(
+ new IOException(e.getMessage()), Transience.PERSISTENT);
} finally {
if (git != null) {
git.close();