bodewig 2004/12/21 06:08:20 Modified: . WHATSNEW src/main/org/apache/tools/ant/taskdefs/optional/net SetProxy.java Log: <setproxy> fails to provide password authentication on some JDKs. The patch provided in the bug report looked very similar to something I once had to do in production code, when Ant's original code wasn't enough. I forgot about it when we switched to commons-httpclient shortly thereafter. PR: 32667 Revision Changes Path 1.702 +3 -0 ant/WHATSNEW Index: WHATSNEW =================================================================== RCS file: /home/cvs/ant/WHATSNEW,v retrieving revision 1.701 retrieving revision 1.702 diff -u -r1.701 -r1.702 --- WHATSNEW 21 Dec 2004 13:38:06 -0000 1.701 +++ WHATSNEW 21 Dec 2004 14:08:20 -0000 1.702 @@ -218,6 +218,9 @@ * <scp> using <fileset> didn't work with OpenSSH 3.9 and later. Bugzilla report 31939 +* <setproxy> failed to set user/password on some JDKs. + Bugzilla report 32667 + Changes from Ant 1.6.1 to Ant 1.6.2 =================================== 1.24 +25 -0 ant/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java Index: SetProxy.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/net/SetProxy.java,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- SetProxy.java 22 Apr 2004 14:48:31 -0000 1.23 +++ SetProxy.java 21 Dec 2004 14:08:20 -0000 1.24 @@ -18,6 +18,8 @@ import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.net.Authenticator; +import java.net.PasswordAuthentication; import java.util.Properties; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; @@ -229,6 +231,15 @@ sysprops.remove("java.net.socks.password"); } } + + if (proxyUser != null) { + if (enablingProxy) { + Authenticator.setDefault(new ProxyAuth(proxyUser, + proxyPassword)); + } else if (settingsChanged) { + Authenticator.setDefault(new ProxyAuth("", "")); + } + } } /** @@ -250,5 +261,19 @@ applyWebProxySettings(); } + /** + * @since 1.6.3 + */ + private static final class ProxyAuth extends Authenticator { + private PasswordAuthentication auth; + + private ProxyAuth(String user, String pass) { + auth = new PasswordAuthentication(user, pass.toCharArray()); + } + + protected PasswordAuthentication getPasswordAuthentication() { + return auth; + } + } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]