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:
Erik Hatcher 2003-11-13 11:42:26 +00:00
parent 812d3329d7
commit 1a39c55c4c
2 changed files with 18 additions and 20 deletions

View File

@ -83,13 +83,8 @@ public class QueryParser implements QueryParserConstants {
*/
static public Query parse(String query, String field, Analyzer analyzer)
throws ParseException {
try {
QueryParser parser = new QueryParser(field, analyzer);
return parser.parse(query);
}
catch (TokenMgrError tme) {
throw new ParseException(tme.getMessage());
}
QueryParser parser = new QueryParser(field, analyzer);
return parser.parse(query);
}
/** Constructs a query parser.
@ -106,11 +101,15 @@ public class QueryParser implements QueryParserConstants {
* <a href="lucene.search.Query.html">Query</a>.
* @param query the query string to be parsed.
* @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)));
return Query(field);
try {
return Query(field);
}
catch (TokenMgrError tme) {
throw new ParseException(tme.getMessage());
}
}
/**

View File

@ -145,13 +145,8 @@ public class QueryParser {
*/
static public Query parse(String query, String field, Analyzer analyzer)
throws ParseException {
try {
QueryParser parser = new QueryParser(field, analyzer);
return parser.parse(query);
}
catch (TokenMgrError tme) {
throw new ParseException(tme.getMessage());
}
QueryParser parser = new QueryParser(field, analyzer);
return parser.parse(query);
}
/** Constructs a query parser.
@ -168,11 +163,15 @@ public class QueryParser {
* <a href="lucene.search.Query.html">Query</a>.
* @param query the query string to be parsed.
* @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)));
return Query(field);
try {
return Query(field);
}
catch (TokenMgrError tme) {
throw new ParseException(tme.getMessage());
}
}
/**