FileObject.moveTo() destroys data when changing case
----------------------------------------------------
Key: VFS-73
URL: http://issues.apache.org/jira/browse/VFS-73
Project: Commons VFS
Issue Type: Bug
Environment: any filesystem that's case insensitive but case
preserving (windows, osx)
Reporter: Filip Defoort
Priority: Critical
When you try to change the case of a file via FileObject.moveTo(), VFS first
deletes the target
file, which in a case-insentive FS is the same as the original and is left with
nothing no files
anymore..
For example:
StandardFileSystemManager fileSystemManager
= new StandardFileSystemManager();
fileSystemManager.setCacheStrategy(CacheStrategy.ON_RESOLVE);
fileSystemManager.init();
FileSystemOptions fileoptions = new FileSystemOptions();
FileObject root = fileSystemManager.resolveFile("/tmp/",
fileoptions);
File dummy = new File("/tmp/test.txt");
dummy.createNewFile();
Writer w = new FileWriter(dummy);
w.write("Some text");
w.close();
long size = dummy.length();
FileObject fo = root.resolveFile("test.txt");
FileObject fo2 = root.resolveFile("TeST.txt");
fo.moveTo(fo2);
At the end of the test, neither test.txt nor TeST.txt exists...
Cheers,
- Filip
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]