You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2023/03/29 14:59:22 UTC
[solr] branch main updated: SOLR-16723: Http2SolrClient should not use Apache Http client classes (#1503)
This is an automated email from the ASF dual-hosted git repository.
krisden pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/main by this push:
new 2e6715a2d6d SOLR-16723: Http2SolrClient should not use Apache Http client classes (#1503)
2e6715a2d6d is described below
commit 2e6715a2d6d22bcfaef52e5cfc2fb516d84fa766
Author: Kevin Risden <ri...@users.noreply.github.com>
AuthorDate: Wed Mar 29 10:59:13 2023 -0400
SOLR-16723: Http2SolrClient should not use Apache Http client classes (#1503)
---
solr/CHANGES.txt | 2 ++
.../java/org/apache/solr/client/solrj/impl/Http2SolrClient.java | 9 +++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b153cef5b8b..dc71eea41d7 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -83,6 +83,8 @@ Bug Fixes
* SOLR-16638: Fix Http2SolrClient's exception message when serverBaseUrl is null (Alex Deparvu via Kevin Risden)
+* SOLR-16723: Http2SolrClient should not use Apache Http client classes (Kevin Risden)
+
Dependency Upgrades
---------------------
* PR#1494: Upgrade forbiddenapis to 3.5 (Uwe Schindler)
diff --git a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
index 1c2fe209ef0..c1ea7e2cf9b 100644
--- a/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
+++ b/solr/solrj/src/java/org/apache/solr/client/solrj/impl/Http2SolrClient.java
@@ -50,7 +50,6 @@ import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.stream.Collectors;
-import org.apache.http.entity.ContentType;
import org.apache.solr.client.solrj.ResponseParser;
import org.apache.solr.client.solrj.SolrClient;
import org.apache.solr.client.solrj.SolrRequest;
@@ -922,13 +921,15 @@ public class Http2SolrClient extends SolrClient {
if (processorSupportedContentTypes != null && !processorSupportedContentTypes.isEmpty()) {
boolean processorAcceptsMimeType =
processorSupportedContentTypes.stream()
- .map(ct -> ContentType.parse(ct).getMimeType().trim())
+ .map(ct -> MimeTypes.getContentTypeWithoutCharset(ct).trim())
.anyMatch(mimeType::equalsIgnoreCase);
if (!processorAcceptsMimeType) {
// unexpected mime type
final String allSupportedTypes =
processorSupportedContentTypes.stream()
- .map(ct -> ContentType.parse(ct).getMimeType().trim().toLowerCase(Locale.ROOT))
+ .map(
+ ct ->
+ MimeTypes.getContentTypeWithoutCharset(ct).trim().toLowerCase(Locale.ROOT))
.collect(Collectors.joining(", "));
String prefix =
"Expected mime type in [" + allSupportedTypes + "] but got " + mimeType + ". ";
@@ -1309,7 +1310,7 @@ public class Http2SolrClient extends SolrClient {
protected void updateDefaultMimeTypeForParser() {
defaultParserMimeTypes =
parser.getContentTypes().stream()
- .map(ct -> ContentType.parse(ct).getMimeType().trim().toLowerCase(Locale.ROOT))
+ .map(ct -> MimeTypes.getContentTypeWithoutCharset(ct).trim().toLowerCase(Locale.ROOT))
.collect(Collectors.toSet());
}