8031435: Ftp download does not work properly for ftp user without password

Reviewed-by: chegar
This commit is contained in:
Rob McKenna 2014-08-01 15:36:23 +01:00
parent 063b7f5dc9
commit 96c0091bde
2 changed files with 2 additions and 2 deletions
jdk
src/share/classes/sun/net/www/protocol/ftp
test/sun/net/ftp

@ -301,7 +301,7 @@ public class FtpURLConnection extends URLConnection {
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

@ -483,7 +483,7 @@ public class FtpURL {
// 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 {