Skip to content

Apache Lucene open-source search software

- Added exceptions to the Javadoc for parse methods. - Added TokenMgrError to parse methods' throws clauses, since that is thrown when the input is bad. PR: Obtained from: Submitted by: Daniel Calvo Reviewed by:

Otis Gospodnetic84bd5a15657e
diff --git a/src/java/org/apache/lucene/queryParser/QueryParser.jj b/src/java/org/apache/lucene/queryParser/QueryParser.jj
index f8973153311..491879cf2fe 100644
--- a/src/java/org/apache/lucene/queryParser/QueryParser.jj
+++ b/src/java/org/apache/lucene/queryParser/QueryParser.jj
@@ -110,9 +110,11 @@ public class QueryParser {
* @param query the query string to be parsed.
* @param field the default field for query terms.
* @param analyzer used to find terms in the query text.
+ * @throws ParseException if the parsing fails
+ * @throws TokenMgrError if the parsing fails
*/
static public Query parse(String query, String field, Analyzer analyzer)
- throws ParseException {
+ throws ParseException, TokenMgrError {
QueryParser parser = new QueryParser(field, analyzer);
return parser.parse(query);
}
@@ -134,8 +136,10 @@ public class QueryParser {
/** Parses a query string, returning a
* <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 {
+ public Query parse(String query) throws ParseException, TokenMgrError {
ReInit(new FastCharStream(new StringReader(query)));
return Query(field);
}