Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-2920 -- improve handling for missing trust.store.path in the index-writers.xml

tallison5fc2839c447a
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);