commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Barrett <jbarr...@sawyermedia.com>
Subject Re: Commons VFS - FTP provider reports "invalid descendent" on getChildren()
Date Fri, 25 Apr 2003 18:18:36 GMT
This isn't necessarily a fix, but it might be helpful.

I've noticed some wonkey behavior with the FTP provider when you are 
playing around at the root directory of an FTP FileObject.  Try your 
operation in a subdirectory and see if that makes a difference.  And 
please let us know if it did.

+jeff

Steven Dickson wrote:
> 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("ftp://user:password@ftp.wibble.com/");
>             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 {
>                      System.out.println();
>                  }
>              }
>          }
>  
> 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(AbstractFileName.java:187)
>         at org.apache.commons.vfs.provider.AbstractFileObject.getChildren(AbstractFileObject.java:507)
>         at com.smartequip.FileManagementTool.DirWatch.listChildren(DirWatch.java:42)
>         at com.smartequip.FileManagementTool.DirWatch.VFSTest(DirWatch.java:100)
>         at com.smartequip.FileManagementTool.Main.junk(Main.java:23)
>         at com.smartequip.FileManagementTool.Main.main(Main.java:40)
>  
> 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.
>  
> S.
>  



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message