SOLR-8871 - removed suppress for forbidden API, added locale to toUpperCase

This commit is contained in:
Tommaso Teofili 2016-11-28 09:22:36 +01:00
parent 641294a967
commit c36ec0b75e
1 changed files with 4 additions and 4 deletions

View File

@ -17,12 +17,13 @@
package org.apache.solr.update.processor; package org.apache.solr.update.processor;
import java.util.Locale;
import org.apache.lucene.index.IndexReader; import org.apache.lucene.index.IndexReader;
import org.apache.lucene.search.Query; import org.apache.lucene.search.Query;
import org.apache.solr.common.SolrException; import org.apache.solr.common.SolrException;
import org.apache.solr.common.params.SolrParams; import org.apache.solr.common.params.SolrParams;
import org.apache.solr.common.util.NamedList; import org.apache.solr.common.util.NamedList;
import org.apache.solr.common.util.SuppressForbidden;
import org.apache.solr.request.SolrQueryRequest; import org.apache.solr.request.SolrQueryRequest;
import org.apache.solr.response.SolrQueryResponse; import org.apache.solr.response.SolrQueryResponse;
import org.apache.solr.schema.IndexSchema; import org.apache.solr.schema.IndexSchema;
@ -60,7 +61,6 @@ public class ClassificationUpdateProcessorFactory extends UpdateRequestProcessor
private SolrParams params; private SolrParams params;
private ClassificationUpdateProcessorParams classificationParams; private ClassificationUpdateProcessorParams classificationParams;
@SuppressForbidden(reason = "Need toUpperCase to match algorithm enum value")
@Override @Override
public void init(final NamedList args) { public void init(final NamedList args) {
if (args != null) { if (args != null) {
@ -86,10 +86,10 @@ public class ClassificationUpdateProcessorFactory extends UpdateRequestProcessor
String algorithmString = params.get(ALGORITHM_PARAM); String algorithmString = params.get(ALGORITHM_PARAM);
Algorithm classificationAlgorithm; Algorithm classificationAlgorithm;
try { try {
if (algorithmString == null || Algorithm.valueOf(algorithmString.toUpperCase()) == null) { if (algorithmString == null || Algorithm.valueOf(algorithmString.toUpperCase(Locale.ROOT)) == null) {
classificationAlgorithm = DEFAULT_ALGORITHM; classificationAlgorithm = DEFAULT_ALGORITHM;
} else { } else {
classificationAlgorithm = Algorithm.valueOf(algorithmString.toUpperCase()); classificationAlgorithm = Algorithm.valueOf(algorithmString.toUpperCase(Locale.ROOT));
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {
throw new SolrException throw new SolrException