Apache Lucene open-source search software
remove max recursion from Operations.java to AutomatonTestUtil.java (#12298)
tang donghaif53eb28af053
diff --git a/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java b/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.javaindex b3c10cebfa0..8448dfc8795 100644--- a/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java+++ b/lucene/core/src/java/org/apache/lucene/util/automaton/Operations.java@@ -61,9 +61,6 @@ public final class Operations {*/public static final int DEFAULT_DETERMINIZE_WORK_LIMIT = 10000;- /** Maximum level of recursion allowed in recursive operations. */- public static final int MAX_RECURSION_LEVEL = 1000;-private Operations() {}/**diff --git a/lucene/test-framework/src/java/org/apache/lucene/tests/util/automaton/AutomatonTestUtil.java b/lucene/test-framework/src/java/org/apache/lucene/tests/util/automaton/AutomatonTestUtil.javaindex 0a64252387d..38819479cfc 100644--- a/lucene/test-framework/src/java/org/apache/lucene/tests/util/automaton/AutomatonTestUtil.java+++ b/lucene/test-framework/src/java/org/apache/lucene/tests/util/automaton/AutomatonTestUtil.java@@ -46,6 +46,9 @@ public class AutomatonTestUtil {/** Default maximum number of states that {@link Operations#determinize} should create. */public static final int DEFAULT_MAX_DETERMINIZED_STATES = 1000000;+ /** Maximum level of recursion allowed in recursive operations. */+ public static final int MAX_RECURSION_LEVEL = 1000;+/** Returns random string, including full unicode range. */public static String randomRegexp(Random r) {while (true) {@@ -483,7 +486,7 @@ public class AutomatonTestUtil {// large automata could exceed java's stack so the maximum level of recursion is bounded to 1000private static boolean isFinite(Transition scratch, Automaton a, int state, BitSet path, BitSet visited, int level) {- if (level > Operations.MAX_RECURSION_LEVEL) {+ if (level > MAX_RECURSION_LEVEL) {throw new IllegalArgumentException("input automaton is too large: " + level);}path.set(state);