You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2010/05/17 11:17:27 UTC
svn commit: r945039 - in /ant/core/trunk: WHATSNEW
src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
Author: bodewig
Date: Mon May 17 09:17:19 2010
New Revision: 945039
URL: http://svn.apache.org/viewvc?rev=945039&view=rev
Log:
ftp download fails for certain setups. PR 49296. Based on patch by Kristof Neirynck
Modified:
ant/core/trunk/WHATSNEW
ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
Modified: ant/core/trunk/WHATSNEW
URL: http://svn.apache.org/viewvc/ant/core/trunk/WHATSNEW?rev=945039&r1=945038&r2=945039&view=diff
==============================================================================
--- ant/core/trunk/WHATSNEW (original)
+++ ant/core/trunk/WHATSNEW Mon May 17 09:17:19 2010
@@ -30,6 +30,10 @@ Fixed bugs:
name didn't occur inside more than one directory.
Bugzilla Report 36748.
+ * <ftp> could fail to download files from remote subdirectories under
+ certain circumstances.
+ Bugzilla Report 49296.
+
Other changes:
--------------
Modified: ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java?rev=945039&r1=945038&r2=945039&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/ant/taskdefs/optional/net/FTP.java Mon May 17 09:17:19 2010
@@ -834,7 +834,7 @@ public class FTP extends Task implements
} else if (!result) {
return;
}
- this.curpwd = this.curpwd + remoteFileSep
+ this.curpwd = getCurpwdPlusFileSep()
+ currentPathElement;
} catch (IOException ioe) {
throw new BuildException("could not change working dir to "
@@ -895,7 +895,7 @@ public class FTP extends Task implements
* @return absolute path as string
*/
public String getAbsolutePath() {
- return curpwd + remoteFileSep + ftpFile.getName();
+ return getCurpwdPlusFileSep() + ftpFile.getName();
}
/**
* find out the relative path assuming that the path used to construct
@@ -1037,6 +1037,17 @@ public class FTP extends Task implements
return curpwd;
}
/**
+ * returns the path of the directory containing the AntFTPFile.
+ * of the full path of the file itself in case of AntFTPRootFile
+ * and appends the remote file separator if necessary.
+ * @return parent directory of the AntFTPFile
+ * @since Ant 1.8.2
+ */
+ public String getCurpwdPlusFileSep() {
+ return curpwd.endsWith(remoteFileSep) ? curpwd
+ : curpwd + remoteFileSep;
+ }
+ /**
* find out if a symbolic link is encountered in the relative path of this file
* from rootPath.
* @return <code>true</code> if a symbolic link is encountered in the relative path.