From 2540910dec4decc0d9aa34c5918fcc9d0cd5e6e2 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 14 Oct 2024 09:15:30 +0200 Subject: [PATCH] lastIndex*O*f --- WHATSNEW | 4 ++++ src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 5fdf91528b..e7af9c4299 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -1,7 +1,11 @@ Changes from Ant 1.10.15 TO Ant 1.10.16 ======================================= +Fixed bugs: +----------- + * now properly handles IPv6 addresses as hostnames. + Bugzilla Report 59160 Changes from Ant 1.10.14 TO Ant 1.10.15 ======================================= diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java index 8719d39042..07c96896ba 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/ssh/Scp.java @@ -435,8 +435,9 @@ private String parseUri(final String uri) { throw new BuildException("no username was given. Can't authenticate."); } - // For IPv6 address having more than one ":", it should look for the last occurrence - final int indexOfPath = uri.lastIndexof(':'); + // For IPv6 addresses, the host part may contain more than one ":", + // look for the last occurrence + final int indexOfPath = uri.lastIndexOf(':'); if (indexOfPath <= indexOfAt) { throw new BuildException("no remote path in %s", uri); }