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

[SFTP][RAM] Unsafe casting to AbstractFileObject subclasses in doRename().

VotersWatch issueWatchersLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.0
    • 2.1
    • None

    Description

      AbstractFileObject#doRename() method is called from AbstractFileObject#moveTo() when file can be moved within the same file system. As it concerns file that is subclass AbstractFileObject, target file is also assumed to be AbstractFileObject type. However, this target file can be decorated. Undressing with FileObjectUtils.getAbstractFileObject() was not performed in every places that it should be. Some subclasses do correct stripping of decorator in doRename() implementations (e.g. FtpFileObject), some of them not (e.g. RamFileObject) - which may cause ClassCastExceptions.

      Patch proposal: pass undressed AbstractFileObject to doRename() instead of possibly decorated FileObject.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            mzawirski Marek Zawirski
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Issue deployment