diff --git a/docs/manual/OptionalTasks/ftp.html b/docs/manual/OptionalTasks/ftp.html index 3476ee551..4f52fdc2a 100644 --- a/docs/manual/OptionalTasks/ftp.html +++ b/docs/manual/OptionalTasks/ftp.html @@ -150,6 +150,19 @@ the code to parse MS-DOS listings -any takers? No; defaults to false. +

Parameters specified as nested elements

+

fileset

+

The ftp task supports any number of nested <fileset> elements to specify +the files to be retrieved, or deleted, or listed, or whose mode you want to change.

+

+followsymlinks defaults to false for remote filesets. +Remote filesets are used for all actions except put. +

+

+Remote filesets do not support selectors.
+

+

Sending Files

The easiest way to describe how to send files is with a couple of examples:

diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
index 6556622ff..3fdd4f868 100644
--- a/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
+++ b/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
@@ -177,6 +177,9 @@ public class FTP
      * internal class allowing to read the contents of a remote file system
      * using the FTP protocol
      * used in particular for ftp get operations
+     * differences with DirectoryScanner
+     * "" (the root of the fileset) is never included in the included directories
+     * followSymlinks defaults to false
      */
     protected class FTPDirectoryScanner extends DirectoryScanner {
         protected FTPClient ftp = null;
@@ -189,6 +192,7 @@ public class FTP
         public FTPDirectoryScanner(FTPClient ftp) {
             super();
             this.ftp = ftp;
+            this.setFollowSymlinks(false);
         }
 
 
@@ -215,17 +219,6 @@ public class FTP
 
             try {
                 String cwd = ftp.printWorkingDirectory();
-                // register also the root directory of the fileset if it matches
-                // include and exclude patterns
-                if (isIncluded("")) {
-                    if (!isExcluded("")) {
-                        dirsIncluded.addElement("");
-                    } else {
-                        dirsExcluded.addElement("");
-                    }
-                } else {
-                    dirsNotIncluded.addElement("");
-                }
                 // always start from the current ftp working dir
 
                 scandir(".", "", true);
diff --git a/src/testcases/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java b/src/testcases/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
index 4b1b47f24..2c097ae77 100644
--- a/src/testcases/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
+++ b/src/testcases/org/apache/tools/ant/taskdefs/optional/net/FTPTest.java
@@ -157,7 +157,7 @@ public class FTPTest extends BuildFileTest{
                 ds.scan();
                 compareFiles(ds, new String[] {"alpha/beta/beta.xml",
                                                "alpha/beta/gamma/gamma.xml"},
-                    new String[] {"", "alpha", "alpha/beta",
+                    new String[] {"alpha", "alpha/beta",
                                   "alpha/beta/gamma"});
             }
         }
@@ -218,6 +218,7 @@ public class FTPTest extends BuildFileTest{
         FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
         ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
         ds.setIncludes(new String[] {"alpha/beta/gamma/"});
+        ds.setFollowSymlinks(true);
         ds.scan();
         compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
                      new String[] {"alpha/beta/gamma"});
@@ -255,6 +256,7 @@ public class FTPTest extends BuildFileTest{
         FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
         ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
         ds.setIncludes(new String[] {"alpha/beta/gamma/"});
+        ds.setFollowSymlinks(true);
         ds.scan();
         compareFiles(ds, new String[] {"alpha/beta/gamma/gamma.xml"},
                      new String[] {"alpha/beta/gamma"});
@@ -481,10 +483,9 @@ public class FTPTest extends BuildFileTest{
         FTP.FTPDirectoryScanner ds = myFTPTask.newScanner(ftp);
         ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
         ds.setExcludes(new String[] {"alpha/**"});
-        ds.setFollowSymlinks(false);
         ds.scan();
         compareFiles(ds, new String[] {"delta/delta.xml"},
-                    new String[] {"", "delta"});
+                    new String[] {"delta"});
 
         ds = myFTPTask.newScanner(ftp);
         if (!changeRemoteDir(remoteTmpDir)) {
@@ -492,12 +493,11 @@ public class FTPTest extends BuildFileTest{
         }
         ds.setBasedir(new File(getProject().getBaseDir(), "tmp"));
         ds.setExcludes(new String[] {"alpha"});
-        ds.setFollowSymlinks(false);
         ds.scan();
         compareFiles(ds, new String[] {"alpha/beta/beta.xml",
                                        "alpha/beta/gamma/gamma.xml",
                                         "delta/delta.xml"},
-                     new String[] {"", "alpha/beta", "alpha/beta/gamma", "delta"});
+                     new String[] {"alpha/beta", "alpha/beta/gamma", "delta"});
 
     }