-
Notifications
You must be signed in to change notification settings - Fork 688
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SOLR-17053: Address ClassCastException issue #2123
Conversation
@@ -598,7 +598,7 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw | |||
boolean allShardsFailed = includesTopIdsPurpose && allResponsesHaveExceptions; | |||
// if all shards fail, fail the request despite shards.tolerant | |||
if (allShardsFailed) { | |||
throw (SolrException) srsp.getException(); | |||
throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, srsp.getException()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the exception be anything other than a server error? Should we do something like here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree completely @tflobbe ; this is what I mentioned internally :-). Perhaps create a little utility method here for this pattern used twice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have addressed this in my recent commit
5a85f7a
to
8ebc739
Compare
@@ -663,6 +659,15 @@ public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throw | |||
} | |||
} | |||
|
|||
public static void throwSolrException(Throwable shardResponseException) throws SolrException { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to make this public
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missed on reviewing the change myself. Updated to private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. I guess we don't need a CHANGES entry since this is a fix to an unreleased feature
https://issues.apache.org/jira/browse/SOLR-17053
Description
Please provide a short description of the changes you're making with this pull request.
Address a ClassCastException issue in the event exception in shard response is not of type org.apache.solr.common.SolrException
Solution
Please provide a short description of the approach taken to implement your solution.
Wrap the exception in shard response into org.apache.solr.common.SolrException and throw the same
Tests
Please describe the tests you've developed or run to confirm this patch implements the feature or solves the problem.
Tests checked in as part of previous PR here: #2102. Did not introduce additional testing with this PR as it is a minor change
Checklist
Please review the following and check all that apply:
main
branch../gradlew check
.