mirror of
https://github.com/openjdk/jdk.git
synced 2026-03-06 14:10:36 +00: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
@ -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) {
|
||||
return openPassiveDataConnection(cmd);
|
||||
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…
x
Reference in New Issue
Block a user