commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Ma" <jeff...@loni.ucla.edu>
Subject RE: VFS and SFTP, not working?
Date Thu, 13 Oct 2005 19:03:51 GMT
The following code will throw an exception, if there is a link file
under my directory. But if I use the code snip sent out by Mario a
couple days ago, it works, also, ftp is fine.

An FileObject file =
fsManager.resolveFile("sftp://me:passwd/mydirectory",opts);

org.apache.commons.vfs.FileSystemException: Invalid descendent file name
"MyPictures -> /dir1/dir2/MyPictures".
	at
org.apache.commons.vfs.impl.DefaultFileSystemManager.resolveName(Default
FileSystemManager.java:616)
	at
org.apache.commons.vfs.provider.AbstractFileObject.getChildren(AbstractF
ileObject.java:571)
	at
org.apache.commons.vfs.example.MyExample.main(MyExample.java:167)




-----Original Message-----
From: Mario Ivankovits [mailto:mario@ops.co.at] 
Sent: Thursday, October 06, 2005 10:18 PM
To: Jakarta Commons Users List
Subject: Re: VFS and SFTP, not working?

Hi!

Could you please try the following code snip. It this also hang its most

likely a jsch bug. Please replace --whatever-- with your informations.


        Properties props = new Properties();
        props.setProperty("StrictHostKeyChecking", "false");
        JSch jsch = new JSch();
        Session session = jsch.getSession("--user-name--", "--host--",
22);
        session.setUserInfo(new UserInfo()
        {
            public String getPassphrase()
            {
                return null;
            }

            public String getPassword()
            {
                return null;
            }

            public boolean promptPassword(String string)
            {
                return false;
            }

            public boolean promptPassphrase(String string)
            {
                return false;
            }

            public boolean promptYesNo(String string)
            {
                return true;
            }

            public void showMessage(String string)
            {
            }
        });
        session.setPassword("--your-password--");
        session.connect();
        ChannelSftp chan = (ChannelSftp) session.openChannel("sftp");
        chan.connect();
        Vector list = chan.ls("--your-directory--");
        Iterator iterList = list.iterator();
        while (iterList.hasNext())
        {
            System.err.println(iterList.next());
        }
        System.err.println("done");
        chan.disconnect();
        session.disconnect();


Thanks!
---
Mario


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


---------------------------------------------------------------------
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