Buggy code:
public final class TestL1ModelClustering extends MahoutTestCase { private class MapElement implements Comparable < TestL1ModelClustering . MapElement > { private final Double pdf ; private final String doc ; MapElement ( double pdf , String doc ) { } @ Override public int compareTo ( TestL1ModelClustering . MapElement e ) { } @ Override public int hashCode ( ) { } @ Override public boolean equals ( Object other ) { } @ Override public String toString ( ) { } } private static final String [ ] DOCS = new String [ ] { "The<seq2seq4repair_space>quick<seq2seq4repair_space>red<seq2seq4repair_space>fox<seq2seq4repair_space>jumped<seq2seq4repair_space>over<seq2seq4repair_space>the<seq2seq4repair_space>lazy<seq2seq4repair_space>brown<seq2seq4repair_space>dogs." , "The<seq2seq4repair_space>quick<seq2seq4repair_space>brown<seq2seq4repair_space>fox<seq2seq4repair_space>jumped<seq2seq4repair_space>over<seq2seq4repair_space>the<seq2seq4repair_space>lazy<seq2seq4repair_space>red<seq2seq4repair_space>dogs." , "The<seq2seq4repair_space>quick<seq2seq4repair_space>red<seq2seq4repair_space>cat<seq2seq4repair_space>jumped<seq2seq4repair_space>over<seq2seq4repair_space>the<seq2seq4repair_space>lazy<seq2seq4repair_space>brown<seq2seq4repair_space>dogs." , "The<seq2seq4repair_space>quick<seq2seq4repair_space>brown<seq2seq4repair_space>cat<seq2seq4repair_space>jumped<seq2seq4repair_space>over<seq2seq4repair_space>the<seq2seq4repair_space>lazy<seq2seq4repair_space>red<seq2seq4repair_space>dogs." , "Mary<seq2seq4repair_space>had<seq2seq4repair_space>a<seq2seq4repair_space>little<seq2seq4repair_space>lamb<seq2seq4repair_space>whose<seq2seq4repair_space>fleece<seq2seq4repair_space>was<seq2seq4repair_space>white<seq2seq4repair_space>as<seq2seq4repair_space>snow." , "Moby<seq2seq4repair_space>Dick<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>story<seq2seq4repair_space>of<seq2seq4repair_space>a<seq2seq4repair_space>whale<seq2seq4repair_space>and<seq2seq4repair_space>a<seq2seq4repair_space>man<seq2seq4repair_space>obsessed." , "The<seq2seq4repair_space>robber<seq2seq4repair_space>wore<seq2seq4repair_space>a<seq2seq4repair_space>black<seq2seq4repair_space>fleece<seq2seq4repair_space>jacket<seq2seq4repair_space>and<seq2seq4repair_space>a<seq2seq4repair_space>baseball<seq2seq4repair_space>cap." , "The<seq2seq4repair_space>English<seq2seq4repair_space>Springer<seq2seq4repair_space>Spaniel<seq2seq4repair_space>is<seq2seq4repair_space>the<seq2seq4repair_space>best<seq2seq4repair_space>of<seq2seq4repair_space>all<seq2seq4repair_space>dogs." } ; private static final String [ ] DOCS2 = new String [ ] { "The<seq2seq4repair_space>quick<seq2seq4repair_space>red<seq2seq4repair_space>fox<seq2seq4repair_space>jumped<seq2seq4repair_space>over<seq2seq4repair_space>the<seq2seq4repair_space>lazy<seq2seq4repair_space>brown<seq2seq4repair_space>dogs." , "The<seq2seq4repair_space>quick<seq2seq4repair_space>brown<seq2seq4repair_space>fox<seq2seq4repair_space>jumped<seq2seq4repair_space>over<seq2seq4repair_space>the<seq2seq4repair_space>lazy<seq2seq4repair_space>red<seq2seq4repair_space>dogs." , "The<seq2seq4repair_space>quick<seq2seq4repair_space>red<seq2seq4repair_space>cat<seq2seq4repair_space>jumped<seq2seq4repair_space>over<seq2seq4repair_space>the<seq2seq4repair_space>lazy<seq2seq4repair_space>brown<seq2seq4repair_space>dogs." , "The<seq2seq4repair_space>quick<seq2seq4repair_space>brown<seq2seq4repair_space>cat<seq2seq4repair_space>jumped<seq2seq4repair_space>over<seq2seq4repair_space>the<seq2seq4repair_space>lazy<seq2seq4repair_space>red<seq2seq4repair_space>dogs." , "Mary<seq2seq4repair_space>had<seq2seq4repair_space>a<seq2seq4repair_space>little<seq2seq4repair_space>lamb<seq2seq4repair_space>whose<seq2seq4repair_space>fleece<seq2seq4repair_space>was<seq2seq4repair_space>white<seq2seq4repair_space>as<seq2seq4repair_space>snow." , "Mary<seq2seq4repair_space>had<seq2seq4repair_space>a<seq2seq4repair_space>little<seq2seq4repair_space>goat<seq2seq4repair_space>whose<seq2seq4repair_space>fleece<seq2seq4repair_space>was<seq2seq4repair_space>white<seq2seq4repair_space>as<seq2seq4repair_space>snow." , "Mary<seq2seq4repair_space>had<seq2seq4repair_space>a<seq2seq4repair_space>little<seq2seq4repair_space>lamb<seq2seq4repair_space>whose<seq2seq4repair_space>fleece<seq2seq4repair_space>was<seq2seq4repair_space>black<seq2seq4repair_space>as<seq2seq4repair_space>tar." , "Dick<seq2seq4repair_space>had<seq2seq4repair_space>a<seq2seq4repair_space>little<seq2seq4repair_space>goat<seq2seq4repair_space>whose<seq2seq4repair_space>fleece<seq2seq4repair_space>was<seq2seq4repair_space>white<seq2seq4repair_space>as<seq2seq4repair_space>snow." , "Moby<seq2seq4repair_space>Dick<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>story<seq2seq4repair_space>of<seq2seq4repair_space>a<seq2seq4repair_space>whale<seq2seq4repair_space>and<seq2seq4repair_space>a<seq2seq4repair_space>man<seq2seq4repair_space>obsessed." , "Moby<seq2seq4repair_space>Bob<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>story<seq2seq4repair_space>of<seq2seq4repair_space>a<seq2seq4repair_space>walrus<seq2seq4repair_space>and<seq2seq4repair_space>a<seq2seq4repair_space>man<seq2seq4repair_space>obsessed." , "Moby<seq2seq4repair_space>Dick<seq2seq4repair_space>is<seq2seq4repair_space>a<seq2seq4repair_space>story<seq2seq4repair_space>of<seq2seq4repair_space>a<seq2seq4repair_space>whale<seq2seq4repair_space>and<seq2seq4repair_space>a<seq2seq4repair_space>crazy<seq2seq4repair_space>man." , "The<seq2seq4repair_space>robber<seq2seq4repair_space>wore<seq2seq4repair_space>a<seq2seq4repair_space>black<seq2seq4repair_space>fleece<seq2seq4repair_space>jacket<seq2seq4repair_space>and<seq2seq4repair_space>a<seq2seq4repair_space>baseball<seq2seq4repair_space>cap." , "The<seq2seq4repair_space>robber<seq2seq4repair_space>wore<seq2seq4repair_space>a<seq2seq4repair_space>red<seq2seq4repair_space>fleece<seq2seq4repair_space>jacket<seq2seq4repair_space>and<seq2seq4repair_space>a<seq2seq4repair_space>baseball<seq2seq4repair_space>cap." , "The<seq2seq4repair_space>robber<seq2seq4repair_space>wore<seq2seq4repair_space>a<seq2seq4repair_space>white<seq2seq4repair_space>fleece<seq2seq4repair_space>jacket<seq2seq4repair_space>and<seq2seq4repair_space>a<seq2seq4repair_space>baseball<seq2seq4repair_space>cap." , "The<seq2seq4repair_space>English<seq2seq4repair_space>Springer<seq2seq4repair_space>Spaniel<seq2seq4repair_space>is<seq2seq4repair_space>the<seq2seq4repair_space>best<seq2seq4repair_space>of<seq2seq4repair_space>all<seq2seq4repair_space>dogs." } ; private List < Vector > sampleData ; private void getSampleData ( String [ ] docs2 ) throws IOException { System . out . println ( ) ; sampleData = Lists . newArrayList ( ) ; RAMDirectory directory = new RAMDirectory ( ) ; <START_BUG> IndexWriter writer = new IndexWriter ( directory , new org . apache . lucene . index . IndexWriterConfig ( Version . LUCENE_41 , new org . apache . lucene . analysis . standard . StandardAnalyzer ( Version . LUCENE_41 ) ) ) ; <END_BUG> FieldType customType = new FieldType ( TextField . TYPE_NOT_STORED ) ; customType . setStoreTermVectors ( true ) ; try { for ( int i = 0 ; i < ( docs2 . length ) ; i ++ ) { Document doc = new Document ( ) ; Field id = new Field ( "id" , ( "doc_" + i ) , StringField . TYPE_STORED ) ; doc . add ( id ) ; Field text = new Field ( "content" , docs2 [ i ] , customType ) ; doc . add ( text ) ; writer . addDocument ( doc ) ; writer . commit ( ) ; } } finally { writer . close ( ) ; } IndexReader reader = DirectoryReader . open ( directory ) ; System . out . println ( ( "Number<seq2seq4repair_space>of<seq2seq4repair_space>documents:<seq2seq4repair_space>\t" + ( reader . numDocs ( ) ) ) ) ; Weight weight = new TFIDF ( ) ; TermInfo termInfo = new org . apache . mahout . utils . vectors . lucene . CachedTermInfo ( reader , "content" , 1 , 100 ) ; Iterable < Vector > iterable = new org . apache . mahout . utils . vectors . lucene . LuceneIterable ( reader , "id" , "content" , termInfo , weight ) ; int i = 0 ; for ( Vector vector : iterable ) { assertNotNull ( vector ) ; System . out . println ( ( ( i + ".<seq2seq4repair_space>" ) + ( docs2 [ ( i ++ ) ] ) ) ) ; System . out . println ( ( '\t' + ( TestL1ModelClustering . formatVector ( vector ) ) ) ) ; sampleData . add ( vector ) ; } } private static String formatVector ( Vector v ) { } private void printClusters ( List < Cluster > models , String [ ] docs ) { } @ Test public void testDocs ( ) throws Exception { } @ Test public void testDMDocs ( ) throws Exception { } @ Test public void testDocs2 ( ) throws Exception { } @ Test public void testDMDocs2 ( ) throws Exception { } }

Fix:
IndexWriter writer = new IndexWriter ( directory , new org . apache . lucene . index . IndexWriterConfig ( Version . LUCENE_42 , new org . apache . lucene . analysis . standard . StandardAnalyzer ( Version . LUCENE_42 ) ) ) ;