commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Murdoch <adammurd...@apache.org>
Subject Re: [VFS] "Could not list the contents of..."
Date Fri, 14 Mar 2003 14:09:27 GMT

Hi,

Listing files for ftp should be fixed now.

Listing files for http is not supported, because there's nothing in the 
protocol that allows it (of course, the error message could be a little 
better than 'it's not a folder').  You'll need to use webdav rather than 
http.

On Mon, 10 Mar 2003 07:55 pm, you wrote:
> Does the transcript of your interaction look something like this:
> > cd ftp://jbarrett:cheese@netmon01.sawyermedia.local/
>
> Current folder is ftp://jbarrett:cheese@netmon01.sawyermedia.local/
>
> > ls
>
> Contents of ftp://jbarrett:cheese@netmon01.sawyermedia.local/
> Command failed:
> org.apache.commons.vfs.FileSystemException: Could not list the contents of
> "ftp://jbarrett:cheese@netmon01.sawyermedia.local/" because it is not a
> folder. at
> org.apache.commons.vfs.provider.AbstractFileObject.getChildren(AbstractFile
>Object.java:470) at
> org.apache.commons.vfs.example.Shell.listChildren(Shell.java:292) at
> org.apache.commons.vfs.example.Shell.ls(Shell.java:283)
> 	at org.apache.commons.vfs.example.Shell.handleCommand(Shell.java:157)
> 	at org.apache.commons.vfs.example.Shell.go(Shell.java:125)
> 	at org.apache.commons.vfs.example.Shell.main(Shell.java:88)
>
>
> I think I've found the problem.  Here's the stack trace (sort of):
> Shell.listChildren() ->
> AbstractFileObject.getChildren() ->
> AbstractFileObject.attach() ->
> FtpFileObject.doAttach() ->
> FtpFileObject.getInfo()
>
> Now getInfo looks like this:
>
>     private void getInfo( boolean flush ) throws IOException
>     {
>         final FtpFileObject parent = (FtpFileObject)getParent();
>         if ( parent != null )
>         {
>             fileInfo = parent.getChildFile( getName().getBaseName(), flush
> ); }
>         if ( fileInfo == null || !fileInfo.isDirectory() )
>         {
>             children = EMPTY_FTP_FILE_ARRAY;
>         }
>     }
>
> It looks like getParent() returns null because we're currently at the root
> file of the filesystem.  That means fileinfo stays equal to null, which
> means our file type gets set to imaginary.  Imaginary files can't have
> children, so an exception is thrown.
>
> So the point is, I think we need to get an FTPFile instance for the root
> file of an FTP file system and set fileInfo to it.  Not sure how to get the
> FTPFile instance -- from looking at the api for FTPClient, the only way to
> get FTPFiles is via listFiles, which only produces children.  Any other
> thoughts?
>
> > -----Original Message-----
> > From: Bernard Johnson
> > [mailto:bjohnson+dated+1047712177.8813d4@symetrix.com]
> > Sent: Sunday, March 09, 2003 9:36 PM
> > To: commons-user@jakarta.apache.org
> > Subject: [VFS] "Could not list the contents of..."
> >
> >
> > I'm looking at using the VFS component in a piece of software
> > I'm developing.  Currently, I'm experimenting with the Shell
> > example program.  I can cp files from http locations, but
> > when I try to cd to the location and ls the files, I get the
> > message above, followed by the specifier of the location.
> >
> > Local locations work file.  Http and Ftp locations give the
> > error message.  Is there something special I need to do to
> > get the directory listing?
> >
> > Ideally, I'd like to be able to "walk" a remote location
> > (both http and ftp) to get a listing of files at that location.
> >
> > Thanks

-- 
Adam

Mime
View raw message