This is an automated email from the ASF dual-hosted git repository.
krisden pushed a commit to branch branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 603d86c788c SOLR-16723: Http2SolrClient should not use Apache Http
client classes (#1503)
603d86c788c is described below
commit 603d86c788c93be96bc2e3e60f7d9c273c918c57
Author: Kevin Risden <[email protected]>
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 b48911f83af..ffaa6efc2cb 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -50,6 +50,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());
}