INT-1614 added connect call into constructor

This commit is contained in:
Mark Fisher
2010-11-19 20:55:41 -05:00
parent ff607a46a0
commit 16bc4f635d

View File

@@ -109,12 +109,15 @@ public class SftpSession implements Session {
}
this.userInfo = new OptimisticUserInfoImpl(userPassword);
this.jschSession.setUserInfo(userInfo);
this.connect();
}
void connect() {
try {
this.jschSession.connect();
this.channel = (ChannelSftp) this.jschSession.openChannel("sftp");
if (!this.jschSession.isConnected()) {
this.jschSession.connect();
this.channel = (ChannelSftp) this.jschSession.openChannel("sftp");
}
}
catch (JSchException e) {
throw new IllegalStateException("failed to connect", e);