Program: 24654
Project: 24654
Buggy source:
/** 
 * Process any accumulated source text, writing indexing completed chunks to the Lucene database as necessary. <br><br>
 * @throws SAXException  Any exceptions encountered during the processing ofthe accumulated chunks, or writing them to the Lucene index. <br><br>
 * @.notes This method processes any accumulated text as follows: <blockquote dir=ltr style="MARGIN-RIGHT: 0px"> 1. First the accumulated text is "blurbified." See the {@link XMLTextProcessor#blurbify(StringBuffer,boolean) blurbify()}method for more information about what this entails. <br><br> 2. Next, a chunk is assembled a word at a time from the accumulated text until the required chunk size (in words) is reached. The completed chunk is then added to the Lucene database. <br><br> 3. Step two is repeated until no more complete chunks can be assembled from the accumulated text. (Any partial chunk text is saved until the next call to this method.) </blockquote>
 */
public void flushCharacters() throws SAXException {
  char[] ch=charBuf;
  int length=charBufPos;
  int start=0;
  charBufPos=0;
  int i=0;
  if (indexInfo.stripWhitespace) {
    for (i=0; i < length; i++)     if (!Character.isWhitespace(charBuf[i]))     break;
  }
  if (i == length)   return;
  if (lazyHandler != null)   lazyHandler.characters(ch,start,length);
  incrementNode();
  if (inMeta > 0) {
    String tmp=new String(ch,start,length);
    if (tmp.indexOf('&') >= 0)     tmp=tmp.replaceAll("String_Node_Str","String_Node_Str");
    if (tmp.indexOf('<') >= 0)     tmp=tmp.replaceAll("String_Node_Str","String_Node_Str");
    if (tmp.indexOf('>') >= 0)     tmp=tmp.replaceAll("String_Node_Str","String_Node_Str");
    metaBuf.append(tmp);
    return;
  }
  if (section.indexFlag() == SectionInfo.noIndex)   return;
  blurbedText.setLength(0);
  blurbedText.append(ch,start,length);
  blurbify(blurbedText,true);
  insertVirtualWords(blurbedText);
  if (blurbedText.length() <= 0)   return;
  String blurbedTextStr=blurbedText.toString();
  FastStringReader reader=new FastStringReader(blurbedTextStr);
  TokenStream result=new FastTokenizer(reader);
  int punctStart=0;
  int accumTextLen=trimAccumText(true);
  boolean mustGetNextWord=true;
  Token word=null;
  for (; ; ) {
    try {
      if (mustGetNextWord)       word=result.next();
      if (word == null)       break;
      mustGetNextWord=true;
      if (chunkStartNode < 0) {
        chunkStartNode=curNode;
        chunkWordOffset=nodeWordCount;
      }
      int wordStart=word.startOffset();
      int wordEnd=word.endOffset();
      int punctLen=wordStart - punctStart;
      if (chunkWordCount == chunkWordOvlpStart) {
        nextChunkStartIdx=accumTextLen + punctLen;
        nextChunkStartNode=curNode;
        nextChunkWordOffset=nodeWordCount;
        nextChunkWordCount=0;
      }
      accumText.append(blurbedTextStr.substring(punctStart,wordEnd));
      punctStart=wordEnd;
      chunkWordCount++;
      nextChunkWordCount++;
      if (!word.termText().equals(Constants.VIRTUAL_WORD)) {
        nodeWordCount++;
        docWordCount++;
      }
      if (chunkWordCount == chunkWordSize) {
        word=result.next();
        mustGetNextWord=false;
        int punctEnd;
        if (word == null)         punctEnd=blurbedText.length();
 else         punctEnd=word.startOffset();
        accumText.append(blurbedTextStr.substring(punctStart,punctEnd));
        trimAccumText(false);
        indexText(section.peek());
        punctStart=punctEnd;
        chunkStartNode=nextChunkStartNode;
        chunkWordOffset=nextChunkWordOffset;
        chunkWordCount=nextChunkWordCount;
        accumText.delete(0,nextChunkStartIdx);
        accumTextLen=trimAccumText(true);
        nextChunkStartIdx=0;
        nextChunkWordCount=0;
      }
 else       accumTextLen=trimAccumText(false);
    }
 catch (    Exception e) {
      Trace.tab();
      Trace.error("String_Node_Str" + e);
      Trace.untab();
      throw new SAXException(e);
    }
catch (    Throwable t) {
      Trace.tab();
      Trace.error("String_Node_Str" + t);
      Trace.untab();
      throw new RuntimeException(t);
    }
  }
  accumText.append(blurbedTextStr.substring(punctStart,blurbedTextStr.length()));
  trimAccumText(false);
}

