Return-Path: X-Original-To: apmail-lucene-commits-archive@www.apache.org Delivered-To: apmail-lucene-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B49F817B3C for ; Thu, 9 Apr 2015 08:46:38 +0000 (UTC) Received: (qmail 44795 invoked by uid 500); 9 Apr 2015 08:46:04 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 44786 invoked by uid 99); 9 Apr 2015 08:46:04 -0000 Received: from eris.apache.org (HELO hades.apache.org) (140.211.11.105) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 09 Apr 2015 08:46:04 +0000 Received: from hades.apache.org (localhost [127.0.0.1]) by hades.apache.org (ASF Mail Server at hades.apache.org) with ESMTP id 3026EAC00B4 for ; Thu, 9 Apr 2015 08:46:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@lucene.apache.org From: mikemccand@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20150409084604.3026EAC00B4@hades.apache.org> 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) {