commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Darren Hartford" <>
Subject [VFS] SFTP and non-unix SFTP servers
Date Tue, 22 Jun 2004 14:39:44 GMT
Hey all,
Doing great work with the VFS/SFTP project!  A little more than just the JSCH project as far
as learning curve, but nice to have one interface to handle ALL FileSystems!!

In using SFTP in VFS, I came across a problem with the 'doListChildren' method in org.apache.commons.vfs.provider.sftp.SftpFileObject

The 'stat' string describing the file is not always in unix ls format (unfortunately).  Here
is an example one that I came across trying to use this in the realworld (minus quotes):

" 0  Jun 21, 2004 10:37 filename.txt"

For now, changed that method to have this block:

 * Licensed under the Apache License, Version 2.0 (the "License");

            final String stat = (String);
            final StringTokenizer tokens = new StringTokenizer(stat);
            int count = tokens.countTokens();
            // TODO - check there are the correct number of tokens
            // TODO - handle names with spaces in 'em
            for (int i = 0; i < count; tokens.nextToken(), i++)
            final String name = tokens.nextToken();
            if (name.equals(".") || name.equals("..") || name.equals("./") || name.equals("../"))

==end code==

Doesn't solve the 'handle name with spaces' problem, but at least takes care of the count,
and also added "./" and "../" exclusions.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message