commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "pete pete" <pi_cha...@hotmail.com>
Subject VFS: SftpFileObject.doListChildren
Date Tue, 04 Sep 2007 18:00:53 GMT
Hi, I'm trying to use VFS to list the files in an SFTP directory. Basically, 
this is what I'm trying:

FileSystemManager mgr = new customFileSystemManager(); // sftp provider 
enabled
FileObject fileDir = mgr.resolveFile("sftp://user:password@host/dir/");
if (fileDir.exists()) {
    FileObject[] files = fileDir.getChildren();
}


Now, the problem I'm having is that fileDir.getChildren() returns a 
FileObject list. However, it is trying to call 
SftpFileObject.doListChildren(), since fileDir is really an SftpFileObject 
under the hood (from what I understand). Sftp.FileObject.doListChildren() 
returns a String. So, I'm getting a casting error:

Caused by: java.lang.ClassCastException: com.jcraft.jsch.channelSftp$LsEntry
    at 
org.apache.commons.vfs.provider.sftp.SftpFileObject.doListChildren(SftpFileObject.java:228)
    at 
org.apache.commons.vfs.provider.AbstractFileObject.getChildren(AbstractFileObject.java:519)

Can someone help me get around this?

_________________________________________________________________
Get a FREE small business Web site and more from Microsoft® Office Live! 
http://clk.atdmt.com/MRT/go/aub0930003811mrt/direct/01/


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


Mime
View raw message