dsmiley commented on code in PR #2828:
URL: https://github.com/apache/solr/pull/2828#discussion_r1825196815


##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpJdkSolrClient.java:
##########
@@ -173,8 +173,8 @@ public NamedList<Object> request(SolrRequest<?> 
solrRequest, String collection)
           "Timeout occurred while waiting response from server at: " + 
pReq.url, e);
     } catch (SolrException se) {
       throw se;
-    } catch (RuntimeException re) {
-      throw new SolrServerException(re);
+    } catch (IOException | RuntimeException e) {

Review Comment:
   The request method declares it throws IOException; shouldn't we propagate it 
instead of wrap?



##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/LBHttp2SolrClientTest.java:
##########
@@ -50,8 +52,8 @@ public void 
testLBHttp2SolrClientWithTheseParamNamesInTheUrl() {
 
     try (Http2SolrClient http2SolrClient =
             new 
Http2SolrClient.Builder(url).withTheseParamNamesInTheUrl(urlParamNames).build();

Review Comment:
   perhaps some tests methods shouldn't care in theory what the httpSolrClient 
impl is exactly but it'd be nice to get one randomly or via parameterization 
even better.  Not sure if that'd be too difficult.



##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java:
##########
@@ -37,9 +37,9 @@
 import org.slf4j.MDC;
 
 /**
- * LBHttp2SolrClient or "LoadBalanced LBHttp2SolrClient" is a load balancing 
wrapper around {@link
- * Http2SolrClient}. This is useful when you have multiple Solr endpoints and 
requests need to be
- * Load Balanced among them.
+ * LBHttp2SolrClient or "LoadBalanced Http Solr Client" is a load balancing 
wrapper around a Http

Review Comment:
   Don't need to share the name of our own class redundantly



##########
solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttp2SolrClient.java:
##########
@@ -284,16 +286,16 @@ private void onFailedRequest(
     }
   }
 
-  public static class Builder {
+  public static class Builder<C extends HttpSolrClientBase> {
 
-    private final Http2SolrClient http2SolrClient;
-    private final Endpoint[] solrEndpoints;
+    private final C solrClient;
+    private final LBSolrClient.Endpoint[] solrEndpoints;
     private long aliveCheckIntervalMillis =
         TimeUnit.MILLISECONDS.convert(60, TimeUnit.SECONDS); // 1 minute 
between checks
     protected String defaultCollection;
 
-    public Builder(Http2SolrClient http2Client, Endpoint... endpoints) {
-      this.http2SolrClient = http2Client;
+    public Builder(C http2Client, LBSolrClient.Endpoint... endpoints) {

Review Comment:
   Can you add a static import for that Endpoint inner class so it looks simple 
as it was?
   
   minor but can you please rename "http2Client" to incorporate the name "Solr" 
like just call it "solrClient" is fine.  I like a SolrClient and HttpClient to 
not be confusable.



##########
solr/solrj/src/test/org/apache/solr/client/solrj/impl/MockTrustManager.java:
##########
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.solr.client.solrj.impl;
+
+import java.net.Socket;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509ExtendedTrustManager;
+import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.util.SSLTestConfig;
+
+/**
+ * Taken from: https://www.baeldung.com/java-httpclient-ssl sec 4.1, 
2024/02/12. This is an
+ * all-trusting Trust Manager. Works with self-signed certificates.
+ */
+public class MockTrustManager extends X509ExtendedTrustManager {

Review Comment:
   nice to see this separated



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to