commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bernard Johnson <bjohnson+dated+1047767985.530...@symetrix.com>
Subject Re: [VFS] "Could not list the contents of..."
Date Mon, 10 Mar 2003 21:05:34 GMT
Yes, that is exactly the trace (with slightly different source file numbers)
that I'm getting.

Are you implying that the problem is caused by trying to read the root of
the VFS?  If I execute either of these commands in the Shell, I get the same
stacktrace:

ls http://updates.redhat.com
ls http://updates.rehdat.com/8.0

(or ftp is the same result)

Or perhaps you meant that the "children gathering" terminates at the root
level because the getParent() returns null.

I had come to somewhat the same point as you but figured I must be an idiot
because such a fundamental operation could not be broken :)  I just went
back and looked at the doGetType() operation again, and I'd agree with you
that in order for this to work, the getParent() needs to either return us
something other than null or more likely, we need to create the root
FTPFileObject....   I guess I'll dig further for answers...

----- Original Message -----
From: "Jeff Barrett" <JBarrett@sawyermedia.com>
To: "Jakarta Commons Users List" <commons-user@jakarta.apache.org>
Sent: Monday, March 10, 2003 12:55 PM
Subject: RE: [VFS] "Could not list the contents of..."


> 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(AbstractFileO
bject.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
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

Mime
View raw message