Apache Lucene open-source search software
LUCENE-952: force synchronized access to writer instance variable to fix infinite spin loop in TestGdataIndexer
Michael McCandless96ea45d19385
diff --git a/contrib/gdata-server/src/core/src/java/org/apache/lucene/gdata/search/index/GDataIndexer.java b/contrib/gdata-server/src/core/src/java/org/apache/lucene/gdata/search/index/GDataIndexer.javaindex 7cb8885d1eb..68369defad0 100755--- a/contrib/gdata-server/src/core/src/java/org/apache/lucene/gdata/search/index/GDataIndexer.java+++ b/contrib/gdata-server/src/core/src/java/org/apache/lucene/gdata/search/index/GDataIndexer.java@@ -400,6 +400,11 @@ public class GDataIndexer {}+ // Used only for testing+ protected synchronized IndexWriter getWriter() {+ return this.writer;+ }+/*** This factory method creates a new GDataIndexer using a instance of* {@link IndexTask}diff --git a/contrib/gdata-server/src/core/src/test/org/apache/lucene/gdata/search/index/TestGdataIndexer.java b/contrib/gdata-server/src/core/src/test/org/apache/lucene/gdata/search/index/TestGdataIndexer.javaindex 87e16b7fb12..1b09dc027d1 100755--- a/contrib/gdata-server/src/core/src/test/org/apache/lucene/gdata/search/index/TestGdataIndexer.java+++ b/contrib/gdata-server/src/core/src/test/org/apache/lucene/gdata/search/index/TestGdataIndexer.java@@ -552,7 +552,7 @@ public void testAddDocument() throws IOException {latch.countDown();documentLatch.await(5000,TimeUnit.MILLISECONDS);// wait active for the commit- while(this.indexer.writer != null){}+ while(this.indexer.getWriter() != null){}IndexSearcher s = new IndexSearcher(this.dir);Hits h = s.search(new TermQuery(delTerm));