[hibernate-issues] [Hibernate-JIRA] Created: (HSEARCH-90) negative List capacity in FullTextQueryImpl.list()

Sheldon Shi (JIRA) noreply at atlassian.com
Tue Jun 26 10:20:52 EDT 2007


negative List capacity in FullTextQueryImpl.list()
--------------------------------------------------

                 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
            Priority: Minor


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: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list