Fixed version (ground truth):
/** 
 * Process any accumulated source text, writing indexing completed chunks to the Lucene database as necessary. <br><br>
 * @throws SAXException  Any exceptions encountered during the processing ofthe accumulated chunks, or writing them to the Lucene index. <br><br>
 * @.notes This method processes any accumulated text as follows: <blockquote dir=ltr style="MARGIN-RIGHT: 0px"> 1. First the accumulated text is "blurbified." See the {@link XMLTextProcessor#blurbify(StringBuffer,boolean) blurbify()}method for more information about what this entails. <br><br> 2. Next, a chunk is assembled a word at a time from the accumulated text until the required chunk size (in words) is reached. The completed chunk is then added to the Lucene database. <br><br> 3. Step two is repeated until no more complete chunks can be assembled from the accumulated text. (Any partial chunk text is saved until the next call to this method.) </blockquote>
 */
public void flushCharacters() throws SAXException {
  char[] ch=charBuf;
  int length=charBufPos;
  int start=0;
  charBufPos=0;
  int i=0;
  if (indexInfo.stripWhitespace) {
    for (i=0; i < length; i++)     if (!Character.isWhitespace(charBuf[i]))     break;
  }
  if (i == length)   return;
  if (lazyHandler != null)   lazyHandler.characters(ch,start,length);
  incrementNode();
  if (inMeta > 0) {
    String tmp=new String(ch,start,length);
    tmp=mapXMLChars(tmp);
    metaBuf.append(tmp);
    return;
  }
  if (section.indexFlag() == SectionInfo.noIndex)   return;
  blurbedText.setLength(0);
  blurbedText.append(ch,start,length);
  blurbify(blurbedText,true);
  insertVirtualWords(blurbedText);
  if (blurbedText.length() <= 0)   return;
  String blurbedTextStr=blurbedText.toString();
  FastStringReader reader=new FastStringReader(blurbedTextStr);
  TokenStream result=new FastTokenizer(reader);
  int punctStart=0;
  int accumTextLen=trimAccumText(true);
  boolean mustGetNextWord=true;
  Token word=null;
  for (; ; ) {
    try {
      if (mustGetNextWord)       word=result.next();
      if (word == null)       break;
      mustGetNextWord=true;
      if (chunkStartNode < 0) {
        chunkStartNode=curNode;
        chunkWordOffset=nodeWordCount;
      }
      int wordStart=word.startOffset();
      int wordEnd=word.endOffset();
      int punctLen=wordStart - punctStart;
      if (chunkWordCount == chunkWordOvlpStart) {
        nextChunkStartIdx=accumTextLen + punctLen;
        nextChunkStartNode=curNode;
        nextChunkWordOffset=nodeWordCount;
        nextChunkWordCount=0;
      }
      accumText.append(blurbedTextStr.substring(punctStart,wordEnd));
      punctStart=wordEnd;
      chunkWordCount++;
      nextChunkWordCount++;
      if (!word.termText().equals(Constants.VIRTUAL_WORD)) {
        nodeWordCount++;
        docWordCount++;
      }
      if (chunkWordCount == chunkWordSize) {
        word=result.next();
        mustGetNextWord=false;
        int punctEnd;
        if (word == null)         punctEnd=blurbedText.length();
 else         punctEnd=word.startOffset();
        accumText.append(blurbedTextStr.substring(punctStart,punctEnd));
        trimAccumText(false);
        indexText(section.peek());
        punctStart=punctEnd;
        chunkStartNode=nextChunkStartNode;
        chunkWordOffset=nextChunkWordOffset;
        chunkWordCount=nextChunkWordCount;
        accumText.delete(0,nextChunkStartIdx);
        accumTextLen=trimAccumText(true);
        nextChunkStartIdx=0;
        nextChunkWordCount=0;
      }
 else       accumTextLen=trimAccumText(false);
    }
 catch (    Exception e) {
      Trace.tab();
      Trace.error("String_Node_Str" + e);
      Trace.untab();
      throw new SAXException(e);
    }
catch (    Throwable t) {
      Trace.tab();
      Trace.error("String_Node_Str" + t);
      Trace.untab();
      throw new RuntimeException(t);
    }
  }
  accumText.append(blurbedTextStr.substring(punctStart,blurbedTextStr.length()));
  trimAccumText(false);
}