You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by pete pete <pi...@hotmail.com> on 2007/09/04 20:00:53 UTC

VFS: SftpFileObject.doListChildren

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


Re: VFS: SftpFileObject.doListChildren

Posted by Mario Ivankovits <ma...@ops.co.at>.
Hi!
> 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) 
>
I see two possibilities, you use a very old jsch library, or the version 
you use (a newer one) has some incompatible change.

Which version do you use?

Ciao,
Mario


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