You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by ja...@apache.org on 2025/12/01 16:22:08 UTC

(ant) branch master updated: bz-69485 Revert the foreach loop change that was done to FTP.java in 1c80d507f496dde98869890e671edf635bef8dec

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 <ja...@apache.org>
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);


Re: (ant) branch master updated: bz-69485 Revert the foreach loop change that was done to FTP.java in 1c80d507f496dde98869890e671edf635bef8dec

Posted by Jaikiran Pai <ja...@apache.org>.
I've now pushed a commit to address this issue in FTPTaskMirrorImpl.java 
https://github.com/apache/ant/commit/f862774a9e2d2afe3d25d7116f0672eeb4f3e9bf

-Jaikiran

On 02/12/25 11:41 am, Stefan Bodewig wrote:
> On 2025-12-02, Jaikiran Pai wrote:
>
>> On 01/12/25 11:59 pm, Stefan Bodewig wrote:
>>> On 2025-12-01, <ja...@apache.org> wrote:
>>>> bz-69485 Revert the foreach loop change that was done to FTP.java in 1c80d507f496dde98869890e671edf635bef8dec
>>> FTPTaskMirrorImpl seems to share the same bug, see
>> Indeed. Thank you for catching that Stefan.
> It is easy to forget we have the same business logic duplicated
> here. Ages ago somebody asked for a way that allows commons-net to be
> loaded via a different classloader similar to what we did with JUnit 4.x
> support. I don't believe anybody is really using the "mirror" version in
> practice.
>
>> This one too seems to come from the same 1c80d507f496 commit.
> Yes, and they've not been the only ones over time.
>
>> I will address FTPTaskMirrorImpl.java today and then look into the
>> rest of that big commit.
> You may find it has been partially reverted in different places as well.
>
> Stefan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
>

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


Re: (ant) branch master updated: bz-69485 Revert the foreach loop change that was done to FTP.java in 1c80d507f496dde98869890e671edf635bef8dec

Posted by Stefan Bodewig <bo...@apache.org>.
On 2025-12-02, Jaikiran Pai wrote:

> On 01/12/25 11:59 pm, Stefan Bodewig wrote:
>> On 2025-12-01, <ja...@apache.org> wrote:

>>> bz-69485 Revert the foreach loop change that was done to FTP.java in 1c80d507f496dde98869890e671edf635bef8dec
>> FTPTaskMirrorImpl seems to share the same bug, see

> Indeed. Thank you for catching that Stefan.

It is easy to forget we have the same business logic duplicated
here. Ages ago somebody asked for a way that allows commons-net to be
loaded via a different classloader similar to what we did with JUnit 4.x
support. I don't believe anybody is really using the "mirror" version in
practice.

> This one too seems to come from the same 1c80d507f496 commit.

Yes, and they've not been the only ones over time.

> I will address FTPTaskMirrorImpl.java today and then look into the
> rest of that big commit.

You may find it has been partially reverted in different places as well.

Stefan

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


Re: (ant) branch master updated: bz-69485 Revert the foreach loop change that was done to FTP.java in 1c80d507f496dde98869890e671edf635bef8dec

Posted by Jaikiran Pai <ja...@apache.org>.
On 01/12/25 11:59 pm, Stefan Bodewig wrote:
> On 2025-12-01, <ja...@apache.org> wrote:
>
>> bz-69485 Revert the foreach loop change that was done to FTP.java in 1c80d507f496dde98869890e671edf635bef8dec
> FTPTaskMirrorImpl seems to share the same bug, see
>
> https://github.com/apache/ant/blob/79b72ac4f3852eab5736a2b56f96c2ec191506a0/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java#L727

Indeed. Thank you for catching that Stefan. This one too seems to come 
from the same 1c80d507f496 commit. I will address FTPTaskMirrorImpl.java 
today and then look into the rest of that big commit.

-Jaikiran


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


Re: (ant) branch master updated: bz-69485 Revert the foreach loop change that was done to FTP.java in 1c80d507f496dde98869890e671edf635bef8dec

Posted by Stefan Bodewig <bo...@apache.org>.
On 2025-12-01, <ja...@apache.org> wrote:

> bz-69485 Revert the foreach loop change that was done to FTP.java in 1c80d507f496dde98869890e671edf635bef8dec

FTPTaskMirrorImpl seems to share the same bug, see

https://github.com/apache/ant/blob/79b72ac4f3852eab5736a2b56f96c2ec191506a0/src/main/org/apache/tools/ant/taskdefs/optional/net/FTPTaskMirrorImpl.java#L727

Stefan

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