From 4b31375b55b7bda9a400d191ca949d6c9e63930e Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Mon, 5 Mar 2012 00:43:17 +0000 Subject: [PATCH] Fix one more insanity case... die,die,die! git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1296914 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/java/org/apache/lucene/util/LuceneTestCase.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java index e2646910060..7c10d88b758 100644 --- a/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java +++ b/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java @@ -1387,7 +1387,7 @@ public abstract class LuceneTestCase extends Assert { r = SlowCompositeReaderWrapper.wrap(r); break; case 1: - // will create no FC insanity as Parallel*Reader has own cache key: + // will create no FC insanity in atomic case, as ParallelAtomicReader has own cache key: r = (r instanceof AtomicReader) ? new ParallelAtomicReader((AtomicReader) r) : new ParallelCompositeReader((CompositeReader) r); @@ -1419,6 +1419,9 @@ public abstract class LuceneTestCase extends Assert { } if (wasOriginallyAtomic) { r = SlowCompositeReaderWrapper.wrap(r); + } else if ((r instanceof CompositeReader) && !(r instanceof FCInvisibleMultiReader)) { + // prevent cache insanity caused by e.g. ParallelCompositeReader, to fix we wrap one more time: + r = new FCInvisibleMultiReader(r); } if (VERBOSE) { System.out.println("maybeWrapReader wrapped: " +r);