lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Pipitone <jpipit...@mshri.on.ca>
Subject Why does BooleanQuery$TooManyClauses extend RuntimeException?
Date Tue, 25 Nov 2003 23:50:23 GMT
Hey all,

When I switched over to Lucene 1.3 RC2 I found that a user of my 
application could create an unhandled exception, just by entering in a 
wild card query.  (There was a post today about this [1]).

The exception being thrown when a wildcard query causes a BooleanQuery 
to grow too large, BooleanQuery$TooManyClauses, extends 
RuntimeException.  As such, the method throwing it -- BooleanQuery.add() 
-- doesn't need to declare that it throws it, nor if it did would there 
be any compilation errors if the caller does not catch it.

My application was using QueryParser as before, and there were no 
compile time errors to indicate that I would need to catch this sort of 
exception.  Of course, it is in the javadoc (but of BooleanQuery not 
QueryParser).

My question is, if throwing BooleanQuery$TooManyClauses is part of the 
API (which it seems like it is implicitly) then shouldn't it be enforced 
at compile time? What about wrapping this sort of exception in a 
ParseException so that it can be handled like all other parse exceptions?

Thanks,
jp

[1] 
http://nagoya.apache.org/eyebrowse/ReadMsg?listName=lucene-user@jakarta.apache.org&msgId=1158980


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org


Mime
View raw message