mirror of https://github.com/apache/lucene.git
throw IllegalArgumentException if both field name and value are empty (to avoid a confusing "term out of order" exception later)
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@406168 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2531a82606
commit
55237c881f
|
@ -13,6 +13,10 @@ API Changes
|
|||
|
||||
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
|
||||
|
||||
|
|
|
@ -238,6 +238,8 @@ public final class Field implements Serializable {
|
|||
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");
|
||||
|
|
Loading…
Reference in New Issue