lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dna...@apache.org
Subject svn commit: r406168 - in /lucene/java/trunk: CHANGES.txt src/java/org/apache/lucene/document/Field.java
Date Sat, 13 May 2006 23:50:35 GMT
Author: dnaber
Date: Sat May 13 16:50:35 2006
New Revision: 406168

URL: http://svn.apache.org/viewcvs?rev=406168&view=rev
Log:
throw IllegalArgumentException if both field name and value are empty (to avoid a confusing
"term out of order" exception later)

Modified:
    lucene/java/trunk/CHANGES.txt
    lucene/java/trunk/src/java/org/apache/lucene/document/Field.java

Modified: lucene/java/trunk/CHANGES.txt
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/CHANGES.txt?rev=406168&r1=406167&r2=406168&view=diff
==============================================================================
--- lucene/java/trunk/CHANGES.txt (original)
+++ lucene/java/trunk/CHANGES.txt Sat May 13 16:50:35 2006
@@ -13,6 +13,10 @@
 
  2. DisjunctionSumScorer is no longer public.
     (Paul Elschot via Otis Gospodnetic)
+    
+ 3. Creating a Field with both an empty name and an empty value 
+    now throws an IllegalArgumentException
+    (Daniel Naber)
 
 Bug fixes
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/document/Field.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/document/Field.java?rev=406168&r1=406167&r2=406168&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/document/Field.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/document/Field.java Sat May 13 16:50:35 2006
@@ -238,6 +238,8 @@
       throw new NullPointerException("name cannot be null");
     if (value == null)
       throw new NullPointerException("value cannot be null");
+    if (name.length() == 0 && value.length() == 0)
+      throw new IllegalArgumentException("name and value cannot both be empty");
     if (index == Index.NO && store == Store.NO)
       throw new IllegalArgumentException("it doesn't make sense to have a field that "
          + "is neither indexed nor stored");



Mime
View raw message