File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Open Source Projects and the fly likes HELP! Weird bug in commons.net.ftp Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "HELP! Weird bug in commons.net.ftp" Watch "HELP! Weird bug in commons.net.ftp" New topic
Author

HELP! Weird bug in commons.net.ftp

Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
I've been using commons.net.ftp.FTPClient for over a year now, without any problems. Suddenly, when calling FTPClient.listFiles(), some of the entries in the returned list are NULLs (ie: some of the files on the server are listed, and some result in NULLs). But FTPClient.listNames() returns the filenames correctly! I'm at my wits end. Has anyone else had this problem before?

Here's some sample code:
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

What changed on your server?
Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
nothing. But files that were uploaded before yesterday are working fine (they show up in the .listFiles() results), and files that were added since then are returning NULLs in the .listFiles() results (one NULL entry for each file). So I get a mix of normal FTPFile instances, and NULLs.
Philippe Desrosiers
Ranch Hand

Joined: Mar 29, 2006
Posts: 138
update: If I call .listNames(), then cycle through the results, calling .listFiles for each filename, I get an empty array for each problem file...

so like:
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Originally posted by Philippe Desrosiers:
nothing.
No, something changed on your server. For example, there are different files on the server today than were there yesterday. And for example today is February 29 and not February 28, although you wouldn't think that software would have leap-year problems after all these years. Something is different.

Have you tried connecting to the FTP server from the command line and doing a DIR command to see what you can see?
David Sing
Greenhorn

Joined: Feb 29, 2008
Posts: 1
I've just started using the commons net FTPClient in the past two days and today experienced this same problem with files that have a Feb 29 timestamp. Everything has pointed to a leap-year problem with commons.net.ftp.FTPClient.

All other FTP clients have no problems on the same server (not controlled by me but used by '00s of others).

At least it won't bother us again for another 4 years

Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: HELP! Weird bug in commons.net.ftp