You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by tf...@apache.org on 2023/12/07 22:50:25 UTC
(solr) branch main updated: SOLR-17053: Address ClassCastException issue (#2123)
This is an automated email from the ASF dual-hosted git repository.
tflobbe 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 5f67d4aed35 SOLR-17053: Address ClassCastException issue (#2123)
5f67d4aed35 is described below
commit 5f67d4aed35b18e48bb43b5e1b583529b96211f8
Author: aparnasuresh85 <ap...@salesforce.com>
AuthorDate: Thu Dec 7 17:50:19 2023 -0500
SOLR-17053: Address ClassCastException issue (#2123)
---
.../apache/solr/handler/component/SearchHandler.java | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
index 2c7f9924436..5e64e5fbfea 100644
--- a/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
+++ b/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
@@ -580,12 +580,7 @@ public class SearchHandler extends RequestHandlerBase
// If things are not tolerant, abort everything and rethrow
if (!tolerant) {
shardHandler1.cancelAll();
- if (srsp.getException() instanceof SolrException) {
- throw (SolrException) srsp.getException();
- } else {
- throw new SolrException(
- SolrException.ErrorCode.SERVER_ERROR, srsp.getException());
- }
+ throwSolrException(srsp.getException());
} else {
// Check if the purpose includes 'PURPOSE_GET_TOP_IDS'
boolean includesTopIdsPurpose =
@@ -598,7 +593,7 @@ public class SearchHandler extends RequestHandlerBase
boolean allShardsFailed = includesTopIdsPurpose && allResponsesHaveExceptions;
// if all shards fail, fail the request despite shards.tolerant
if (allShardsFailed) {
- throw (SolrException) srsp.getException();
+ throwSolrException(srsp.getException());
} else {
rsp.getResponseHeader()
.asShallowMap()
@@ -663,6 +658,14 @@ public class SearchHandler extends RequestHandlerBase
}
}
+ private static void throwSolrException(Throwable shardResponseException) throws SolrException {
+ if (shardResponseException instanceof SolrException) {
+ throw (SolrException) shardResponseException;
+ } else {
+ throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, shardResponseException);
+ }
+ }
+
private void tagRequestWithRequestId(ResponseBuilder rb) {
final boolean ridTaggingDisabled =
rb.req.getParams().getBool(CommonParams.DISABLE_REQUEST_ID, DISABLE_REQUEST_ID_DEFAULT);