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/08/05 16:03:08 UTC
svn commit: r1694219 - in /lucene/dev/branches/branch_5x: ./ lucene/
lucene/core/ lucene/core/src/java/org/apache/lucene/util/automaton/
lucene/core/src/test/org/apache/lucene/util/automaton/
Author: mikemccand
Date: Wed Aug 5 14:03:07 2015
New Revision: 1694219
URL: http://svn.apache.org/r1694219
Log:
LUCENE-6713: TooComplexToDeterminizeException claims to be serializable but wasn't
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/lucene/ (props changed)
lucene/dev/branches/branch_5x/lucene/CHANGES.txt (contents, 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/TooComplexToDeterminizeException.java
lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/util/automaton/TestRegExp.java
Modified: lucene/dev/branches/branch_5x/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/CHANGES.txt?rev=1694219&r1=1694218&r2=1694219&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/lucene/CHANGES.txt Wed Aug 5 14:03:07 2015
@@ -287,6 +287,9 @@ Bug fixes
* LUCENE-6718: JoinUtil.createJoinQuery failed to rewrite queries before
creating a Weight. (Adrien Grand)
+* LUCENE-6713: TooComplexToDeterminizeException claims to be serializable
+ but wasn't (Simon Willnauer, Mike McCandless)
+
Changes in Runtime Behavior
* LUCENE-6501: The subreader structure in ParallelCompositeReader
Modified: lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/util/automaton/TooComplexToDeterminizeException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/util/automaton/TooComplexToDeterminizeException.java?rev=1694219&r1=1694218&r2=1694219&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/util/automaton/TooComplexToDeterminizeException.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/java/org/apache/lucene/util/automaton/TooComplexToDeterminizeException.java Wed Aug 5 14:03:07 2015
@@ -22,9 +22,9 @@ package org.apache.lucene.util.automaton
* has too many states.
*/
public class TooComplexToDeterminizeException extends RuntimeException {
- private final Automaton automaton;
- private final RegExp regExp;
- private final int maxDeterminizedStates;
+ private transient final Automaton automaton;
+ private transient final RegExp regExp;
+ private transient final int maxDeterminizedStates;
/** Use this constructor when the RegExp failed to convert to an automaton. */
public TooComplexToDeterminizeException(RegExp regExp, TooComplexToDeterminizeException cause) {
@@ -37,7 +37,7 @@ public class TooComplexToDeterminizeExce
/** Use this constructor when the automaton failed to determinize. */
public TooComplexToDeterminizeException(Automaton automaton, int maxDeterminizedStates) {
- super("Determinizing automaton would result in more than " + maxDeterminizedStates + " states.");
+ super("Determinizing automaton with " + automaton.getNumStates() + " states and " + automaton.getNumTransitions() + " transitions would result in more than " + maxDeterminizedStates + " states.");
this.automaton = automaton;
this.regExp = null;
this.maxDeterminizedStates = maxDeterminizedStates;
Modified: lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/util/automaton/TestRegExp.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/util/automaton/TestRegExp.java?rev=1694219&r1=1694218&r2=1694219&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/util/automaton/TestRegExp.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/util/automaton/TestRegExp.java Wed Aug 5 14:03:07 2015
@@ -19,6 +19,13 @@ package org.apache.lucene.util.automaton
import org.apache.lucene.util.LuceneTestCase;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInput;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutput;
+import java.io.ObjectOutputStream;
+
public class TestRegExp extends LuceneTestCase {
/**
@@ -49,6 +56,28 @@ public class TestRegExp extends LuceneTe
}
}
+ // LUCENE-6713
+ public void testSerializeTooManyStatesToDeterminizeExc() throws Exception {
+ // LUCENE-6046
+ String source = "[ac]*a[ac]{50,200}";
+ try {
+ new RegExp(source).toAutomaton();
+ fail();
+ } catch (TooComplexToDeterminizeException e) {
+ assert(e.getMessage().contains(source));
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream();
+ ObjectOutput out = new ObjectOutputStream(bos);
+ out.writeObject(e);
+ byte[] bytes = bos.toByteArray();
+
+ ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
+ ObjectInput in = new ObjectInputStream(bis);
+ TooComplexToDeterminizeException e2 = (TooComplexToDeterminizeException) in.readObject();
+ assertNotNull(e2.getMessage());
+ }
+ }
+
// LUCENE-6046
public void testRepeatWithEmptyString() throws Exception {
Automaton a = new RegExp("[^y]*{1,2}").toAutomaton(1000);