diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java index 518de8095a..ea658480d2 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLFactory.java @@ -212,7 +212,8 @@ public SSLEngine createSSLEngine() public SSLServerSocketFactory createSSLServerSocketFactory() throws GeneralSecurityException, IOException { 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(); } @@ -229,7 +230,8 @@ public SSLServerSocketFactory createSSLServerSocketFactory() public SSLSocketFactory createSSLSocketFactory() throws GeneralSecurityException, IOException { 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(); } @@ -241,7 +243,8 @@ public SSLSocketFactory createSSLSocketFactory() */ public HostnameVerifier getHostnameVerifier() { 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; }