[
https://issues.apache.org/jira/browse/VFS-279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12774882#action_12774882
]
Didier Earith commented on VFS-279:
-----------------------------------
I don't have any simple unit tests to illustrate the behavior.
Just see that fileObject can be an instance of DecoratedFileObject which
doesn't inherited from AbstractFileObject.
As LocalFile object inherits from AbstractFileObject, if the object file is an
DecoratedFileObject , you'll get a class cast exception.
See also for example doRename function in the LocalFile class. Or you can
search for getAbstractFileObject function, you will see that :
"LocalFile localFile = (LocalFile) fileObject;" is never used, but
"LocalFile localFile = (LocalFile)
FileObjectUtils.getAbstractFileObject(fileObject);" is always used.
And this lacks in the doReplicateFile function.
> ClassCastException in LocalFileSystem when using OnCall caching
> ---------------------------------------------------------------
>
> Key: VFS-279
> URL: https://issues.apache.org/jira/browse/VFS-279
> Project: Commons VFS
> Issue Type: Bug
> Affects Versions: 1.0, 1.1, 2.0
> Reporter: Didier Earith
> Fix For: 1.0, 1.1, 2.0
>
> Attachments: LocalFileSystem.java
>
>
> When using OnCall caching in the file system, there is a ClassCastException
> in the LocalFileSystem#doReplicateFile function.
> To fix the issue, I replaced :
> final LocalFile localFile = (LocalFile) fileObject;
> by
> final LocalFile localFile = (LocalFile)
> FileObjectUtils.getAbstractFileObject(fileObject);
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.