commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Filip Defoort (JIRA)" <j...@apache.org>
Subject [jira] Created: (VFS-73) FileObject.moveTo() destroys data when changing case
Date Mon, 24 Jul 2006 17:05:13 GMT
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: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message