You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by se...@mpsa.com on 2006/11/20 13:09:39 UTC

Réf. : Re: [NET] empty result with listFiles() method whereas I should get files




Hi Rory,

Thanks for your input, i didn't knew how to do that.
I've just tried it, and obviously, I still don't know what happens.

I'm unsure that the problem could be a parsing bug, because I tried to
emulate a FTP session directly through a "telnet" command, and I got
exactly the same output than the one received from a machine on which
everything works fine.

With the PrintCommandListener I get on a working AIX machine (<<<< =
received, >>>> = sent) :

<<<< 220 beaic1 FTP server (Version 4.1 Tue Jul 6 21:20:07 CDT 2004) ready.
>>>> USER test
<<<< 331 Password required for test.
>>>> PASS test
<<<< 230-Last unsuccessful login: Thu Nov  9 16:38:22 2006 on /dev/pts/7
from beahba
230-Last login: Mon Nov 20 12:49:29 2006 on ftp from beahba
230 User test logged in.
>>>> SYST
<<<< 215 UNIX Type: L8 Version: BSD-44
>>>> PASV
<<<< 227 Entering Passive Mode (10,68,188,139,236,238)
>>>> LIST
<<<< 150 Opening data connection for /bin/ls.
<<<< 226 Transfer complete.

And printing what is returned by listFiles() outputs :
 > .glancerc_aix
 > .profile
 > .rhosts
 > tmp
(...)

(but i'm surprised not to see in the output of the ProtocolCommandListener
the result of the LIST command returned by the server - either in passive
or active mode, is there something else to do to track data outputs from
the server ?)

And on the "not working" machine I get exatly the same log (but no data
resulting from listFiles() ):

<<<< 220 ylai0029 FTP server (Version 4.1 Tue Jul 6 21:20:07 CDT 2004)
ready.
>>>> USER test
<<<< 331 Password required for test.
>>>> PASS test
<<<< 230-Last login: lun 20 nov 12:49:29 NFT 2006 on ftp from beahba
230 User test logged in.
>>>> SYST
<<<< 215 UNIX Type: L8 Version: BSD-44
>>>> PASV
<<<< 227 Entering Passive Mode (10,68,212,66,210,94)
>>>> LIST
<<<< 150 Opening data connection for /bin/ls.
<<<< 226 Transfer complete.

(no data returned whereas I have .profile, tmp, and so on)

--
Serge.



                                                                           
             Rory Winston                                                  
             <rwinston@eircom                                              
             .net>                                                    Pour 
                                       Jakarta Commons Users List          
             20/11/2006 12:13          <co...@jakarta.apache.org>,  
                                       commons-user@jakarta.apache.org     
                                                                        cc 
                 Veuillez                                                  
                répondre à                                           Objet 
             Jakarta Commons           Re: [NET] empty result with         
                Users List             listFiles() method whereas I should 
             <commons-user@ja          get files                           
             karta.apache.org                                              
                    >                                                      
                                                                           
                                                                           
                                                                           
                                                                           




Hi Serge

You could try to look at the commands being passed back and forth between
the FTPClient and the server by adding a PrintCommandListener instance to
the client (see the FTP example classes for details), and see what the
server is passing back. Its possible that there is a dormant bug in the
directory entry parsing code being triggered here, in which case I would
recommend you open an issue in JIRA and attach all of the relevant
information you can (including the exact directory listing sent by the
server).

Thanks
Rory

"Jakarta Commons Users List" <co...@jakarta.apache.org> wrote:

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



-----------------------------------------------------------------
Find the home of your dreams with eircom net property
Sign up for email alerts now http://www.eircom.net/propertyalerts



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