Commons VFS
  1. Commons VFS
  2. VFS-286

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical 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

      1. VFS-286.patch
        1.0 kB
        Kirill Safonov

        Activity

        Hide
        Kirill Safonov added a comment -

        Patch attached

        Show
        Kirill Safonov added a comment - Patch attached
        Hide
        Ralph Goers added a comment -

        The patch was applied. Please verify.

        Show
        Ralph Goers added a comment - The patch was applied. Please verify.
        Hide
        Kirill Safonov added a comment -

        Verified and closed.

        Show
        Kirill Safonov added a comment - Verified and closed.

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development