Apache Lucene open-source search software
SOLR-9195: remove unnecessary allocation and null check in UpdateRequestProcessorChain.getReqProcessors
Christine Poerschke651499c82df4
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 56017912010..5286ab659d6 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -76,6 +76,12 @@ Bug Fixes* SOLR-9161: Change SolrPluginUtils.invokeSetters implementation to accommodate setter variants.(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 ==================Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.diff --git a/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.java b/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.javaindex 5efcb95e8ef..bd23b4bb5d7 100644--- a/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.java+++ b/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.java@@ -265,17 +265,14 @@ public final class UpdateRequestProcessorChain implements PluginInfoInitializedstatic List<UpdateRequestProcessorFactory> getReqProcessors(String processor, SolrCore core) {if (processor == null) return Collections.EMPTY_LIST;List<UpdateRequestProcessorFactory> result = new ArrayList<>();- if (processor != null) {- List<String> names = StrUtils.splitSmart(processor, ',');- List<UpdateRequestProcessorFactory> l = new ArrayList<>(names.size());- for (String s : names) {- s = s.trim();- if (s.isEmpty()) continue;- UpdateRequestProcessorFactory p = core.getUpdateProcessors().get(s);- if (p == null)- throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No such processor " + s);- result.add(p);- }+ List<String> names = StrUtils.splitSmart(processor, ',');+ for (String s : names) {+ s = s.trim();+ if (s.isEmpty()) continue;+ UpdateRequestProcessorFactory p = core.getUpdateProcessors().get(s);+ if (p == null)+ throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "No such processor " + s);+ result.add(p);}return result;}