mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-22 20:14:43 +02:00
6919185: test/closed/sun/net/ftp/FtpTests fails to compile
Fixed a couple of regressions in FtpClient and updated the test. Reviewed-by: chegar
This commit is contained in:
parent
4641ee098b
commit
32443b7f2e
1 changed files with 14 additions and 1 deletions
|
@ -671,6 +671,10 @@ public class FtpClient extends sun.net.ftp.FtpClient {
|
|||
}
|
||||
if (!issueCommand(cmd)) {
|
||||
s.close();
|
||||
if (getLastReplyCode() == FtpReplyCode.FILE_UNAVAILABLE) {
|
||||
// Ensure backward compatibility
|
||||
throw new FileNotFoundException(cmd);
|
||||
}
|
||||
throw new sun.net.ftp.FtpProtocolException(cmd + ":" + getResponseString(), getLastReplyCode());
|
||||
}
|
||||
return s;
|
||||
|
@ -688,7 +692,16 @@ public class FtpClient extends sun.net.ftp.FtpClient {
|
|||
Socket clientSocket;
|
||||
|
||||
if (passiveMode) {
|
||||
try {
|
||||
return openPassiveDataConnection(cmd);
|
||||
} catch (sun.net.ftp.FtpProtocolException e) {
|
||||
// If Passive mode failed, fall back on PORT
|
||||
// Otherwise throw exception
|
||||
String errmsg = e.getMessage();
|
||||
if (!errmsg.startsWith("PASV") && !errmsg.startsWith("EPSV")) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
ServerSocket portSocket;
|
||||
InetAddress myAddress;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue