SOLR-839: in XmlQParserPlugin replace "UTF8" with StandardCharsets.UTF_8 as suggested by LUCENE-5560.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1724318 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Christine Poerschke 2016-01-12 20:44:52 +00:00
parent e0679e028c
commit 4ca99387a3
2 changed files with 3 additions and 7 deletions

View File

@ -305,7 +305,7 @@ New Features
</BooleanQuery>
</Clause>
</BooleanQuery>
(Erik Hatcher, Karl Wettin, Daniel Collins, Nathan Visagan, Christine Poerschke)
(Erik Hatcher, Karl Wettin, Daniel Collins, Nathan Visagan, Ahmet Arslan, Christine Poerschke)
Bug Fixes
----------------------

View File

@ -18,7 +18,7 @@ package org.apache.solr.search;
*/
import java.io.ByteArrayInputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.queryparser.xml.ParserException;
@ -35,8 +35,6 @@ public class XmlQParserPlugin extends QParserPlugin {
private class XmlQParser extends QParser {
private final String contentEncoding = "UTF8";
public XmlQParser(String qstr, SolrParams localParams,
SolrParams params, SolrQueryRequest req) {
super(qstr, localParams, params, req);
@ -52,9 +50,7 @@ public class XmlQParserPlugin extends QParserPlugin {
final Analyzer analyzer = schema.getQueryAnalyzer();
final SolrCoreParser solrParser = new SolrCoreParser(defaultField, analyzer, req);
try {
return solrParser.parse(new ByteArrayInputStream(qstr.getBytes(contentEncoding)));
} catch (UnsupportedEncodingException e) {
throw new SyntaxError(e.getMessage() + " in " + req.toString());
return solrParser.parse(new ByteArrayInputStream(qstr.getBytes(StandardCharsets.UTF_8)));
} catch (ParserException e) {
throw new SyntaxError(e.getMessage() + " in " + req.toString());
}