[
https://issues.apache.org/jira/browse/VFS-286?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Kirill Safonov updated VFS-286:
-------------------------------
Description:
SftpFileObject.doListChildrenResolved() changes the working dir before doing
ChannelSftp.ls() call. If ls() throws an exception (in my case it's
SftpException "No such file" when trying to list the contents of "/dev/cdrom"),
the execution is blown out the method and channel.cd(workingDirectory) is not
performed. *All* the subsequent operations that rely on the current dir will
fail trying to cd() into unexisting directory.
The fix will be to move the channel.cd(workingDirectory); part into the finally
{} block below
was:
SftpFileObject.doListChildrenResolved() changes the working dir before doing
ChannelSftp.ls() call. If ls() throws an exception (in my case it's
SftpException "No such file" when trying to list the contents of "/dev/cdrom"),
the execution is blown out the method and channel.cd(workingDirectory) is not
performed. *All* the subsequent operations that rely on the current dir will
fail trying to cd() into unexisting directory.
This fix will be to move the channel.cd(workingDirectory); part into the
finally {} block below
> SFTP: getChildren() does not restore working dir if exception is thrown
> -----------------------------------------------------------------------
>
> Key: VFS-286
> URL: https://issues.apache.org/jira/browse/VFS-286
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: Nightly Builds
> Reporter: Kirill Safonov
> Priority: Critical
>
> SftpFileObject.doListChildrenResolved() changes the working dir before doing
> ChannelSftp.ls() call. If ls() throws an exception (in my case it's
> SftpException "No such file" when trying to list the contents of
> "/dev/cdrom"), the execution is blown out the method and
> channel.cd(workingDirectory) is not performed. *All* the subsequent
> operations that rely on the current dir will fail trying to cd() into
> unexisting directory.
> The fix will be to move the channel.cd(workingDirectory); part into the
> finally {} block below
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.