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

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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: Nightly Builds
    • Fix Version/s: 2.0
    • Labels:
      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

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

              Dates

              • Created:
                Updated:
                Resolved: