Repository: hadoop Updated Branches: refs/heads/branch-2.8 df83d86da -> 49adab66b
HDFS-11050. Change log level to 'warn' when ssl initialization fails and defaults to DEFAULT_TIMEOUT_CONN_CONFIGURATOR. Contributed by Kuhu Shukla. (cherry picked from commit ce6bbfb23c9aafaf1aaeaeceba88286d4270b316) Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/49adab66 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/49adab66 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/49adab66 Branch: refs/heads/branch-2.8 Commit: 49adab66b848e17e1b7f302e8c4379ea3ff987ba Parents: df83d86 Author: Kihwal Lee <kih...@apache.org> Authored: Wed Oct 26 08:11:51 2016 -0500 Committer: Kihwal Lee <kih...@apache.org> Committed: Wed Oct 26 08:11:51 2016 -0500 ---------------------------------------------------------------------- .../hadoop/hdfs/web/URLConnectionFactory.java | 2 +- .../hadoop/hdfs/web/TestURLConnectionFactory.java | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/49adab66/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/URLConnectionFactory.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/URLConnectionFactory.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/URLConnectionFactory.java index 96095db..e0d10ac 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/URLConnectionFactory.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/URLConnectionFactory.java @@ -95,7 +95,7 @@ public class URLConnectionFactory { try { conn = newSslConnConfigurator(DEFAULT_SOCKET_TIMEOUT, conf); } catch (Exception e) { - LOG.debug( + LOG.warn( "Cannot load customized ssl related configuration. Fallback to" + " system-generic settings.", e); http://git-wip-us.apache.org/repos/asf/hadoop/blob/49adab66/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/web/TestURLConnectionFactory.java ---------------------------------------------------------------------- diff --git a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/web/TestURLConnectionFactory.java b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/web/TestURLConnectionFactory.java index 997e9ca..e028def 100644 --- a/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/web/TestURLConnectionFactory.java +++ b/hadoop-hdfs-project/hadoop-hdfs-client/src/test/java/org/apache/hadoop/hdfs/web/TestURLConnectionFactory.java @@ -22,11 +22,15 @@ import java.net.HttpURLConnection; import java.net.URL; import java.util.List; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.authentication.client.ConnectionConfigurator; +import org.apache.hadoop.security.ssl.SSLFactory; +import org.apache.hadoop.test.GenericTestUtils; import org.junit.Assert; import org.junit.Test; import com.google.common.collect.Lists; +import org.slf4j.LoggerFactory; public final class TestURLConnectionFactory { @@ -47,4 +51,17 @@ public final class TestURLConnectionFactory { fc.openConnection(u); Assert.assertEquals(1, conns.size()); } + + @Test + public void testSSLInitFailure() throws Exception { + Configuration conf = new Configuration(); + conf.set(SSLFactory.SSL_HOSTNAME_VERIFIER_KEY, "foo"); + GenericTestUtils.LogCapturer logs = + GenericTestUtils.LogCapturer.captureLogs( + LoggerFactory.getLogger(URLConnectionFactory.class)); + URLConnectionFactory.newDefaultURLConnectionFactory(conf); + Assert.assertTrue("Expected log for ssl init failure not found!", + logs.getOutput().contains( + "Cannot load customized ssl related configuration")); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org