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

Varun Thacker commented on SOLR-8392:
-------------------------------------

Hi Mike,

Instead of this in your patch - 

{code}
-            Object updateTimeoutSecsParam = 
getSolrRequest().getParams().get(UPDATE_TIMEOUT_SECS);
+            String updateTimeoutSecsParam = 
getSolrRequest().getParams().get(UPDATE_TIMEOUT_SECS);
             if (updateTimeoutSecsParam != null)
-              updateTimeoutSecs = (updateTimeoutSecsParam instanceof Number)
-                  ? ((Number) updateTimeoutSecsParam).intValue()
-                  : Integer.parseInt(updateTimeoutSecsParam.toString());
+              updateTimeoutSecs = Integer.parseInt(updateTimeoutSecsParam);
{code}

It's okay if we just do {{updateTimeoutSecs = 
getSolrRequest().getParams().getInt(UPDATE_TIMEOUT_SECS);}} right? 
SchemaManager#doOperations deals with the case of updateTimeoutSecs being null .

On a side note, Why should MapSolrParams support the {{getParams}} method. We 
have {{MultiMapSolrParams}} if someone wants to have multiple values for a key. 
I tried playing around and have {{MapSolrParams#getParams}} throw a 
{{UnsupportedOperationException}} but looks like it will involve a fair amount 
of refactoring to get that working.

> SolrParam.get(String) returns String and shouldn't be used in other 
> instanceof checks
> -------------------------------------------------------------------------------------
>
>                 Key: SOLR-8392
>                 URL: https://issues.apache.org/jira/browse/SOLR-8392
>             Project: Solr
>          Issue Type: Bug
>            Reporter: Mike Drob
>             Fix For: Trunk
>
>         Attachments: SOLR-8392.patch
>
>
> There's a couple of places where we declare the return type of 
> solrParams.get() as an Object and then do instanceof checks for other types. 
> Since we know it will be a String, we can simplify this logic in several 
> places.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to