[ 
https://issues.apache.org/jira/browse/SOLR-17316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17850726#comment-17850726
 ] 

Eric Pugh commented on SOLR-17316:
----------------------------------

I wonder if we would do better to either fix the issues (and introduce the 
testing to verify it across all the wt's)  or remove the methods from the base? 
 As a user, I would assume that I could swap from binary to json and my Java 
code would continue to work!   It would be quite a surprise to get a 
ClassCastExeception.

Thinking aloud, but what if we throw a Exception that signals more clearly the 
issue?  "ResponseFormatDoesntSupportThisMethod" ?  

> SolrResponseBase getters should work with all ResponseParsers 
> --------------------------------------------------------------
>
>                 Key: SOLR-17316
>                 URL: https://issues.apache.org/jira/browse/SOLR-17316
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: SolrJ
>    Affects Versions: main (10.0), 9.6.1
>            Reporter: Jason Gerlowski
>            Priority: Minor
>
> SolrJ's SolrResponseBase has several "getter" methods that give users a 
> syntactic sugar for accessing common response properties (such as the 
> response header's "status" field).  These methods are useful, but make 
> certain Java class/type assumptions that only hold for some of Solr's 
> ResponseParsers.
> For example, "SolrResponseBase.getResponseHeader" returns a NamedList - which 
> is correct when the default "BinaryResponseParser" is used, but will cause a 
> ClassCastException when used with other parsers (e.g. JsonMapResponseParser)
> We have a few options for how to remedy this:
> 1. Make these SolrResponseBase methods a little more flexible in the types 
> they return and the variety of types they can handle as they walk the 
> response NamedList
> 2. Try to align all ResponseParser implementations around using types 
> similarly.
> 3. If (1) and (2) are infeasible, we could at least add Javadocs to these 
> SolrResponseBase methods to indicate that they may throw CCE, and that 
> they're only guaranteed to work with the BinaryResponseParser.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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

Reply via email to