# HG changeset patch # User robm # Date 1406903783 -3600 # Node ID 0bc2aa4aadbe2059f45942ca632a7d47a8cfc9c8 # Parent 4ae4525723a5ccffd6f7df46238c71b6c8627f09 8031435: Ftp download does not work properly for ftp user without password Reviewed-by: chegar diff -r 4ae4525723a5 -r 0bc2aa4aadbe jdk/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java --- a/jdk/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java Fri Aug 01 15:34:55 2014 +0100 +++ b/jdk/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 diff -r 4ae4525723a5 -r 0bc2aa4aadbe jdk/test/sun/net/ftp/FtpURL.java --- a/jdk/test/sun/net/ftp/FtpURL.java Fri Aug 01 15:34:55 2014 +0100 +++ b/jdk/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 {