commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 18771] New: - FtpClient.retrieveFileStream returns null
Date Mon, 07 Apr 2003 17:56:44 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18771>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=18771

FtpClient.retrieveFileStream returns null

           Summary: FtpClient.retrieveFileStream returns null
           Product: Commons
           Version: 1.0 Final
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Net
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: bmandl@itv.globalrefund.com


My program calls FtpClient.retrieveFileStream for every file in a directory and 
deletes the file from the directory after it has been successfully read.

FtpClient.retrieveFileStream returns null for every 2nd file.
FtpClient.getReplyCode() returns 200 when this happens.

When I call FtpClient.retrieveFileStream a 2nd time for the same file it works. 
So this is my workaround code:

    InputStream in = null;

    int i;
    for (i=0; i<100 && in == null; i++) {
      in = ftpClient.retrieveFileStream(absoluteFileName);

      // This is a workaround for what seems to be a bug in jakarta commons-net 
1.0.0
      // FtpClient.retrieveFileStream() returns null on every second call with 
a reply code of 200
      // But 200 is a positive completetion code, so this should not fail. try 
again
      if (in == null && !FTPReply.isPositiveCompletion( ftpClient.getReplyCode
() )) break;
    };

    if (in == null) throw new IOException( ftpClient.getReplyString() );


My program is rather small and simple, so I could send you the whole program if 
you want to reproduce this with minimum effort.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message