提交 ae503985 编写于 作者: R robm

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

Reviewed-by: chegar
上级 c6ee3193
...@@ -301,7 +301,7 @@ public class FtpURLConnection extends URLConnection { ...@@ -301,7 +301,7 @@ public class FtpURLConnection extends URLConnection {
throw new IOException(fe); throw new IOException(fe);
} }
try { try {
ftp.login(user, password.toCharArray()); ftp.login(user, password == null ? null : password.toCharArray());
} catch (sun.net.ftp.FtpProtocolException e) { } catch (sun.net.ftp.FtpProtocolException e) {
ftp.close(); ftp.close();
// Backward compatibility // Backward compatibility
......
...@@ -483,7 +483,7 @@ public class FtpURL { ...@@ -483,7 +483,7 @@ public class FtpURL {
// Now let's check the URL handler // 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(); con = url.openConnection();
in = new BufferedReader(new InputStreamReader(con.getInputStream())); in = new BufferedReader(new InputStreamReader(con.getInputStream()));
do { do {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册