Program: 24672
Project: 24672
Buggy source:
/** 
 * Save document information associated with a collection of chunks. <br><br> This method saves a special document summary information chunk to the Lucene database that binds all the indexed text chunks for a document back to the original XML source text.
 * @.notes The document summary chunk is the last chunk written to a Lucene database for a given XML source document. Its presence or absence then can be used to identify whether or a document was completely indexed or not. The absence of a document summary for any given text chunk implies that indexing was aborted before the document was completely indexed. This property of document summary chunks is used by the   {@link IdxTreeCleaner} class to stript out anypartially indexed documents.<br><br> The document summary includes the relative path to the original XML source text, the number of chunks indexed for the document, a unique key that associates this summary with all the indexed text chunks, the date the document was added to the index, and any meta-data associated with the document. <br><br>
 */
private void saveDocInfo(SectionInfo secInfo){
  Document doc=new Document();
  doc.add(new Field("String_Node_Str","String_Node_Str",Field.Store.YES,Field.Index.UN_TOKENIZED));
  doc.add(new Field("String_Node_Str",Integer.toString(chunkCount),Field.Store.YES,Field.Index.NO));
  chunkCount=0;
  doc.add(new Field("String_Node_Str",curIdxSrc.key(),Field.Store.YES,Field.Index.UN_TOKENIZED));
  int recordNum=curIdxRecord.recordNum();
  if (recordNum > 0) {
    doc.add(new Field("String_Node_Str",Integer.toString(recordNum),Field.Store.YES,Field.Index.NO));
  }
  if (secInfo.subDocument != null) {
    doc.add(new Field("String_Node_Str",secInfo.subDocument,Field.Store.YES,Field.Index.NO));
  }
  File srcPath=curIdxSrc.path();
  if (srcPath != null) {
    String fileDateStr=DateTools.timeToString(srcPath.lastModified(),DateTools.Resolution.MILLISECOND);
    doc.add(new Field("String_Node_Str",fileDateStr,Field.Store.YES,Field.Index.NO));
  }
  XTFTextAnalyzer analyzer=(XTFTextAnalyzer)indexWriter.getAnalyzer();
  analyzer.clearFacetFields();
  if (secInfo.metaInfo.isEmpty()) {
    Trace.tab();
    Trace.warning("String_Node_Str");
    Trace.untab();
  }
 else {
    Iterator metaIter=secInfo.metaInfo.iterator();
    while (metaIter.hasNext()) {
      MetaField metaField=(MetaField)metaIter.next();
      if (metaField.isFacet && metaField.index) {
        metaField.tokenize=true;
        analyzer.addFacetField(metaField.name);
      }
      if (!metaField.spell && metaField.index)       analyzer.addMisspelledField(metaField.name);
      Field docField=new Field(metaField.name,metaField.value,metaField.store ? Field.Store.YES : Field.Store.NO,metaField.index ? (metaField.tokenize ? Field.Index.TOKENIZED : Field.Index.UN_TOKENIZED) : Field.Index.NO);
      docField.setBoost(metaField.wordBoost);
      doc.add(docField);
      if (metaField.tokenize && !metaField.isFacet) {
        if (!tokenizedFields.contains(metaField.name)) {
          addToTokenizedFieldsFile(metaField.name);
          tokenizedFields.add(metaField.name);
        }
      }
    }
  }
  try {
    indexWriter.addDocument(doc);
  }
 catch (  Throwable t) {
    Trace.tab();
    Trace.error("String_Node_Str" + t);
    Trace.untab();
    if (t instanceof RuntimeException)     throw (RuntimeException)t;
 else     throw new RuntimeException(t);
  }
}

Fixed version (ground truth):
/** 
 * Save document information associated with a collection of chunks. <br><br> This method saves a special document summary information chunk to the Lucene database that binds all the indexed text chunks for a document back to the original XML source text.
 * @.notes The document summary chunk is the last chunk written to a Lucene database for a given XML source document. Its presence or absence then can be used to identify whether or a document was completely indexed or not. The absence of a document summary for any given text chunk implies that indexing was aborted before the document was completely indexed. This property of document summary chunks is used by the   {@link IdxTreeCleaner} class to stript out anypartially indexed documents.<br><br> The document summary includes the relative path to the original XML source text, the number of chunks indexed for the document, a unique key that associates this summary with all the indexed text chunks, the date the document was added to the index, and any meta-data associated with the document. <br><br>
 */
private void saveDocInfo(SectionInfo secInfo){
  Document doc=new Document();
  doc.add(new Field("String_Node_Str","String_Node_Str",Field.Store.YES,Field.Index.UN_TOKENIZED));
  doc.add(new Field("String_Node_Str",Integer.toString(chunkCount),Field.Store.YES,Field.Index.NO));
  chunkCount=0;
  docWordCount=0;
  doc.add(new Field("String_Node_Str",curIdxSrc.key(),Field.Store.YES,Field.Index.UN_TOKENIZED));
  int recordNum=curIdxRecord.recordNum();
  if (recordNum > 0) {
    doc.add(new Field("String_Node_Str",Integer.toString(recordNum),Field.Store.YES,Field.Index.NO));
  }
  if (secInfo.subDocument != null) {
    doc.add(new Field("String_Node_Str",secInfo.subDocument,Field.Store.YES,Field.Index.NO));
  }
  File srcPath=curIdxSrc.path();
  if (srcPath != null) {
    String fileDateStr=DateTools.timeToString(srcPath.lastModified(),DateTools.Resolution.MILLISECOND);
    doc.add(new Field("String_Node_Str",fileDateStr,Field.Store.YES,Field.Index.NO));
  }
  XTFTextAnalyzer analyzer=(XTFTextAnalyzer)indexWriter.getAnalyzer();
  analyzer.clearFacetFields();
  if (secInfo.metaInfo.isEmpty()) {
    Trace.tab();
    Trace.warning("String_Node_Str");
    Trace.untab();
  }
 else {
    Iterator metaIter=secInfo.metaInfo.iterator();
    while (metaIter.hasNext()) {
      MetaField metaField=(MetaField)metaIter.next();
      if (metaField.isFacet && metaField.index) {
        metaField.tokenize=true;
        analyzer.addFacetField(metaField.name);
      }
      if (!metaField.spell && metaField.index)       analyzer.addMisspelledField(metaField.name);
      Field docField=new Field(metaField.name,metaField.value,metaField.store ? Field.Store.YES : Field.Store.NO,metaField.index ? (metaField.tokenize ? Field.Index.TOKENIZED : Field.Index.UN_TOKENIZED) : Field.Index.NO);
      docField.setBoost(metaField.wordBoost);
      doc.add(docField);
      if (metaField.tokenize && !metaField.isFacet) {
        if (!tokenizedFields.contains(metaField.name)) {
          addToTokenizedFieldsFile(metaField.name);
          tokenizedFields.add(metaField.name);
        }
      }
    }
  }
  try {
    indexWriter.addDocument(doc);
  }
 catch (  Throwable t) {
    Trace.tab();
    Trace.error("String_Node_Str" + t);
    Trace.untab();
    if (t instanceof RuntimeException)     throw (RuntimeException)t;
 else     throw new RuntimeException(t);
  }
}