Great, thanks a lot.

I have a more complicated case now (the one I was starting to build :-D ): rename to the same file, but different case. That's bad, since it actually deletes the source file...:

import java.io.*;
import org.apache.commons.vfs.*;
import org.apache.commons.vfs.impl.*;

public class RenameCase {


  public static final void main(final String[] args) throws Exception {

           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");

           System.out.println("fo = " + fo);
           System.out.println("fo2 = " + fo2);

           fo.moveTo(fo2);


  }

}

fo = file:///tmp/test.txt
fo2 = file:///tmp/TeST.txt
Exception in thread "main" org.apache.commons.vfs.FileSystemException: Could not rename "file:///tmp/test.txt" to "file:///tmp/TeST.txt". at org.apache.commons.vfs.provider.AbstractFileObject.moveTo(AbstractFileObject.java:950)
       at RenameCase.main(RenameCase.java:34)
Caused by: org.apache.commons.vfs.FileSystemException: Could not rename file "/tmp/test.txt" to "file:///tmp/TeST.txt". at org.apache.commons.vfs.provider.local.LocalFile.doRename(LocalFile.java:134) at org.apache.commons.vfs.provider.AbstractFileObject.moveTo(AbstractFileObject.java:936)
       ... 1 more

After this, neither file exists anymore.... That could cause some major head-aches...

Cheers,
- Filip


Mario Ivankovits wrote:
Hi Filip!
I might just be getting tired now, but the following test fails
with a NPE:
;-)
This was due to the fixes I did for the threading issue - and unhappily
I didnt had the time to run the tests.
But its fixed now.

Sorry for the inconvenience.

Ciao,
Mario


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to