Do not log timeout errors on upload and receive connections

The Upload and Receive SSH commands were turning
InterruptedIOExceptions into Failures which get logged by
BaseCommand.  Instead, let the InterruptedIOExceptions trickle
up and die quietly in BaseCommand where they are captured.

Change-Id: I8e9dcde9f2eb616b3ab3130bbbbd218b062d4be8
This commit is contained in:
Martin Fick
2011-06-13 16:50:00 -06:00
committed by Shawn O. Pearce
parent e0d44f8e14
commit 4c7f920816
3 changed files with 9 additions and 21 deletions

View File

@@ -43,6 +43,7 @@ import org.slf4j.LoggerFactory;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
@@ -285,17 +286,13 @@ public abstract class BaseCommand implements Command {
}
private int handleError(final Throwable e) {
if (e.getClass() == IOException.class
&& "Pipe closed".equals(e.getMessage())) {
// This is sshd telling us the client just dropped off while
// we were waiting for a read or a write to complete. Either
// way its not really a fatal error. Don't log it.
//
return 127;
}
if (e.getClass() == SshException.class
&& "Already closed".equals(e.getMessage())) {
if ((e.getClass() == IOException.class
&& "Pipe closed".equals(e.getMessage()))
|| //
(e.getClass() == SshException.class
&& "Already closed".equals(e.getMessage()))
|| //
e.getClass() == InterruptedIOException.class) {
// This is sshd telling us the client just dropped off while
// we were waiting for a read or a write to complete. Either
// way its not really a fatal error. Don't log it.