diff --git a/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java b/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java index ee7684deb9de54021b7751559df04f37389e52de..d787ab3df1a435dc6e004f7765eb4b8c7dca5a2d 100644 --- a/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java +++ b/src/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java @@ -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 diff --git a/test/sun/net/ftp/FtpURL.java b/test/sun/net/ftp/FtpURL.java index 117913f6a636c171e7f6a059f3f26f2db9ca5439..64c4e8fc890b06a88892aa2e991f43d25eacfda7 100644 --- a/test/sun/net/ftp/FtpURL.java +++ b/test/sun/net/ftp/FtpURL.java @@ -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 {