summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-11-29 00:29:08 +0100
committerChristian Halstrick <christian.halstrick@sap.com>2020-12-17 17:18:11 +0100
commit9680407e459be6a6239dfc14f02dd52efe7b5d32 (patch)
treeffdda1337f16760412114a85f13961e396c30e46 /org.eclipse.jgit
parent5dfe4c096e9f4defed3f5de4bf2c8728b61f4708 (diff)
downloadjgit-9680407e459be6a6239dfc14f02dd52efe7b5d32.tar.gz
jgit-9680407e459be6a6239dfc14f02dd52efe7b5d32.zip
[errorprone] WalkFetchConnection: ensure exception isn't suppressed
If TransportException is thrown in the finally block of downloadPackedObject() ensure that the exception handled in the previous catch block isn't suppressed. Change-Id: I23982a2b215e38f681cc1719788985e60232699a Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
index c44838ab89..a6b20451dd 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/WalkFetchConnection.java
@@ -510,6 +510,7 @@ class WalkFetchConnection extends BaseFetchConnection {
// and attach it to the local repository so we can use
// all of the contained objects.
//
+ Throwable e1 = null;
try {
pack.downloadPack(monitor);
} catch (IOException err) {
@@ -519,6 +520,7 @@ class WalkFetchConnection extends BaseFetchConnection {
// an alternate.
//
recordError(id, err);
+ e1 = err;
continue;
} finally {
// If the pack was good its in the local repository
@@ -531,6 +533,9 @@ class WalkFetchConnection extends BaseFetchConnection {
if (pack.tmpIdx != null)
FileUtils.delete(pack.tmpIdx);
} catch (IOException e) {
+ if (e1 != null) {
+ e.addSuppressed(e1);
+ }
throw new TransportException(e.getMessage(), e);
}
packItr.remove();