Hi VFS,

I found one more 'bug' (undesired effect...): VFS can't seem to handle files with '#' in their
name (don't ask.. I know, but I actually had a user that created those...)

Consider the following test:

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

public class TestHash {


  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 0000 #000.txt");
           dummy.createNewFile();

           FileObject fo = root.resolveFile("test 0000 #000.txt");

           System.out.println("URL = " + fo.getURL());
           System.out.println("URL Path = " + fo.getURL().getPath());

  }

}

This test produces the following output

URL = file:///tmp/test 0000
URL Path = ///tmp/test 0000

As you can see, part following the # has been dropped from the URL, yet the resolveFile() succeeded.. What's happening is that 000.txt gets stuck in the URL.getRef()...

I'm not sure how to handle this -- I'm guessing that the local file provider should encode/decode the '#' characters appropriately so they don't get stuck in the wrong part of the URL...

Cheers,
- Filip




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

Reply via email to