Uploaded image for project: 'Commons VFS'
  1. Commons VFS
  2. VFS-286

SFTP: getChildren() does not restore working dir if exception is thrown

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • Nightly Builds
    • 2.0
    • None

    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

      Attachments

        1. VFS-286.patch
          1.0 kB
          Kirill Safonov

        Activity

          People

            Unassigned Unassigned
            ksafonov Kirill Safonov
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: