Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2005-05-16 13:10:46 +0000
committerMichael Valenta2005-05-16 13:10:46 +0000
commitcd465ecbdc01807796b6378be918b28976add135 (patch)
treeb3278c062db5cb396ad9eae843f095f4a74ad8fb
parent37e2016cb0ad6df6125af86011a96d3249749f5a (diff)
downloadeclipse.platform.team-cd465ecbdc01807796b6378be918b28976add135.tar.gz
eclipse.platform.team-cd465ecbdc01807796b6378be918b28976add135.tar.xz
eclipse.platform.team-cd465ecbdc01807796b6378be918b28976add135.zip
Bug 93390 channel is not open errors in .log
-rw-r--r--bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2ServerConnection.java32
1 files changed, 24 insertions, 8 deletions
diff --git a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2ServerConnection.java b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2ServerConnection.java
index d5df59eab..f6de6ab6f 100644
--- a/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2ServerConnection.java
+++ b/bundles/org.eclipse.team.cvs.ssh2/src/org/eclipse/team/internal/ccvs/ssh2/CVSSSH2ServerConnection.java
@@ -15,9 +15,9 @@ import java.net.NoRouteToHostException;
import java.net.UnknownHostException;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.team.internal.ccvs.core.*;
+import org.eclipse.team.internal.ccvs.core.ICVSRepositoryLocation;
+import org.eclipse.team.internal.ccvs.core.IServerConnection;
import org.eclipse.team.internal.ccvs.core.connection.CVSAuthenticationException;
import org.eclipse.team.internal.ccvs.ssh.SSHServerConnection;
import org.eclipse.team.internal.core.streams.*;
@@ -29,7 +29,21 @@ import com.jcraft.jsch.*;
* doesn't support SSH2.
*/
public class CVSSSH2ServerConnection implements IServerConnection {
- private static final String COMMAND = "cvs server"; //$NON-NLS-1$
+ private final class SSH2IOException extends IOException {
+ private static final long serialVersionUID = 1L;
+
+ private final JSchException e;
+
+ private SSH2IOException(String s, JSchException e) {
+ super(s);
+ this.e = e;
+ }
+
+ public Throwable getCause() {
+ return e;
+ }
+ }
+ private static final String COMMAND = "cvs server"; //$NON-NLS-1$
private ICVSRepositoryLocation location;
private String password;
private InputStream inputStream;
@@ -119,7 +133,7 @@ public class CVSSSH2ServerConnection implements IServerConnection {
// above channel connect may fail because the session is down. For this reason,
// we want to retry if the connection fails.
try {
- if (firstTime && isSessionDownError(ee)) {
+ if (firstTime && (isSessionDownError(ee) || isChannelNotOpenError(ee))) {
tryAgain = true;
}
if (!tryAgain) {
@@ -145,11 +159,11 @@ public class CVSSSH2ServerConnection implements IServerConnection {
}
},
8192 /*buffersize*/, 1000 /*writeTimeout*/, 1000 /*closeTimeout*/), timeout > 0 ? timeout : 1, monitor);
- } catch (JSchException e) {
+ } catch (final JSchException e) {
if (isSSH2Unsupported(e)) {
ssh1 = new SSHServerConnection(location, password);
if (ssh1 == null) {
- throw new IOException(e.toString());
+ throw new SSH2IOException(e.toString(), e);
}
ssh1.open(monitor);
} else {
@@ -176,12 +190,14 @@ public class CVSSSH2ServerConnection implements IServerConnection {
}
}
}
- CVSSSH2Plugin.getDefault().getLog().log(new CVSStatus(IStatus.ERROR, "An I/O error occurred connecting using SSH2", e)); //$NON-NLS-1$
- throw new IOException(message);
+ throw new SSH2IOException(message, e);
}
}
}
+ private boolean isChannelNotOpenError(JSchException ee) {
+ return ee.getMessage().indexOf("channel is not opened") != -1; //$NON-NLS-1$
+ }
private boolean isSessionDownError(JSchException ee) {
return ee.getMessage().equals("session is down"); //$NON-NLS-1$
}

Back to the top