HADOOP-12895. SSLFactory#createSSLSocketFactory exception message is wrong. Contributed by Wei-Chiu Chuang.

(cherry picked from commit a3cc6e2511)
This commit is contained in:
Andrew Wang 2016-03-08 13:51:20 -08:00
parent fb139b0c40
commit 7e29d732ee
1 changed files with 6 additions and 3 deletions

View File

@ -212,7 +212,8 @@ public class SSLFactory implements ConnectionConfigurator {
public SSLServerSocketFactory createSSLServerSocketFactory() public SSLServerSocketFactory createSSLServerSocketFactory()
throws GeneralSecurityException, IOException { throws GeneralSecurityException, IOException {
if (mode != Mode.SERVER) { if (mode != Mode.SERVER) {
throw new IllegalStateException("Factory is in CLIENT mode"); throw new IllegalStateException(
"Factory is not in SERVER mode. Actual mode is " + mode.toString());
} }
return context.getServerSocketFactory(); return context.getServerSocketFactory();
} }
@ -229,7 +230,8 @@ public class SSLFactory implements ConnectionConfigurator {
public SSLSocketFactory createSSLSocketFactory() public SSLSocketFactory createSSLSocketFactory()
throws GeneralSecurityException, IOException { throws GeneralSecurityException, IOException {
if (mode != Mode.CLIENT) { if (mode != Mode.CLIENT) {
throw new IllegalStateException("Factory is in CLIENT mode"); throw new IllegalStateException(
"Factory is not in CLIENT mode. Actual mode is " + mode.toString());
} }
return context.getSocketFactory(); return context.getSocketFactory();
} }
@ -241,7 +243,8 @@ public class SSLFactory implements ConnectionConfigurator {
*/ */
public HostnameVerifier getHostnameVerifier() { public HostnameVerifier getHostnameVerifier() {
if (mode != Mode.CLIENT) { if (mode != Mode.CLIENT) {
throw new IllegalStateException("Factory is in CLIENT mode"); throw new IllegalStateException(
"Factory is not in CLIENT mode. Actual mode is " + mode.toString());
} }
return hostnameVerifier; return hostnameVerifier;
} }