commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serge.si...@mpsa.com
Subject [NET] empty result with listFiles() method whereas I should get files
Date Mon, 20 Nov 2006 08:40:24 GMT




Hello,

I have a strange behavior with commons-net, about FTP commands - with one
and only one AIX computer - and I can't find what the problem is.

I'm using Jakarta commons-net 1.4.1 (same problem with a build from august
2006).

I use a FTPClient object invoking the listFiles() method. It works well on
any machine, excepted on one, where I get no files resulting from the
listFiles() method, whereas there are many files in my home directory. With
a direct ftp from another tool (ftp command line from the computer where I
run my java program, or filezilla from my workstation), everything works
fine and I get all the files in my home directory, so my credentials are
right and there is probably no network or firewall issue.

Anyone has encountered this before ? Any idea about this ?

The jar is launched with Java 1.4.2.02, the not-working computer runs AIX
5.2 and I have another computer with exactly the same configuration (same
OS-level, same FTP server version) on which everythink works fine (as it
does on any other computer)

I use the following (pretty simple) code.
I have tried a few things :
- active / passive mode => same problem ;
- f.changeWorkingDirectory() before using listFiles() => same problem ;
- study f.getReplyCode(); => no usefull data in this case ;
- other account and/or other path => same problem ;

        org.apache.commons.net.ftp.FTPClient f = new
org.apache.commons.net.ftp.FTPClient();
        try {
            f.connect(ftpHostname);
            f.login(ftpLogin, ftpPassword);

            FTPFile[] files = f.listFiles();

            if ( files.length == 0 ) {
                System.out.println("  No results.");
            } else {
                for (int i = 0; i < files.length; i++) {
                    FTPFile f = files[i];
                    System.out.println(" > " + f.getName());
                }
            }

        } catch (SocketException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }



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