Uploaded image for project: 'Commons VFS'
  1. Commons VFS
  2. VFS-73

FileObject.moveTo() destroys data when changing case

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • None
    • None
    • None
    • any filesystem that's case insensitive but case preserving (windows, osx)

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            filipdef Filip Defoort
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: