You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nutch.apache.org by sn...@apache.org on 2023/03/06 10:08:15 UTC

[nutch] 04/07: NUTCH-2920 -- improve handling for missing trust.store.path in the index-writers.xml

This is an automated email from the ASF dual-hosted git repository.

snagel pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nutch.git

commit 5fc2839c447a1b3695b4bcb507d428d32ff27281
Author: tallison <ta...@apache.org>
AuthorDate: Wed Mar 1 13:28:07 2023 -0500

    NUTCH-2920 -- improve handling for missing trust.store.path in the index-writers.xml
---
 .../nutch/indexwriter/opensearch1x/OpenSearch1xIndexWriter.java    | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/plugin/indexer-opensearch-1x/src/java/org/apache/nutch/indexwriter/opensearch1x/OpenSearch1xIndexWriter.java b/src/plugin/indexer-opensearch-1x/src/java/org/apache/nutch/indexwriter/opensearch1x/OpenSearch1xIndexWriter.java
index a121f15a2..ec516e250 100644
--- a/src/plugin/indexer-opensearch-1x/src/java/org/apache/nutch/indexwriter/opensearch1x/OpenSearch1xIndexWriter.java
+++ b/src/plugin/indexer-opensearch-1x/src/java/org/apache/nutch/indexwriter/opensearch1x/OpenSearch1xIndexWriter.java
@@ -253,9 +253,6 @@ public class OpenSearch1xIndexWriter implements IndexWriter {
   }
 
   private SSLContext createSSLContext() throws GeneralSecurityException, IOException {
-    if (trustStorePath == null && keyStorePath == null) {
-      return SSLContexts.createDefault();
-    }
 
     SSLContextBuilder sslBuilder = SSLContexts.custom();
     Optional<KeyStore> trustStore = loadStore(trustStorePath, trustStorePassword, trustStoreType);
@@ -283,8 +280,8 @@ public class OpenSearch1xIndexWriter implements IndexWriter {
     if (StringUtils.isAllBlank(storePath)) {
       return Optional.empty();
     }
-    if (StringUtils.isAllBlank(storePassword)) {
-      throw new IllegalArgumentException("must include a password for store: " + storePath);
+    if (storePassword == null) {
+      throw new IllegalArgumentException("must include a non-null password for store: " + storePath);
     }
 
     KeyStore store = KeyStore.getInstance(storeType);