commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Barrett <jbarr...@sawyermedia.com>
Subject Re: [VFS] - FTP provider reports "invalid descendent" on getChildren()
Date Mon, 28 Apr 2003 21:43:20 GMT
Another troubleshooting tool I just thought of, Shell.

Try running the example.Shell class that comes w/ VFS -- it provides a 
CLI type interface that lets you do things like:

 > cd ftp://jeff:cheese@server.com/blah
 > ls
thisfile.txt
thatfile.txt
 >

Steven Dickson wrote:
> Jeff,
>  
> Thanks for the feedback, appreciate it.  
>  
> I've narrowed the scope of the problem somewhat.  The code falls over on some FTP accounts/servers
but works correctly on others.  Also, as you indicated, the code is less stable when listing
the contents of a root directory than of sub-directories.  
>  
> I'm still concerned that I'm not using the VFS API correctly.  Can anyone provide a small,
known-correct code sample which lists the contents of a folder on an FTP site?  
>  
> Also, does anyone know of any constraints or limitations which may cause the FTP provider
to fail on certain accounts/servers but not on others?  In all cases, I am able to FTP in
- with appropriate user name and password - using an FTP client.
>  
> Any pointers would be much appreciated.
>  
> S.
>  
> 
> 	-----Original Message----- 
> 	From: Jeff Barrett [mailto:jbarrett@sawyermedia.com] 
> 	Sent: Fri 4/25/2003 2:18 PM 
> 	To: commons-dev@jakarta.apache.org 
> 	Cc: 
> 	Subject: Re: Commons VFS - FTP provider reports "invalid descendent" on getChildren()
> 	
> 	
> 
> 	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
> 	
> 	



---------------------------------------------------------------------
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