[errorprone] FetchProcess: ensure exception isn't suppressed
If TransportException is thrown in the finally block of execute() ensure that the exception handled in the previous catch block isn't suppressed. Change-Id: I670acdfb4d36e7a419a9a79ae9faab2e085a43ee Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
9680407e45
commit
c8c0556f76
|
@ -87,13 +87,20 @@ void execute(ProgressMonitor monitor, FetchResult result)
|
||||||
packLocks.clear();
|
packLocks.clear();
|
||||||
localRefs = null;
|
localRefs = null;
|
||||||
|
|
||||||
|
Throwable e1 = null;
|
||||||
try {
|
try {
|
||||||
executeImp(monitor, result);
|
executeImp(monitor, result);
|
||||||
|
} catch (NotSupportedException | TransportException err) {
|
||||||
|
e1 = err;
|
||||||
|
throw err;
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
for (PackLock lock : packLocks)
|
for (PackLock lock : packLocks)
|
||||||
lock.unlock();
|
lock.unlock();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
if (e1 != null) {
|
||||||
|
e.addSuppressed(e1);
|
||||||
|
}
|
||||||
throw new TransportException(e.getMessage(), e);
|
throw new TransportException(e.getMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue