[jira] [Resolved] (VFS-258) [SFTP][RAM] Unsafe casting to AbstractFileObject subclasses in doRename().

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[jira] [Resolved] (VFS-258) [SFTP][RAM] Unsafe casting to AbstractFileObject subclasses in doRename().

Richard (Jira)

     [ https://issues.apache.org/jira/browse/VFS-258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gary D. Gregory resolved VFS-258.

    Resolution: Fixed

Committed revision 1339211.

> [SFTP][RAM] Unsafe casting to AbstractFileObject subclasses in doRename().
> --------------------------------------------------------------------------
>                 Key: VFS-258
>                 URL: https://issues.apache.org/jira/browse/VFS-258
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Marek Zawirski
>             Fix For: 2.1
>         Attachments: doRename_use_AbstractFileObject.patch
> 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.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira