Fix exception message typo and remove duplicate strings

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1189719 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2011-10-27 12:31:49 +00:00
parent bcd8fc6522
commit 2126cc24f3
1 changed files with 4 additions and 6 deletions

View File

@ -345,19 +345,17 @@ public class DocumentAnalysisRequestHandler extends AnalysisRequestHandlerBase {
*/
private ContentStream extractSingleContentStream(SolrQueryRequest req) {
Iterable<ContentStream> streams = req.getContentStreams();
String exceptionMsg = "DocumentAnalysisRequestHandler expects a single content stream with documents to analyze";
if (streams == null) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"DocumentAnlysisRequestHandler expects a single content stream with documents to analyze");
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, exceptionMsg);
}
Iterator<ContentStream> iter = streams.iterator();
if (!iter.hasNext()) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"DocumentAnlysisRequestHandler expects a single content stream with documents to analyze");
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, exceptionMsg);
}
ContentStream stream = iter.next();
if (iter.hasNext()) {
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST,
"DocumentAnlysisRequestHandler expects a single content stream with documents to analyze");
throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, exceptionMsg);
}
return stream;
}