mirror of https://github.com/apache/lucene.git
SOLR-8392: Remove instanceof checks on return value of SolrParam::get
This commit is contained in:
parent
c51f6fae75
commit
94220a01e1
|
@ -256,6 +256,8 @@ Other Changes
|
|||
* SOLR-10800: Factor out HttpShardHandler.transformReplicasToShardUrls from HttpShardHandler.prepDistributed.
|
||||
(Domenico Fabio Marino, Christine Poerschke)
|
||||
|
||||
* SOLR-8392: Remove instanceof checks on return value of SolrParam::get (Mike Drob, Varun Thacker)
|
||||
|
||||
================== 6.7.0 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
|
|
@ -138,11 +138,7 @@ public class SchemaHandler extends RequestHandlerBase implements SolrCoreAware,
|
|||
break;
|
||||
}
|
||||
case "/schema/zkversion": {
|
||||
int refreshIfBelowVersion = -1;
|
||||
Object refreshParam = req.getParams().get("refreshIfBelowVersion");
|
||||
if (refreshParam != null)
|
||||
refreshIfBelowVersion = (refreshParam instanceof Number) ? ((Number) refreshParam).intValue()
|
||||
: Integer.parseInt(refreshParam.toString());
|
||||
int refreshIfBelowVersion = req.getParams().getInt("refreshIfBelowVersion", -1);
|
||||
int zkVersion = -1;
|
||||
IndexSchema schema = req.getSchema();
|
||||
if (schema instanceof ManagedIndexSchema) {
|
||||
|
|
|
@ -125,11 +125,9 @@ public abstract class BaseSolrResource extends ServerResource {
|
|||
SolrCore.preDecorateResponse(solrRequest, solrResponse);
|
||||
|
||||
// client application can set a timeout for update requests
|
||||
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);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* {@link SolrParams} implementation that can be built from and is backed by a {@link Map}.
|
||||
*/
|
||||
public class MapSolrParams extends SolrParams {
|
||||
protected final Map<String,String> map;
|
||||
|
@ -31,22 +31,13 @@ public class MapSolrParams extends SolrParams {
|
|||
|
||||
@Override
|
||||
public String get(String name) {
|
||||
Object o = map.get(name);
|
||||
if(o == null) return null;
|
||||
if (o instanceof String) return (String) o;
|
||||
if (o instanceof String[]) {
|
||||
String[] strings = (String[]) o;
|
||||
if(strings.length == 0) return null;
|
||||
return strings[0];
|
||||
}
|
||||
return String.valueOf(o);
|
||||
return map.get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getParams(String name) {
|
||||
Object val = map.get(name);
|
||||
if (val instanceof String[]) return (String[]) val;
|
||||
return val==null ? null : new String[]{String.valueOf(val)};
|
||||
String val = map.get(name);
|
||||
return val==null ? null : new String[]{val};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue