Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.0
-
None
-
None
Description
When notifying target parent of a new child, AbstractFileObject.moveTo() calls getType() after movement was made. This call return FileType.IMAGINARY if file type was not explicitly cached before (the is the case for LocalFile-s which just update 'file' field), and handleCreate() will execute in vain.
Possible fix is to cache fileType in advance:
try
{
attach();
// calculate the type BEFORE rename, since after source file moved getType() may return IMAGINARY
FileType type = getType();
doRename(destFile);
// assuming file type won't change during rename
(FileObjectUtils.getAbstractFileObject(destFile)).handleCreate(type);
destFile.close(); // now the destFile is no longer imaginary. force reattach.
handleDelete(); // fire delete-events. This file-object (src) is like deleted.
}