Buggy code:
public class UIMABaseAnalyzerTest extends BaseTokenStreamTestCase { private UIMABaseAnalyzer analyzer ; @ Before public void setUp ( ) throws Exception { } @ After public void tearDown ( ) throws Exception { } @ Test public void baseUIMAAnalyzerStreamTest ( ) throws Exception { } @ Test public void baseUIMAAnalyzerIntegrationTest ( ) throws Exception { Directory dir = new RAMDirectory ( ) ; <START_BUG> IndexWriter writer = new IndexWriter ( dir , new org . apache . lucene . index . IndexWriterConfig ( Version . LUCENE_40 , analyzer ) ) ; <END_BUG> Document doc = new Document ( ) ; String dummyTitle = "this<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>dummy<seq2seq4repair_space>title<seq2seq4repair_space>" ; doc . add ( new org . apache . lucene . document . TextField ( "title" , dummyTitle , Store . YES ) ) ; String dummyContent = "there<seq2seq4repair_space>is<seq2seq4repair_space>some<seq2seq4repair_space>content<seq2seq4repair_space>written<seq2seq4repair_space>here" ; doc . add ( new org . apache . lucene . document . TextField ( "contents" , dummyContent , Store . YES ) ) ; writer . addDocument ( doc , analyzer ) ; writer . commit ( ) ; DirectoryReader directoryReader = DirectoryReader . open ( dir ) ; IndexSearcher indexSearcher = new IndexSearcher ( directoryReader ) ; TopDocs result = indexSearcher . search ( new MatchAllDocsQuery ( ) , 1 ) ; assertTrue ( ( ( result . totalHits ) > 0 ) ) ; Document d = indexSearcher . doc ( result . scoreDocs [ 0 ] . doc ) ; assertNotNull ( d ) ; assertNotNull ( d . getField ( "title" ) ) ; assertEquals ( dummyTitle , d . getField ( "title" ) . stringValue ( ) ) ; assertNotNull ( d . getField ( "contents" ) ) ; assertEquals ( dummyContent , d . getField ( "contents" ) . stringValue ( ) ) ; doc = new Document ( ) ; String dogmasTitle = "dogmas" ; doc . add ( new org . apache . lucene . document . TextField ( "title" , dogmasTitle , Store . YES ) ) ; String dogmasContents = "white<seq2seq4repair_space>men<seq2seq4repair_space>can't<seq2seq4repair_space>jump" ; doc . add ( new org . apache . lucene . document . TextField ( "contents" , dogmasContents , Store . YES ) ) ; writer . addDocument ( doc , analyzer ) ; writer . commit ( ) ; directoryReader . close ( ) ; directoryReader = DirectoryReader . open ( dir ) ; indexSearcher = new IndexSearcher ( directoryReader ) ; result = indexSearcher . search ( new MatchAllDocsQuery ( ) , 2 ) ; Document d1 = indexSearcher . doc ( result . scoreDocs [ 1 ] . doc ) ; assertNotNull ( d1 ) ; assertNotNull ( d1 . getField ( "title" ) ) ; assertEquals ( dogmasTitle , d1 . getField ( "title" ) . stringValue ( ) ) ; assertNotNull ( d1 . getField ( "contents" ) ) ; assertEquals ( dogmasContents , d1 . getField ( "contents" ) . stringValue ( ) ) ; indexSearcher = new IndexSearcher ( directoryReader ) ; result = indexSearcher . search ( new MatchAllDocsQuery ( ) , 2 ) ; assertEquals ( 2 , result . totalHits ) ; writer . close ( ) ; indexSearcher . getIndexReader ( ) . close ( ) ; dir . close ( ) ; } @ Test public void testRandomStrings ( ) throws Exception { } }

Fix:
IndexWriter writer = new IndexWriter ( dir , new org . apache . lucene . index . IndexWriterConfig ( Version . LUCENE_50 , analyzer ) ) ;