From 51da0631c0b688c63da3e43e76d20181d4ec6f0e Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Thu, 15 Aug 2013 22:42:54 +0000 Subject: [PATCH] LUCENE-5152: make assert less costly git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1514520 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/core/src/java/org/apache/lucene/util/fst/FST.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lucene/core/src/java/org/apache/lucene/util/fst/FST.java b/lucene/core/src/java/org/apache/lucene/util/fst/FST.java index 2f1df2758af..4afaa9a72ff 100644 --- a/lucene/core/src/java/org/apache/lucene/util/fst/FST.java +++ b/lucene/core/src/java/org/apache/lucene/util/fst/FST.java @@ -1140,7 +1140,6 @@ public final class FST { /** Finds an arc leaving the incoming arc, replacing the arc in place. * This returns null if the arc was not found, else the incoming arc. */ public Arc findTargetArc(int labelToMatch, Arc follow, Arc arc, BytesReader in) throws IOException { - assert assertRootArcs(); if (labelToMatch == END_LABEL) { if (follow.isFinal()) { @@ -1162,6 +1161,10 @@ public final class FST { // Short-circuit if this arc is in the root arc cache: if (follow.target == startNode && labelToMatch < cachedRootArcs.length) { + + // LUCENE-5152: detect tricky cases where caller + // modified previously returned cached root-arcs: + assert assertRootArcs(); final Arc result = cachedRootArcs[labelToMatch]; if (result == null) { return null;