ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject cvs commit: ant/docs/manual/OptionalTasks ftp.html
Date Fri, 04 Mar 2005 22:31:43 GMT
jkf         2005/03/04 14:31:42

  Modified:    src/main/org/apache/tools/ant/taskdefs/optional/net FTP.java
               docs/manual/OptionalTasks ftp.html
  Log:
  PR: 33770
  
  Improved FTP task to not fail on hidden directories.
  
  Revision  Changes    Path
  1.65      +26 -9     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.64
  retrieving revision 1.65
  diff -u -r1.64 -r1.65
  --- FTP.java	18 Feb 2005 23:28:00 -0000	1.64
  +++ FTP.java	4 Mar 2005 22:31:40 -0000	1.65
  @@ -194,7 +194,8 @@
               try {
                   String cwd = ftp.printWorkingDirectory();
                   // always start from the current ftp working dir
  -
  +                forceRemoteSensitivityCheck();
  +                
                   checkIncludePatterns();
                   clearCaches();
                   ftp.changeWorkingDirectory(cwd);
  @@ -210,6 +211,7 @@
            * @since ant1.6
            */
           private void checkIncludePatterns() {
  +
               Hashtable newroots = new Hashtable();
               // put in the newroots vector the include patterns without
               // wildcard tokens
  @@ -246,6 +248,7 @@
                       String path = null;
   
                       if (myfile.exists()) {
  +                        forceRemoteSensitivityCheck();
                           if (remoteSensitivityChecked
                               && remoteSystemCaseSensitive && isFollowSymlinks())
{
                               // cool case,
  @@ -262,7 +265,6 @@
                                   throw new BuildException(be, getLocation());
                               } catch (BuildException be) {
                                   isOK = false;
  -
                               }
                           }
                       } else {
  @@ -509,6 +511,17 @@
               }
               return result;
           }
  +        
  +        private void forceRemoteSensitivityCheck()
  +        {
  +            if (!remoteSensitivityChecked) {
  +                try {
  +                    checkRemoteSensitivity(ftp.listFiles(), ftp.printWorkingDirectory());
  +                } catch (IOException ioe) {
  +                    throw new BuildException(ioe, getLocation());
  +                }
  +            }
  +        }
           /**
            * cd into one directory and
            * list the files present in one directory.
  @@ -763,14 +776,16 @@
                       if (theFiles != null) {
                           theFile = getFile(theFiles, currentElement);
                       }
  +                    if (!relPath.equals("")) {
  +                        relPath = relPath + remoteFileSep;
  +                    }
                       if (theFile == null) {
  -                        throw new BuildException("could not find " + currentElement
  -                            + " from " + currentPath);
  +                        // hit a hidden file assume not a symlink
  +                        relPath = relPath + currentElement;
  +                        currentPath = currentPath + remoteFileSep + currentElement;
  +                        log("Hidden file " + relPath + " assumed to not be a symlink.",
Project.MSG_VERBOSE);
                       } else {
                           traversesSymlinks = traversesSymlinks || theFile.isSymbolicLink();
  -                        if (!relPath.equals("")) {
  -                            relPath = relPath + remoteFileSep;
  -                        }
                           relPath = relPath + theFile.getName();
                           currentPath = currentPath + remoteFileSep + theFile.getName();
                       }
  @@ -854,6 +869,10 @@
                   }
                   return traversesSymlinks;
               }
  +            
  +            public String toString() {
  +                return "AntFtpFile: "+curpwd+"%"+ftpFile;
  +            }
           }
           /**
            * special class to represent the remote directory itself
  @@ -1273,7 +1292,6 @@
       protected int transferFiles(FTPClient ftp, FileSet fs)
            throws IOException, BuildException {
           DirectoryScanner ds;
  -
           if (action == SEND_FILES) {
               ds = fs.getDirectoryScanner(getProject());
           } else {
  @@ -1771,7 +1789,6 @@
       protected void getFile(FTPClient ftp, String dir, String filename)
            throws IOException, BuildException {
           OutputStream outstream = null;
  -
           try {
               File file = getProject().resolveFile(new File(dir, filename).getPath());
   
  
  
  
  1.28      +3 -1      ant/docs/manual/OptionalTasks/ftp.html
  
  Index: ftp.html
  ===================================================================
  RCS file: /home/cvs/ant/docs/manual/OptionalTasks/ftp.html,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- ftp.html	19 Nov 2004 09:07:11 -0000	1.27
  +++ ftp.html	4 Mar 2005 22:31:40 -0000	1.28
  @@ -262,11 +262,13 @@
   href="../CoreTypes/fileset.html"><code>&lt;fileset&gt;</code></a>
elements to specify
   the files to be retrieved, or deleted, or listed, or whose mode you want to change.</p>
   <p>
  -The attribute <code>followsymlinks</code> of <code>fileset</code>
is fully supported on
  +The attribute <code>followsymlinks</code> of <code>fileset</code>
is supported on
   local (put) as well as remote (get, chmod, delete) filesets.
   <em>Before ant 1.6 there was no support of symbolic links in remote filesets.
   In order to exclude symbolic links (preserve the behavior of ant 1.5.x and older),
   you need to explicitly set <code>followsymlinks</code> to <code>false</code>.</em>
  +On remote filesets hidden files are not checked for being symbolic links. Hidden
  +files are currently assumed to not be symbolic links.
   </p>
   <p>
   Remote filesets do not support selectors.<br/>
  
  
  

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


Mime
View raw message