From 7e29d732ee07a2a759e440351e9696a68a1652f3 Mon Sep 17 00:00:00 2001 From: Andrew Wang Date: Tue, 8 Mar 2016 13:51:20 -0800 Subject: [PATCH] HADOOP-12895. SSLFactory#createSSLSocketFactory exception message is wrong. Contributed by Wei-Chiu Chuang. (cherry picked from commit a3cc6e2511e096ea9a54f500b59257866a1df66b) --- .../java/org/apache/hadoop/security/ssl/SSLFactory.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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 518de8095a8..ea658480d2e 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 class SSLFactory implements ConnectionConfigurator { 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 class SSLFactory implements ConnectionConfigurator { 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 class SSLFactory implements ConnectionConfigurator { */ 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; }