Author: imario
Date: Fri Aug 10 11:58:49 2007
New Revision: 564717
URL: http://svn.apache.org/viewvc?view=rev&rev=564717
Log:
VFS-120: check if session is down and recreate it then
Modified:
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileSystem.java
Modified:
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileSystem.java
URL:
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileSystem.java?view=diff&rev=564717&r1=564716&r2=564717
==============================================================================
---
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileSystem.java
(original)
+++
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileSystem.java
Fri Aug 10 11:58:49 2007
@@ -76,9 +76,11 @@
*/
protected ChannelSftp getChannel() throws IOException
{
- if (this.session == null)
+ if (this.session == null || !this.session.isConnected())
{
- // channel closed. e.g. by freeUnusedResources, but now we need it
again
+ doCloseCommunicationLink();
+
+ // channel closed. e.g. by freeUnusedResources, but now
we need it again
Session session;
UserAuthenticationData authData = null;
try
@@ -119,7 +121,7 @@
}
else
{
- channel = (ChannelSftp) session.openChannel("sftp");
+ channel = (ChannelSftp)
session.openChannel("sftp");
channel.connect();
Boolean userDirIsRoot =
SftpFileSystemConfigBuilder.getInstance().getUserDirIsRoot(getFileSystemOptions());