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

FileObject.moveTo() destroys data when changing case

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Environment:

      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

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

              Dates

              • Created:
                Updated:
                Resolved: