lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1672262 - in /lucene/dev/trunk/lucene/core/src: java/org/apache/lucene/util/automaton/Automata.java test/org/apache/lucene/util/automaton/TestAutomaton.java
Date Thu, 09 Apr 2015 08:46:04 GMT
Author: mikemccand
Date: Thu Apr  9 08:46:03 2015
New Revision: 1672262

URL: http://svn.apache.org/r1672262
Log:
LUCENE-5879: fix empty string corner case

Modified:
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java?rev=1672262&r1=1672261&r2=1672262&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java Thu
Apr  9 08:46:03 2015
@@ -238,12 +238,17 @@ final public class Automata {
       minInclusive = true;
     }
 
-    // Empty string corner case:
+    // Empty string corner cases:
     if (max != null && maxInclusive == false && max.length == 1 &&
max.bytes[max.offset] == 0) {
       max = new BytesRef();
       maxInclusive = true;
     }
 
+    if (min != null && minInclusive == false && min.length == 0) {
+      min = new BytesRef(new byte[1]);
+      minInclusive = true;
+    }
+
     int cmp;
     if (max != null) {
       cmp = min.compareTo(max);

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java?rev=1672262&r1=1672261&r2=1672262&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java
(original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java
Thu Apr  9 08:46:03 2015
@@ -1127,7 +1127,7 @@ public class TestAutomaton extends Lucen
         System.out.println("Minimized:\n" + minA.toDot());
         System.out.println("minTerm=" + minTerm + " minInclusive=" + minInclusive);
         System.out.println("maxTerm=" + maxTerm + " maxInclusive=" + maxInclusive);
-        fail("auotmaton was not minimal");
+        fail("automaton was not minimal");
       }
 
       if (VERBOSE) {



Mime
View raw message