]
Emmanuel Bernard resolved HSEARCH-90.
-------------------------------------
Resolution: Fixed
Use of setFirstResult / setMaxResults can lead to a list with
negative capacity (John Griffin)
----------------------------------------------------------------------------------------------
Key: HSEARCH-90
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-90
Project: Hibernate Search
Issue Type: Bug
Components: query
Affects Versions: 3.0.0.beta3
Reporter: Sheldon Shi
Assignee: John Griffin
Priority: Minor
Fix For: 3.0.0.beta4
I did this query:
fullTextQuery.setFirstResult(sr.getOffset());
fullTextQuery.setMaxResults(sr.getLength());
List results = fullTextQuery.list();
sr.getOffset() and sr.getLength() are pagination parameters. They happened to be carried
from another query as a session properties (not the right thing to do here but it
happened). In my case offset was 10 and length was 10. The new search result is empty, so
these lines of code in FullTextQueryImpl gave a negative capacity for list exception:
int first = first();
int max = max( first, hits );
Session sess = (Session) this.session;
List<EntityInfo> infos = new ArrayList<EntityInfo>( max - first +
1);
because max=-1 and first=10. Would it be nice if a check is done before assign List
capacities?
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: