SOLR-9195: remove unnecessary allocation and null check in UpdateRequestProcessorChain.getReqProcessors

This commit is contained in:
Christine Poerschke 2016-06-15 12:11:02 +01:00
parent 87016b5f0c
commit 651499c82d
2 changed files with 14 additions and 11 deletions

View File

@ -76,6 +76,12 @@ Bug Fixes
* SOLR-9161: Change SolrPluginUtils.invokeSetters implementation to accommodate setter variants. * SOLR-9161: Change SolrPluginUtils.invokeSetters implementation to accommodate setter variants.
(Christine Poerschke, Steve Rowe, Uwe Schindler) (Christine Poerschke, Steve Rowe, Uwe Schindler)
Other Changes
----------------------
* SOLR-9195: Remove unnecessary allocation and null check in UpdateRequestProcessorChain's
getReqProcessors method. (Christine Poerschke)
================== 6.1.0 ================== ================== 6.1.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -265,17 +265,14 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitialized
static List<UpdateRequestProcessorFactory> getReqProcessors(String processor, SolrCore core) { static List<UpdateRequestProcessorFactory> getReqProcessors(String processor, SolrCore core) {
if (processor == null) return Collections.EMPTY_LIST; if (processor == null) return Collections.EMPTY_LIST;
List<UpdateRequestProcessorFactory> result = new ArrayList<>(); List<UpdateRequestProcessorFactory> result = new ArrayList<>();
if (processor != null) { List<String> names = StrUtils.splitSmart(processor, ',');
List<String> names = StrUtils.splitSmart(processor, ','); for (String s : names) {
List<UpdateRequestProcessorFactory> l = new ArrayList<>(names.size()); s = s.trim();
for (String s : names) { if (s.isEmpty()) continue;
s = s.trim(); UpdateRequestProcessorFactory p = core.getUpdateProcessors().get(s);
if (s.isEmpty()) continue; if (p == null)
UpdateRequestProcessorFactory p = core.getUpdateProcessors().get(s); throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No such processor " + s);
if (p == null) result.add(p);
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No such processor " + s);
result.add(p);
}
} }
return result; return result;
} }