You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2001/06/22 16:49:28 UTC

[Bug 2285] New: - FTP optional Task...

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

*** shadow/2285	Fri Jun 22 07:49:28 2001
--- shadow/2285.tmp.19689	Fri Jun 22 07:49:28 2001
***************
*** 0 ****
--- 1,87 ----
+ +============================================================================+
+ | FTP optional Task...                                                       |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 2285                        Product: Ant                     |
+ |       Status: NEW                         Version: 1.3                     |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Critical                 OS/Version: Other                   |
+ |     Priority: Other                     Component: Optional Tasks          |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: ant-dev@jakarta.apache.org                                   |
+ |  Reported By: Jean-Francois.Morneau@ift.ulaval.ca                          |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ The optinal task does not go recursively in the specified directory accroding 
+ the fileset!
+ 
+ I've fixed the bug:
+ Change the old function to this one and it's fixed!
+ 
+ protected void scandir(String dir, String vpath, boolean fast) {
+             try {
+                 if (!ftp.changeWorkingDirectory(dir)) {
+                     System.out.println("ERROR: " + dir);
+                     return;
+                 }
+                 System.out.println("CHDir:" + ftp.printWorkingDirectory());
+                 FTPFile[] newfiles = ftp.listFiles();
+ 
+                 if (newfiles == null) {
+                     ftp.changeToParentDirectory();
+                     return;
+                 }
+ 
+                 for (int i = 0; i < newfiles.length; i++) {
+                     FTPFile file = newfiles[i];
+                     if(file.getName().equals(".") || file.getName().equals
+ ("..")){
+                     }else{
+                         if (file.isDirectory()) {
+                             String name = file.getName();
+                             if (isIncluded(name)) {
+                                 if (!isExcluded(name)) {
+                                     dirsIncluded.addElement(name);
+                                     if (fast) {
+                                         scandir(name, vpath + name + 
+ File.separator, fast);
+                                     }
+                                 } else {
+                                     dirsExcluded.addElement(name);
+                                 }
+                             } else {
+                                 dirsNotIncluded.addElement(name);
+                                 if (fast && couldHoldIncluded(name)) {
+                                     scandir(name, vpath + name + 
+ File.separator, fast);
+                                 }
+                             }
+                             if (!fast) {
+                                 scandir(name, vpath + name + File.separator, 
+ fast);
+                             }
+                         } else {
+                             if (file.isFile()) {
+                                 String name = vpath + file.getName();
+                                 if (isIncluded(name)) {
+                                     if (!isExcluded(name)) {
+                                         filesIncluded.addElement(name);
+                                     } else {
+                                         filesExcluded.addElement(name);
+                                     }
+                                 } else {
+                                     filesNotIncluded.addElement(name);
+                                 }
+                             }
+                         }
+                     }
+                 }
+                 ftp.changeToParentDirectory();
+             } catch (IOException e) {
+                 throw new BuildException("Error while communicating with FTP 
+ server: ", e);
+             }
+         }
+     }
\ No newline at end of file