commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicolas Delsaux <nicolas.dels...@gmail.com>
Subject [VFS][SFTP] Unable to navigate to directory
Date Wed, 15 Sep 2010 08:51:15 GMT
Hi all
following my previous question, I have a new issue regarding
navigation to a SFTP directory.
I connect to a remote SFTP server by first creating a FileObject
linked to its root folder, then I try to open a subdirectory by
calling resolveFile, but it seems to fail "in the middle". Here is the
code :

			FileObject root = fsManager.resolveFile("sftp:username:password@server/");
			FileObject target =
root.resolveFile("appli/myappli/data/files/ged_bur%250"));

			return target.getChildren().length>0;

I initially used target.exists(), but as it did not seems to work, I
tried to check for directory content, but it also fails.
Notice that when I ssh "by hand" to this server (with same username
and password), I can without any trouble navigate to this directory.
I done further exploration and notice that writing, in my debug
console the following succeeded

root.getChild("appli").getChild("myappli").getChild("data")

while the following failed

root.getChild("appli").getChild("myappli").getChild("data").getChild("files")

with this exception

org.apache.commons.vfs.FileSystemException: Could not list the
contents of "sftp://root:perigee@quasar/appli/perigee_63D/data"
because it is not a folder.
	at org.apache.commons.vfs.provider.AbstractFileObject.getChildren(AbstractFileObject.java:527)
	at org.apache.commons.vfs.provider.AbstractFileObject.getChild(AbstractFileObject.java:634)
	at com.perigee.svnsync.SftpExecutor.existsContent(SftpExecutor.java:166)
	at com.perigee.svnsync.SvnSynchronizer.examineRelease(SvnSynchronizer.java:32)
	at com.perigee.svnsync.SvnSynchronizer.synchronize(SvnSynchronizer.java:86)
	at com.perigee.svnsync.Main.run(Main.java:125)
	at com.perigee.svnsync.Main.main(Main.java:110)


Unfortunatly, a ls indicates that

total 1
drwxr-xr-x  3 root root  72 Jan 25  2010 .
drwxr-xr-x 20 root root 880 Sep  6 09:30 ..
drwxr-xr-x  5 root root 128 Mar 31 18:11 files

yes, as I expected, files is a directory.

Notice that I can also do all those SSH operations using, as an
example, WinSCP. Which leads me to think that this may not be a
server-side issue, but rather a problem with my use of commons VFS.

So, have you got any suggestions regarding this particular issue ?
Thanks

-- 
Nicolas Delsaux

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


Mime
View raw message