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 (Created) (JIRA)" <ji...@apache.org> on 2011/10/28 09:50:32 UTC
[jira] [Created] (NET-427) In certain error/failure circumstances
ftpClient.listFiles(param) returns an empty list instead of null or an
exception
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
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
[jira] [Updated] (NET-427) In certain error/failure circumstances
ftpClient.listFiles(param) returns an empty list instead of null or an
exception
Posted by "Mario Zannone (Updated) (JIRA)" <ji...@apache.org>.
[ 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
[jira] [Commented] (NET-427) In certain error/failure circumstances
ftpClient.listFiles(param) returns an empty list instead of null or an
exception
Posted by "Sebb (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NET-427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13180817#comment-13180817 ]
Sebb commented on NET-427:
--------------------------
I think the listFiles method is somewhat different, as it can potentially return a long list of files.
Does it make sense to return null even though one or more files have been successfully listed?
But I agree that this should be clarified in the Javadoc.
> 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
> 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
[jira] [Updated] (NET-427) In certain error/failure circumstances
ftpClient.listFiles(param) returns an empty list instead of null or an
exception
Posted by "Mario Zannone (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NET-427?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mario Zannone updated NET-427:
------------------------------
Priority: Major (was: Minor)
> 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
> 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
[jira] [Commented] (NET-427) In certain error/failure circumstances
ftpClient.listFiles(param) returns an empty list instead of null or an
exception
Posted by "Sebb (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/NET-427?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13182062#comment-13182062 ]
Sebb commented on NET-427:
--------------------------
Just noticed that the listNames methods (which use NLST rather than LIST) return null if completePendingCommand() returns false; i.e. any names retrieved so far will be lost.
So perhaps listFiles needs to behave the same way.
> 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
> 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