This is an automated email from the ASF dual-hosted git repository.

jaikiran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ant.git


The following commit(s) were added to refs/heads/master by this push:
     new 79b72ac4f bz-69485 Revert the foreach loop change that was done to 
FTP.java in 1c80d507f496dde98869890e671edf635bef8dec
79b72ac4f is described below

commit 79b72ac4f3852eab5736a2b56f96c2ec191506a0
Author: Jaikiran Pai <[email protected]>
AuthorDate: Mon Dec 1 21:49:18 2025 +0530

    bz-69485 Revert the foreach loop change that was done to FTP.java in 
1c80d507f496dde98869890e671edf635bef8dec
---
 .../apache/tools/ant/taskdefs/optional/net/FTP.java    | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

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 eee4f8210..33b4c1287 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
@@ -844,15 +844,17 @@ public class FTP extends Task implements FTPTaskConfig {
                     throw new BuildException(
                         "could not change working dir to %s", parent.curpwd);
                 }
-                for (String currentPathElement : pathElements) {
+                final int size = pathElements.size();
+                for (int fcount = 0; fcount < size - 1; fcount++) {
+                    String currentPathElement = pathElements.get(fcount);
                     try {
                         if (!this.client
-                            .changeWorkingDirectory(currentPathElement)) {
+                                .changeWorkingDirectory(currentPathElement)) {
                             if (!isCaseSensitive() && 
(remoteSystemCaseSensitive
-                                || !remoteSensitivityChecked)) {
+                                    || !remoteSensitivityChecked)) {
                                 currentPathElement =
-                                    findPathElementCaseUnsensitive(this.curpwd,
-                                        currentPathElement);
+                                        
findPathElementCaseUnsensitive(this.curpwd,
+                                                currentPathElement);
                                 if (currentPathElement == null) {
                                     return;
                                 }
@@ -860,11 +862,11 @@ public class FTP extends Task implements FTPTaskConfig {
                             return;
                         }
                         this.curpwd =
-                            getCurpwdPlusFileSep() + currentPathElement;
+                                getCurpwdPlusFileSep() + currentPathElement;
                     } catch (IOException ioe) {
                         throw new BuildException(
-                            "could not change working dir to %s from %s",
-                            currentPathElement, curpwd);
+                                "could not change working dir to %s from %s",
+                                currentPathElement, curpwd);
                     }
                 }
                 String lastpathelement = pathElements.get(pathElements.size() 
- 1);

Reply via email to