Return-Path: Delivered-To: apmail-jakarta-lucene-dev-archive@www.apache.org Received: (qmail 80804 invoked from network); 8 Sep 2004 13:33:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 8 Sep 2004 13:33:18 -0000 Received: (qmail 84534 invoked by uid 500); 8 Sep 2004 13:32:00 -0000 Delivered-To: apmail-jakarta-lucene-dev-archive@jakarta.apache.org Received: (qmail 84444 invoked by uid 500); 8 Sep 2004 13:31:59 -0000 Mailing-List: contact lucene-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Developers List" Reply-To: "Lucene Developers List" Delivered-To: mailing list lucene-dev@jakarta.apache.org Received: (qmail 84377 invoked by uid 500); 8 Sep 2004 13:31:58 -0000 Received: (qmail 84289 invoked by uid 99); 8 Sep 2004 13:31:57 -0000 X-ASF-Spam-Status: No, hits=-2.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Wed, 08 Sep 2004 06:31:57 -0700 Received: (qmail 80017 invoked by uid 1754); 8 Sep 2004 13:31:55 -0000 Date: 8 Sep 2004 13:31:55 -0000 Message-ID: <20040908133155.80016.qmail@minotaur.apache.org> From: goller@apache.org To: jakarta-lucene-cvs@apache.org Subject: cvs commit: jakarta-lucene/src/java/org/apache/lucene/queryParser QueryParser.jj QueryParser.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N goller 2004/09/08 06:31:55 Modified: src/java/org/apache/lucene/queryParser QueryParser.jj QueryParser.java Log: Fix ArrayIndexOutOfBoundsExceptions This patch is common to several patches for QueryParser see e.g. Bug 9110 and it cannot have any negative side effects. Revision Changes Path 1.47 +2 -2 jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.jj Index: QueryParser.jj =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.jj,v retrieving revision 1.46 retrieving revision 1.47 diff -u -r1.46 -r1.47 --- QueryParser.jj 7 Sep 2004 17:55:59 -0000 1.46 +++ QueryParser.jj 8 Sep 2004 13:31:55 -0000 1.47 @@ -200,13 +200,13 @@ // If this term is introduced by AND, make the preceding term required, // unless it's already prohibited - if (conj == CONJ_AND) { + if (clauses.size() > 0 && conj == CONJ_AND) { BooleanClause c = (BooleanClause) clauses.elementAt(clauses.size()-1); if (!c.isProhibited()) c.setOccur(BooleanClause.Occur.MUST); } - if (operator == DEFAULT_OPERATOR_AND && conj == CONJ_OR) { + if (clauses.size() > 0 && operator == DEFAULT_OPERATOR_AND && conj == CONJ_OR) { // If this term is introduced by OR, make the preceding term optional, // unless it's prohibited (that means we leave -a OR b but +a OR b-->a OR b) // notice if the input is a OR b, first term is parsed as required; without 1.14 +2 -2 jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.java Index: QueryParser.java =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/queryParser/QueryParser.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- QueryParser.java 3 Sep 2004 21:12:22 -0000 1.13 +++ QueryParser.java 8 Sep 2004 13:31:55 -0000 1.14 @@ -177,13 +177,13 @@ // If this term is introduced by AND, make the preceding term required, // unless it's already prohibited - if (conj == CONJ_AND) { + if (clauses.size() > 0 && conj == CONJ_AND) { BooleanClause c = (BooleanClause) clauses.elementAt(clauses.size()-1); if (!c.isProhibited()) c.setOccur(BooleanClause.Occur.MUST); } - if (operator == DEFAULT_OPERATOR_AND && conj == CONJ_OR) { + if (clauses.size() > 0 && operator == DEFAULT_OPERATOR_AND && conj == CONJ_OR) { // If this term is introduced by OR, make the preceding term optional, // unless it's prohibited (that means we leave -a OR b but +a OR b-->a OR b) // notice if the input is a OR b, first term is parsed as required; without --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-dev-help@jakarta.apache.org