ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From co...@apache.org
Subject cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
Date Fri, 21 Feb 2003 10:41:54 GMT
conor       2003/02/21 02:41:53

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
  Log:
  Optimization
  
  Revision  Changes    Path
  1.33      +11 -10    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.32
  retrieving revision 1.33
  diff -u -w -u -r1.32 -r1.33
  --- FTP.java	21 Feb 2003 09:42:36 -0000	1.32
  +++ FTP.java	21 Feb 2003 10:41:53 -0000	1.33
  @@ -642,28 +642,29 @@
       protected void createParents(FTPClient ftp, String filename)
            throws IOException, BuildException {
   
  -        String cwd = ftp.printWorkingDirectory();
  +        File dir = new File(filename);
  +        if (dirCache.contains(dir)) {
  +            return;
  +        }
  +
           
           Vector parents = new Vector();
  -        File dir = new File(filename);
           String dirname;
   
           while ((dirname = dir.getParent()) != null) {
  -            dir = new File(dirname);
  +            File checkDir = new File(dirname);
  +            if (dirCache.contains(checkDir)) {
  +                break;
  +            }
  +            dir = checkDir;
               parents.addElement(dir);
           }
   
           // find first non cached dir
           int i = parents.size() - 1;
  -        while (i >= 0) {
  -            dir = (File) parents.elementAt(i);
  -            if (!dirCache.contains(dir)) {
  -                break;
  -            }
  -            i--;
  -        }
                   
           if (i >= 0) {
  +            String cwd = ftp.printWorkingDirectory();
               String parent = dir.getParent();
               if (parent != null) {
                   if (!ftp.changeWorkingDirectory(parent)) {
  
  
  

Mime
View raw message