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:[EMAIL PROTECTED]/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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]