Author: rgoers
Date: Tue Nov 3 01:43:58 2009
New Revision: 832254
URL: http://svn.apache.org/viewvc?rev=832254&view=rev
Log:
Apply patch for VFS-286 provided by Kirill Safonov
Modified:
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileObject.java
commons/proper/vfs/trunk/xdocs/changes.xml
Modified:
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileObject.java
URL:
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileObject.java?rev=832254&r1=832253&r2=832254&view=diff
==============================================================================
---
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileObject.java
(original)
+++
commons/proper/vfs/trunk/core/src/main/java/org/apache/commons/vfs/provider/sftp/SftpFileObject.java
Tue Nov 3 01:43:58 2009
@@ -301,7 +301,25 @@
return null;
}
- vector = channel.ls(".");
+ try
+ {
+ vector = channel.ls(".");
+ }
+ catch (SftpException e)
+ {
+ try
+ {
+ if (relPath != null)
+ {
+ channel.cd(workingDirectory);
+ }
+ }
+ catch (SftpException e2)
+ {
+ throw e;
+ }
+ throw e;
+ }
try
{
Modified: commons/proper/vfs/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/commons/proper/vfs/trunk/xdocs/changes.xml?rev=832254&r1=832253&r2=832254&view=diff
==============================================================================
--- commons/proper/vfs/trunk/xdocs/changes.xml (original)
+++ commons/proper/vfs/trunk/xdocs/changes.xml Tue Nov 3 01:43:58 2009
@@ -23,6 +23,11 @@
<body>
<release version="2.0" date="in SVN" description="">
+ <action dev="rgoers" type="fix" issue="VFS-286" due-to="Kirill Safonov">
+ SftpFileObject.doListChildrenResolved() changes the working dir before
doing ChannelSftp.ls() call.
+ If ls() throws an exception, the current directory is not reset. All
the subsequent operations that rely on the
+ current dir will fail trying to change into nonexistent directory.
+ </action>
<action dev="rgoers" type="add" issue="VFS-244">
Rename HttpRandomAccesContent to HttpRandomAccessContent.
</action>