ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stuart Roebuck <stuart.roeb...@adolos.co.uk>
Subject [PATCH] optional/net/FTP Automatic make directory fault
Date Wed, 10 Jan 2001 16:40:07 GMT
I've come across an FTP server which returns code 553 in response to a make directory command
on an existing directory.  Currently the FTP task only accepts 550 errors as acceptable, so
I've added in 553 as well.

The consequence of this fault was that you couldn't FTP files onto a server if the files included
directories of files, and the directories already existed on the server before the FTP command
was issued.

Here's the patch:

Index: src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
retrieving revision 1.4
diff -u -r1.4 FTP.java
--- src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java	2001/01/03 14:18:45	1.4
+++ src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java	2001/01/10 16:33:00
@@ -512,8 +512,11 @@
                 log("creating remote directory " + resolveFile(dir.getPath()),
                     Project.MSG_VERBOSE);
                 ftp.makeDirectory(resolveFile(dir.getPath()));
+                // Both codes 550 and 553 can be produced by FTP Servers
+                //  to indicate that an attempt to create a directory has
+                //  failed because the directory already exists.
                 if (!FTPReply.isPositiveCompletion(ftp.getReplyCode()) &&
-                    (ftp.getReplyCode() != 550))
+                    (ftp.getReplyCode() != 550) && (ftp.getReplyCode() != 553))
                 {
                     throw new BuildException(
                                              "could not create directory: " +


Mime
View raw message