changeset 7382:17abdc0b457f

8031435: Ftp download does not work properly for ftp user without password Reviewed-by: chegar
author robm
date Fri, 01 Aug 2014 15:36:23 +0100
parents 17055bf10cbf
children 01a6b7c65a73
files src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java test/sun/net/ftp/FtpURL.java
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java	Wed Aug 06 04:26:22 2014 -0700
+++ b/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java	Fri Aug 01 15:36:23 2014 +0100
@@ -301,7 +301,7 @@
             throw new IOException(fe);
         }
         try {
-            ftp.login(user, password.toCharArray());
+            ftp.login(user, password == null ? null : password.toCharArray());
         } catch (sun.net.ftp.FtpProtocolException e) {
             ftp.close();
             // Backward compatibility
--- a/test/sun/net/ftp/FtpURL.java	Wed Aug 06 04:26:22 2014 -0700
+++ b/test/sun/net/ftp/FtpURL.java	Fri Aug 01 15:36:23 2014 +0100
@@ -483,7 +483,7 @@
 
             // Now let's check the URL handler
 
-            url = new URL("ftp://user2:@localhost:" + port + "/%2Fusr/bin;type=d");
+            url = new URL("ftp://user2@localhost:" + port + "/%2Fusr/bin;type=d");
             con = url.openConnection();
             in = new BufferedReader(new InputStreamReader(con.getInputStream()));
             do {