Program: 20774
Project: 20774
Buggy source:
/** 
 * Test the ArtifactRepositoryIndex using a single-phrase search.
 * @throws Exception
 */
public void testSearch() throws Exception {
  EclipseRepositoryIndex index=createTestIndex();
  IndexSearcher searcher=new IndexSearcher(index.getIndexPath().getAbsolutePath());
  try {
    QueryParser parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    Hits hits=searcher.search(parser.parse("String_Node_Str"));
    assertEquals("String_Node_Str",1,hits.length());
    Document doc=hits.doc(0);
    assertEquals("String_Node_Str","String_Node_Str",doc.get("String_Node_Str"));
    parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    hits=searcher.search(parser.parse("String_Node_Str"));
    assertEquals("String_Node_Str",1,hits.length());
    doc=hits.doc(0);
    assertEquals("String_Node_Str","String_Node_Str",doc.get("String_Node_Str"));
    parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    hits=searcher.search(parser.parse(DateField.timeToString(artifactFileTime)));
    assertEquals("String_Node_Str",1,hits.length());
    doc=hits.doc(0);
    assertEquals("String_Node_Str","String_Node_Str",doc.get("String_Node_Str"));
    parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    hits=searcher.search(parser.parse("String_Node_Str"));
    assertEquals("String_Node_Str",1,hits.length());
    doc=hits.doc(0);
    assertEquals("String_Node_Str","String_Node_Str",doc.get("String_Node_Str"));
    parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    hits=searcher.search(parser.parse("String_Node_Str"));
    assertEquals("String_Node_Str",1,hits.length());
    doc=hits.doc(0);
    assertEquals("String_Node_Str","String_Node_Str",doc.get("String_Node_Str"));
    parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    hits=searcher.search(parser.parse("String_Node_Str"));
    assertEquals("String_Node_Str",2,hits.length());
  }
  finally {
    searcher.close();
  }
}

Fixed version (ground truth):
/** 
 * Test the ArtifactRepositoryIndex using a single-phrase search.
 * @throws Exception
 */
public void testSearch() throws Exception {
  EclipseRepositoryIndex index=createTestIndex();
  IndexSearcher searcher=new IndexSearcher(index.getIndexPath().getAbsolutePath());
  try {
    QueryParser parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    Hits hits=searcher.search(parser.parse("String_Node_Str"));
    assertEquals("String_Node_Str",1,hits.length());
    Document doc=hits.doc(0);
    assertEquals("String_Node_Str","String_Node_Str",doc.get("String_Node_Str"));
    parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    hits=searcher.search(parser.parse("String_Node_Str"));
    assertEquals("String_Node_Str",1,hits.length());
    doc=hits.doc(0);
    assertEquals("String_Node_Str","String_Node_Str",doc.get("String_Node_Str"));
    parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    hits=searcher.search(parser.parse(DateTools.timeToString(artifactFileTime,DateTools.Resolution.SECOND)));
    assertEquals("String_Node_Str",1,hits.length());
    doc=hits.doc(0);
    assertEquals("String_Node_Str","String_Node_Str",doc.get("String_Node_Str"));
    parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    hits=searcher.search(parser.parse("String_Node_Str"));
    assertEquals("String_Node_Str",1,hits.length());
    doc=hits.doc(0);
    assertEquals("String_Node_Str","String_Node_Str",doc.get("String_Node_Str"));
    parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    hits=searcher.search(parser.parse("String_Node_Str"));
    assertEquals("String_Node_Str",1,hits.length());
    doc=hits.doc(0);
    assertEquals("String_Node_Str","String_Node_Str",doc.get("String_Node_Str"));
    parser=new QueryParser("String_Node_Str",index.getAnalyzer());
    hits=searcher.search(parser.parse("String_Node_Str"));
    assertEquals("String_Node_Str",2,hits.length());
  }
  finally {
    searcher.close();
  }
}