commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steven Dickson" <>
Subject Commons VFS - FTP provider reports "invalid descendent" on getChildren()
Date Wed, 23 Apr 2003 15:55:04 GMT
Apologies if this is not the appropriate list to ask about a problem with VFS.  If a more appropriate
forum exists, please let me know
I'm having a problem with the getChildren() method on FTP FileObjects.  It's throwing an "Invalid
descendent file name "."." exception on an FTP file system folder.  The FTP folder was created
by and works properly with FTP clients.
Sample code follows:
            FileSystemManager fsm = VFS.getManager();
            FileObject ftpFile = fsm.resolveFile("");
            listChildren(ftpFile, true, "");

where listChildren() is:
         private static void listChildren( final FileObject dir, final boolean recursive,
final String prefix ) throws FileSystemException {
             FileObject[] children = dir.getChildren();    // *** Exception thrown here ***
             for ( int i = 0; i < children.length; i++ ) {
                 final FileObject child = children[ i ];
                 System.out.print( prefix );
                 System.out.print( child.getName().getBaseName() );
                 if ( child.getType() == FileType.FOLDER ) {
                     System.out.println( "/" );
                     if ( recursive ) {
                         listChildren( child, recursive, prefix + "    " );
                 else {
The exception is thrown where indicated in the listChildren() method.
The resulting stack trace follows:
org.apache.commons.vfs.FileSystemException: Invalid descendent file name ".".
        at org.apache.commons.vfs.provider.AbstractFileName.resolveName(
        at org.apache.commons.vfs.provider.AbstractFileObject.getChildren(
        at com.smartequip.FileManagementTool.DirWatch.listChildren(
        at com.smartequip.FileManagementTool.DirWatch.VFSTest(
        at com.smartequip.FileManagementTool.Main.junk(
        at com.smartequip.FileManagementTool.Main.main(
This same code works properly and as expected on other file system types e.g.
            FileObject jarFile = fsm.resolveFile("jar:C:\\junk\\test.jar");
            listChildren(jarFile, true, "");
The exception is only thrown with FTP file systems.
Has anyone else run into this problem?  Am I doing something wrong?  If it's a known problem,
is there a workaround? 

Thanks in advance for any pointers.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message