ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jaco de Groot <jaco.de.gr...@eo.nl>
Subject Re: FTP & Directories
Date Wed, 11 Apr 2001 13:14:34 GMT
Peter Donald wrote:
> 
> Can't we just proceed regardless of result of mkdir (perhaps issue a
> warning to log) and then the error will be picked up in next file transfer
> into directory ???

Maybe a wu-ftpd specific check is appropiate like:

    // The ftp server wu-ftpd-2.5.0-9 returns error code 521 "directory exists"
    // if a directory allready exists.
    private boolean wuFtpdDirExistError(FTPClient ftp) {
        boolean dirExistError = false;
        if (ftp.getReplyCode() == 521) {
            String[] replyStrings = ftp.getReplyStrings();
            String replyString = replyStrings[replyStrings.length - 1];
            if (replyString.endsWith("directory exists")) {
                dirExistError = true;
            }
        }
        return dirExistError;        
    }

and change:

(ftp.getReplyCode() != 550) && (ftp.getReplyCode() != 553))

to:

(ftp.getReplyCode() != 550) && (ftp.getReplyCode() != 553)
&& !wuFtpdDirExistError(ftp))

This way uploading to a wu-ftpd server works like it should, and we avoid
getting problems with other ftp servers who use 521 for other errors and we
don't need a special attribute.

Jaco

Mime
View raw message