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" <[EMAIL PROTECTED]> To: "Jakarta Commons Users List" <[EMAIL PROTECTED]> 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:[EMAIL PROTECTED]/ > Current folder is ftp://jbarrett:[EMAIL PROTECTED]/ > > ls > Contents of ftp://jbarrett:[EMAIL PROTECTED]/ > Command failed: > org.apache.commons.vfs.FileSystemException: Could not list the contents of "ftp://jbarrett:[EMAIL PROTECTED]/" 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:[EMAIL PROTECTED] > > Sent: Sunday, March 09, 2003 9:36 PM > > To: [EMAIL PROTECTED] > > 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: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
