lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject svn commit: r332762 - in /lucene/java/trunk/src: java/org/apache/lucene/search/BooleanQuery.java test/org/apache/lucene/search/TestBooleanQuery.java
Date Sat, 12 Nov 2005 11:57:45 GMT
Author: dnaber
Date: Sat Nov 12 03:57:35 2005
New Revision: 332762

URL: http://svn.apache.org/viewcvs?rev=332762&view=rev
Log:
throw IllegalArgumentExeception if value doesn't make sense

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java
    lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanQuery.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java?rev=332762&r1=332761&r2=332762&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/search/BooleanQuery.java Sat Nov 12 03:57:35
2005
@@ -63,6 +63,8 @@
    * the operating system.
    */
   public static void setMaxClauseCount(int maxClauseCount) {
+    if (maxClauseCount < 1)
+      throw new IllegalArgumentException("maxClauseCount must be >= 1");
     BooleanQuery.maxClauseCount = maxClauseCount;
   }
 

Modified: lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanQuery.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanQuery.java?rev=332762&r1=332761&r2=332762&view=diff
==============================================================================
--- lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanQuery.java (original)
+++ lucene/java/trunk/src/test/org/apache/lucene/search/TestBooleanQuery.java Sat Nov 12 03:57:35
2005
@@ -20,6 +20,7 @@
 import org.apache.lucene.index.Term;
 
 public class TestBooleanQuery extends TestCase {
+  
   public void testEquality() throws Exception {
     BooleanQuery bq1 = new BooleanQuery();
     bq1.add(new TermQuery(new Term("field", "value1")), BooleanClause.Occur.SHOULD);
@@ -39,4 +40,14 @@
 
     assertEquals(bq1, bq2);
   }
+
+  public void testException() {
+    try {
+      BooleanQuery.setMaxClauseCount(0);
+      fail();
+    } catch (IllegalArgumentException e) {
+      // okay
+    }
+  }
+  
 }



Mime
View raw message