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

        Kirill Safonov created issue -
        Kirill Safonov made changes -
        Field Original Value New Value
        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.

        This fix will be to move the channel.cd(workingDirectory); part into the finally {} block below
        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
        Kirill Safonov made changes -
        Attachment VFS-286.patch [ 12423292 ]
        Ralph Goers made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.0 [ 12313174 ]
        Resolution Fixed [ 1 ]
        Kirill Safonov made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development