From b6b6d246aea9fff5208d035be8afc01b6d686608 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20H=C3=B8ydahl?= Date: Wed, 4 May 2016 23:19:55 +0200 Subject: [PATCH] SOLR-9053: Fix attribution, apply the code refactor part from mdrob's patch (cherry picked from commit b6f8c65) --- solr/CHANGES.txt | 2 +- .../solr/servlet/SolrRequestParsers.java | 28 ++++++++----------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index 7fabc61880d..039bf3d85e3 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -207,7 +207,7 @@ Other Changes * SOLR-9047: zkcli should allow alternative locations for log4j configuration (Gregory Chanan) -* SOLR-9053: Upgrade commons-fileupload to 1.3.1, fixing a potential vulnerability (Jeff Field, janhoy) +* SOLR-9053: Upgrade commons-fileupload to 1.3.1, fixing a potential vulnerability (Jeff Field, Mike Drob via janhoy) * SOLR-9066 Make CountMetric return long instead of double (Kevin Risden) diff --git a/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java b/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java index a91f6a26394..9d7e7d9aced 100644 --- a/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java +++ b/solr/core/src/java/org/apache/solr/servlet/SolrRequestParsers.java @@ -57,7 +57,6 @@ import org.apache.solr.core.SolrConfig; import org.apache.solr.core.SolrCore; import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.request.SolrQueryRequestBase; -import org.apache.solr.util.RTimer; import org.apache.solr.util.RTimerTree; import static org.apache.solr.common.params.CommonParams.PATH; @@ -564,21 +563,18 @@ public class SolrRequestParsers upload.setSizeMax( ((long) uploadLimitKB) * 1024L ); // Parse the request - List items = upload.parseRequest(req); - Iterator iter = items.iterator(); - while (iter.hasNext()) { - FileItem item = (FileItem) iter.next(); - - // If it's a form field, put it in our parameter map - if (item.isFormField()) { - MultiMapSolrParams.addParam( - item.getFieldName().trim(), - item.getString(), params.getMap() ); - } - // Add the stream - else { - streams.add( new FileItemContentStream( item ) ); - } + List items = upload.parseRequest(req); + for (FileItem item : items) { + // If it's a form field, put it in our parameter map + if (item.isFormField()) { + MultiMapSolrParams.addParam( + item.getFieldName().trim(), + item.getString(), params.getMap() ); + } + // Add the stream + else { + streams.add( new FileItemContentStream( item ) ); + } } return params; }