You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Mario Zannone (Updated) (JIRA)" <ji...@apache.org> on 2011/10/28 09:54:32 UTC
[jira] [Updated] (NET-427) In certain error/failure circumstances
ftpClient.listFiles(param) returns an empty list instead of null or an
exception
[ https://issues.apache.org/jira/browse/NET-427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Zannone updated NET-427:
------------------------------
Attachment: log_excerpt.txt
FtpTest.java
Test program and log excerpt
> In certain error/failure circumstances ftpClient.listFiles(param) returns an empty list instead of null or an exception
> -----------------------------------------------------------------------------------------------------------------------
>
> Key: NET-427
> URL: https://issues.apache.org/jira/browse/NET-427
> Project: Commons Net
> Issue Type: Bug
> Components: FTP
> Affects Versions: 3.0.1
> Environment: SunOS 5.10 Generic_144489-06
> Reporter: Mario Zannone
> Priority: Minor
> Attachments: FtpTest.java, log_excerpt.txt
>
>
> According to the API docs ftpClient.listFiles(String) should return
> null or an exception on error conditions or failure:
> The convention for all the FTP command methods in FTPClient is
> such that they either return a boolean value or some other value.
> The boolean methods return true on a successful completion reply
> from the FTP server and false on a reply resulting in an error
> condition or failure. The methods returning a value other than
> boolean return a value containing the higher level data produced
> by the FTP command, or null if a reply resulted in an error
> condition or failure.
> ( http://commons.apache.org/net/apidocs/org/apache/commons/net/ftp/FTPClient.html )
> However in certain error/failure circumstances listFiles(param)
> returns an empty list instead of null.
> Note that an empty list is a correct response when param does not
> match any file.
> We were able to bypass the problem checking the ftp reply with
> getReplyCode(). However, this listFiles behaviour is unexpected
> and should at least be documented.
> The error is not systematic and not easy to diagnose or replicate.
> We were able to reproduce it using cron to run the attached
> program every minute on a slow and unreliable connection;
> in 24h the error did show only a couple of times.
> Attachments: test program and excerpt from the test log.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira