Catch any unexpected exceptions while closing a replication
If the replication only partially initialized and then threw an exception, we may find that the underlying JSch connection is only partially initialized. Calling tn.close() from our finally block may throw a NullPointerException from within JSch, as JSch tries to cleanup uninitialized resources. By wrapping our close call in a try/catch we can ensure that any close failure is logged and then ignored, so that if the close was execting becaues an exception was thrown that the original exception can propagate to our exception handle and also be logged. Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
@@ -158,7 +158,11 @@ public class PushQueue {
|
||||
log.error("Cannot replicate to " + op.uri, e);
|
||||
return;
|
||||
} finally {
|
||||
tn.close();
|
||||
try {
|
||||
tn.close();
|
||||
} catch (Throwable e2){
|
||||
log.warn("Unexpected error while closing " + op.uri, e2);
|
||||
}
|
||||
}
|
||||
|
||||
for (final RemoteRefUpdate u : res.getRemoteUpdates()) {
|
||||
|
||||
Reference in New Issue
Block a user