You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Florian Waltersdorfer (JIRA)" <ji...@apache.org> on 2009/07/16 01:39:14 UTC

[jira] Commented: (LUCENE-504) FuzzyQuery produces a "java.lang.NegativeArraySizeException" in PriorityQueue.initialize if I use Integer.MAX_VALUE as BooleanQuery.MaxClauseCount

    [ https://issues.apache.org/jira/browse/LUCENE-504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12731744#action_12731744 ] 

Florian Waltersdorfer commented on LUCENE-504:
----------------------------------------------

Hi,

something along the line of 
ScoreDoc[] results = searcher.search(query, MAX_NUMBER_OF_HITS).scoreDocs;
causes a viable crash. I would consider this a "natural" start when trying to write an own searcher (MAX_NUMBER_OF_HITS beeing Integer.MAX_VALUE) and without the sources attached & the (eclipse) debugger I would have never found the problem I'd guess.
So please do something about this pitfall, if only adding a warning in the javadoc of i.e. Searcher.search(..., int n, ...)

Thanks 
Florian

> FuzzyQuery produces a "java.lang.NegativeArraySizeException" in PriorityQueue.initialize if I use Integer.MAX_VALUE as BooleanQuery.MaxClauseCount
> --------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-504
>                 URL: https://issues.apache.org/jira/browse/LUCENE-504
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>    Affects Versions: 1.9
>            Reporter: Joerg Henss
>            Priority: Minor
>         Attachments: BooleanQuery.java.diff, fuzzyquery.patch, PriorityQueue.java.diff, TestFuzzyQueryError.java
>
>
> PriorityQueue creates an "java.lang.NegativeArraySizeException" when initialized with Integer.MAX_VALUE, because Integer overflows. I think this could be a general problem with PriorityQueue. The Error occured when I set BooleanQuery.MaxClauseCount to Integer.MAX_VALUE and user a FuzzyQuery for searching.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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