You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Stefan Bergstrand <st...@polopoly.com> on 2002/05/30 11:20:26 UTC

ArrayIndexOutOfBoundsException in QueryParser

I don't know if this has occurred on this mailing list before; but to
be sure, here it is.


I dont know what the query was, but someone managed to trick the
parser into the following exeception :


java.lang.ArrayIndexOutOfBoundsException: -1 < 0
        at java.util.Vector.elementAt(Vector.java:427)
        at org.apache.lucene.queryParser.QueryParser.addClause(Unknown Source)
        at org.apache.lucene.queryParser.QueryParser.Query(Unknown Source)
        at org.apache.lucene.queryParser.QueryParser.parse(Unknown Source)
        at org.apache.lucene.queryParser.QueryParser.parse(Unknown Source)
        at
com.polopoly.search.lucene.LuceneIndexSearcher.search(LuceneIndexSearcher.java:294)


As far as I can see, it has to be here:

 if (conj == CONJ_AND) {
      BooleanClause c = (BooleanClause) clauses.elementAt(clauses.size()-1);
      if (!c.prohibited)
        c.required = true;
 }


So, obviously, addClause() is called with an empty "clauses" Vector
and "conj" set to CONJ_AND.


Should not be possible, should it?

/Stefan B


-- 
---------------------------
Stefan Bergstrand
Polopoly - Cultivating the information garden
Ph:   +46 8 506 782 67
Cell: +46 704 47 82 67
Fax:  +46 8 506 782 51
stefan.bergstrand@polopoly.com, http://www.polopoly.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: ArrayIndexOutOfBoundsException in QueryParser

Posted by Otis Gospodnetic <ot...@yahoo.com>.
I think this is already listed as a bug.  It occurs when one of the
terms is a stop word or some such, I think.

Otis

--- Stefan Bergstrand <st...@polopoly.com> wrote:
> 
> I don't know if this has occurred on this mailing list before; but to
> be sure, here it is.
> 
> 
> I dont know what the query was, but someone managed to trick the
> parser into the following exeception :
> 
> 
> java.lang.ArrayIndexOutOfBoundsException: -1 < 0
>         at java.util.Vector.elementAt(Vector.java:427)
>         at
> org.apache.lucene.queryParser.QueryParser.addClause(Unknown Source)
>         at org.apache.lucene.queryParser.QueryParser.Query(Unknown
> Source)
>         at org.apache.lucene.queryParser.QueryParser.parse(Unknown
> Source)
>         at org.apache.lucene.queryParser.QueryParser.parse(Unknown
> Source)
>         at
>
com.polopoly.search.lucene.LuceneIndexSearcher.search(LuceneIndexSearcher.java:294)
> 
> 
> As far as I can see, it has to be here:
> 
>  if (conj == CONJ_AND) {
>       BooleanClause c = (BooleanClause)
> clauses.elementAt(clauses.size()-1);
>       if (!c.prohibited)
>         c.required = true;
>  }
> 
> 
> So, obviously, addClause() is called with an empty "clauses" Vector
> and "conj" set to CONJ_AND.
> 
> 
> Should not be possible, should it?
> 
> /Stefan B
> 
> 
> -- 
> ---------------------------
> Stefan Bergstrand
> Polopoly - Cultivating the information garden
> Ph:   +46 8 506 782 67
> Cell: +46 704 47 82 67
> Fax:  +46 8 506 782 51
> stefan.bergstrand@polopoly.com, http://www.polopoly.com
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>