Hi VFS,

I might just be getting tired now, but the following test fails
with a NPE:

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("test2.txt");

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

           fo.moveTo(fo2);

  }

fo = file:///tmp/test.txt
fo2 = file:///tmp/test2.txt
Exception in thread "main" java.lang.NullPointerException
at org.apache.commons.vfs.provider.local.LocalFile.doRename(LocalFile.java:132) at org.apache.commons.vfs.provider.AbstractFileObject.moveTo(AbstractFileObject.java:930)
       at RenameCase.main(RenameCase.java:34)


Can anybody spot what I'm missing ?

Thanks,
- Filip



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

Reply via email to