Program: 2116
Project: 2116
Buggy source:
public synchronized void rebuildIndex(){
  IndexWriter writer=null;
  LOG.info("String_Node_Str");
  try {
    File file=new File(System.getProperty("String_Node_Str") + "String_Node_Str");
    Analyzer analyzer=new StandardAnalyzer(Version.LUCENE_CURRENT);
    writer=new IndexWriter(FSDirectory.open(file),analyzer,true,IndexWriter.MaxFieldLength.LIMITED);
    writer.setUseCompoundFile(true);
    writer.deleteAll();
    writer.commit();
    Collection<Note> notes=getAllNotes();
    LOG.info("String_Node_Str" + notes.size());
    for (    Note note : notes) {
      if (Thread.interrupted()) {
        writer.close();
        return;
      }
      LOG.info("String_Node_Str" + note);
      Document document=new Document();
      Field idField=new Field("String_Node_Str",note.getId().toString(),Field.Store.YES,Field.Index.NOT_ANALYZED);
      document.add(idField);
      Field titleField=new Field("String_Node_Str",note.getTitle(),Field.Store.YES,Field.Index.ANALYZED);
      document.add(titleField);
      DocumentFragment node=new HTMLDocumentImpl().createDocumentFragment();
      domParser.parse(new InputSource(new StringReader(note.getContent())),node);
      StringBuffer sb=new StringBuffer();
      sb.setLength(0);
      getText(sb,node);
      String text=sb.toString();
      if ((text != null) && (!text.equals("String_Node_Str"))) {
        Field contentField=new Field("String_Node_Str",text,Field.Store.NO,Field.Index.ANALYZED);
        document.add(titleField);
      }
      writer.addDocument(document);
    }
    writer.commit();
    writer.optimize();
    writer.close();
  }
 catch (  Exception ex) {
    LOG.log(Level.WARNING,"String_Node_Str",ex);
    Exceptions.printStackTrace(ex);
  }
 finally {
    try {
      if (writer != null) {
        writer.close();
      }
    }
 catch (    Exception ex) {
      Exceptions.printStackTrace(ex);
    }
  }
  LOG.info("String_Node_Str");
}

Fixed version (ground truth):
public void rebuildIndex(){
  IndexWriter writer=null;
  LOG.info("String_Node_Str");
  try {
    File file=new File(System.getProperty("String_Node_Str") + "String_Node_Str");
    Analyzer analyzer=new StandardAnalyzer(Version.LUCENE_CURRENT);
    writer=new IndexWriter(FSDirectory.open(file),analyzer,true,IndexWriter.MaxFieldLength.LIMITED);
    writer.setUseCompoundFile(true);
    writer.deleteAll();
    writer.commit();
    Collection<Note> notes=getAllNotes();
    LOG.info("String_Node_Str" + notes.size());
    for (    Note note : notes) {
      if (Thread.interrupted()) {
        writer.close();
        LOG.warning("String_Node_Str");
        return;
      }
      LOG.info("String_Node_Str" + note);
      Document document=new Document();
      Field idField=new Field("String_Node_Str",note.getId().toString(),Field.Store.YES,Field.Index.NOT_ANALYZED);
      document.add(idField);
      Field titleField=new Field("String_Node_Str",note.getTitle(),Field.Store.YES,Field.Index.ANALYZED);
      document.add(titleField);
      DocumentFragment node=new HTMLDocumentImpl().createDocumentFragment();
      domParser.parse(new InputSource(new StringReader(note.getContent())),node);
      StringBuffer sb=new StringBuffer();
      sb.setLength(0);
      getText(sb,node);
      String text=sb.toString();
      if ((text != null) && (!text.equals("String_Node_Str"))) {
        Field contentField=new Field("String_Node_Str",text,Field.Store.NO,Field.Index.ANALYZED);
        document.add(titleField);
      }
      writer.addDocument(document);
    }
    writer.commit();
    writer.optimize();
    writer.close();
  }
 catch (  Exception ex) {
    LOG.log(Level.WARNING,"String_Node_Str",ex);
    Exceptions.printStackTrace(ex);
  }
 finally {
    try {
      if (writer != null) {
        writer.close();
      }
    }
 catch (    Exception ex) {
      Exceptions.printStackTrace(ex);
    }
  }
  LOG.info("String_Node_Str");
}