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 2013/08/16 00:42:55 UTC

svn commit: r1514520 - /lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FST.java

Author: mikemccand
Date: Thu Aug 15 22:42:54 2013
New Revision: 1514520

URL: http://svn.apache.org/r1514520
Log:
LUCENE-5152: make assert less costly

Modified:
    lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FST.java

Modified: lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FST.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FST.java?rev=1514520&r1=1514519&r2=1514520&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FST.java (original)
+++ lucene/dev/trunk/lucene/core/src/java/org/apache/lucene/util/fst/FST.java Thu Aug 15 22:42:54 2013
@@ -1140,7 +1140,6 @@ public final class FST<T> {
   /** 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<T> findTargetArc(int labelToMatch, Arc<T> follow, Arc<T> arc, BytesReader in) throws IOException {
-    assert assertRootArcs();
 
     if (labelToMatch == END_LABEL) {
       if (follow.isFinal()) {
@@ -1162,6 +1161,10 @@ public final class FST<T> {
 
     // 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<T> result = cachedRootArcs[labelToMatch];
       if (result == null) {
         return null;