ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anto...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
Date Mon, 13 Oct 2003 19:48:42 GMT
antoine     2003/10/13 12:48:42

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/net Tag:
                        ANT_16_BRANCH FTP.java
  Log:
  Fix a bug with the action RMDIR of the FTP task
  The RMDIR action was bound to fail if there was more than one level of directories to delete.
  The problem has been reported by Sairam Manda on the user list on October 10th and 13th.
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.52.2.1  +28 -24    ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
  
  Index: FTP.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java,v
  retrieving revision 1.52
  retrieving revision 1.52.2.1
  diff -u -r1.52 -r1.52.2.1
  --- FTP.java	12 Sep 2003 20:32:29 -0000	1.52
  +++ FTP.java	13 Oct 2003 19:48:42 -0000	1.52.2.1
  @@ -1357,30 +1357,34 @@
                   }
                   bw = new BufferedWriter(new FileWriter(listing));
               }
  -
  -            for (int i = 0; i < dsfiles.length; i++) {
  -                switch (action) {
  -                    case SEND_FILES:
  -                        sendFile(ftp, dir, dsfiles[i]);
  -                        break;
  -                    case GET_FILES:
  -                        getFile(ftp, dir, dsfiles[i]);
  -                        break;
  -                    case DEL_FILES:
  -                        delFile(ftp, dsfiles[i]);
  -                        break;
  -                    case LIST_FILES:
  -                        listFile(ftp, bw, dsfiles[i]);
  -                        break;
  -                    case CHMOD:
  -                        doSiteCommand(ftp, "chmod " + chmod + " " + resolveFile(dsfiles[i]));
  -                        transferred++;
  -                        break;
  -                    case RM_DIR:
  -                        rmDir(ftp, dsfiles[i]);
  -                        break;
  -                    default:
  -                        throw new BuildException("unknown ftp action " + action);
  +            if (action == RM_DIR) {
  +                // to remove directories, start by the end of the list
  +                // the trunk does not let itself be removed before the leaves
  +                for (int i = dsfiles.length - 1; i >= 0; i--) {
  +                    rmDir(ftp, dsfiles[i]);
  +                }
  +            }   else {
  +                for (int i = 0; i < dsfiles.length; i++) {
  +                    switch (action) {
  +                        case SEND_FILES:
  +                            sendFile(ftp, dir, dsfiles[i]);
  +                            break;
  +                        case GET_FILES:
  +                            getFile(ftp, dir, dsfiles[i]);
  +                            break;
  +                        case DEL_FILES:
  +                            delFile(ftp, dsfiles[i]);
  +                            break;
  +                        case LIST_FILES:
  +                            listFile(ftp, bw, dsfiles[i]);
  +                            break;
  +                        case CHMOD:
  +                            doSiteCommand(ftp, "chmod " + chmod + " " + resolveFile(dsfiles[i]));
  +                            transferred++;
  +                            break;
  +                        default:
  +                            throw new BuildException("unknown ftp action " + action);
  +                    }
                   }
               }
           } finally {
  
  
  

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


Mime
View raw message