You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/04/09 10:46:32 UTC
svn commit: r1672263 - in /lucene/dev/branches/branch_5x: ./ lucene/
lucene/core/
lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java
lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java
Author: mikemccand
Date: Thu Apr 9 08:46:32 2015
New Revision: 1672263
URL: http://svn.apache.org/r1672263
Log:
LUCENE-5879: fix empty string corner case
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/lucene/ (props changed)
lucene/dev/branches/branch_5x/lucene/core/ (props changed)
lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java
lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java
Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java?rev=1672263&r1=1672262&r2=1672263&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/util/automaton/Automata.java Thu Apr 9 08:46:32 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/branches/branch_5x/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java?rev=1672263&r1=1672262&r2=1672263&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/util/automaton/TestAutomaton.java Thu Apr 9 08:46:32 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) {