mirror of https://github.com/apache/lucene.git
only throw ParseException from parse methods
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150128 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
812d3329d7
commit
1a39c55c4c
|
@ -83,13 +83,8 @@ public class QueryParser implements QueryParserConstants {
|
||||||
*/
|
*/
|
||||||
static public Query parse(String query, String field, Analyzer analyzer)
|
static public Query parse(String query, String field, Analyzer analyzer)
|
||||||
throws ParseException {
|
throws ParseException {
|
||||||
try {
|
QueryParser parser = new QueryParser(field, analyzer);
|
||||||
QueryParser parser = new QueryParser(field, analyzer);
|
return parser.parse(query);
|
||||||
return parser.parse(query);
|
|
||||||
}
|
|
||||||
catch (TokenMgrError tme) {
|
|
||||||
throw new ParseException(tme.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Constructs a query parser.
|
/** Constructs a query parser.
|
||||||
|
@ -106,11 +101,15 @@ public class QueryParser implements QueryParserConstants {
|
||||||
* <a href="lucene.search.Query.html">Query</a>.
|
* <a href="lucene.search.Query.html">Query</a>.
|
||||||
* @param query the query string to be parsed.
|
* @param query the query string to be parsed.
|
||||||
* @throws ParseException if the parsing fails
|
* @throws ParseException if the parsing fails
|
||||||
* @throws TokenMgrError if ther parsing fails
|
|
||||||
*/
|
*/
|
||||||
public Query parse(String query) throws ParseException, TokenMgrError {
|
public Query parse(String query) throws ParseException {
|
||||||
ReInit(new FastCharStream(new StringReader(query)));
|
ReInit(new FastCharStream(new StringReader(query)));
|
||||||
return Query(field);
|
try {
|
||||||
|
return Query(field);
|
||||||
|
}
|
||||||
|
catch (TokenMgrError tme) {
|
||||||
|
throw new ParseException(tme.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -145,13 +145,8 @@ public class QueryParser {
|
||||||
*/
|
*/
|
||||||
static public Query parse(String query, String field, Analyzer analyzer)
|
static public Query parse(String query, String field, Analyzer analyzer)
|
||||||
throws ParseException {
|
throws ParseException {
|
||||||
try {
|
QueryParser parser = new QueryParser(field, analyzer);
|
||||||
QueryParser parser = new QueryParser(field, analyzer);
|
return parser.parse(query);
|
||||||
return parser.parse(query);
|
|
||||||
}
|
|
||||||
catch (TokenMgrError tme) {
|
|
||||||
throw new ParseException(tme.getMessage());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Constructs a query parser.
|
/** Constructs a query parser.
|
||||||
|
@ -168,11 +163,15 @@ public class QueryParser {
|
||||||
* <a href="lucene.search.Query.html">Query</a>.
|
* <a href="lucene.search.Query.html">Query</a>.
|
||||||
* @param query the query string to be parsed.
|
* @param query the query string to be parsed.
|
||||||
* @throws ParseException if the parsing fails
|
* @throws ParseException if the parsing fails
|
||||||
* @throws TokenMgrError if ther parsing fails
|
|
||||||
*/
|
*/
|
||||||
public Query parse(String query) throws ParseException, TokenMgrError {
|
public Query parse(String query) throws ParseException {
|
||||||
ReInit(new FastCharStream(new StringReader(query)));
|
ReInit(new FastCharStream(new StringReader(query)));
|
||||||
return Query(field);
|
try {
|
||||||
|
return Query(field);
|
||||||
|
}
|
||||||
|
catch (TokenMgrError tme) {
|
||||||
|
throw new ParseException(tme.getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue