Program: 24668
Project: 24668
Buggy source:
/** 
 * Convert a chunk of contiguous text to a list of tokens, ready for indexing.
 * @param fieldName  The name of the Lucene database field that theresulting tokens will be place in. Used to decide which filters need to be applied to the text.
 * @param reader     A <code>Reader</code> object from which the sourcetext
 * @return A filtered <code>TokenStream</code> containing the tokens that should be indexed by the Lucene database. <br><br>
 */
public TokenStream tokenStream(String fieldName,Reader reader){
  FastStringReader fastReader;
  if (reader instanceof FastStringReader)   fastReader=(FastStringReader)reader;
 else   fastReader=new FastStringReader(reader);
  srcText=fastReader.getString();
  if (facetFields.contains(fieldName))   return new FacetTokenizer(srcText);
  TokenStream result=new FastTokenizer(fastReader);
  result=new StandardFilter(result);
  if (!fieldName.equals("String_Node_Str"))   result=new TagFilter(result,srcText);
  result=new XtfSpecialTokensFilter(result,srcText);
  result=new LowerCaseFilter(result);
  if (spellWriter != null && !misspelledFields.contains(fieldName))   result=new SpellWritingFilter(result,spellWriter);
  if (pluralMap != null)   result=new PluralFoldingFilter(result,pluralMap);
  if (accentMap != null)   result=new AccentFoldingFilter(result,accentMap);
  if (stopSet != null) {
    if (fieldName.equals("String_Node_Str"))     result=new BigramStopFilter(result,stopSet);
 else {
      result=new BigramStopFilter(result,stopSet){
        protected boolean isStopWord(        String word){
          if (word.length() > 0 && word.charAt(0) == Constants.FIELD_START_MARKER)           word=word.substring(1);
          if (word.length() > 0 && word.charAt(word.length() - 1) == Constants.FIELD_END_MARKER)           word=word.substring(0,word.length() - 1);
          return super.isStopWord(word);
        }
      }
;
    }
  }
  if (!fieldName.equals("String_Node_Str"))   result=new StartEndFilter(result);
  return result;
}

Fixed version (ground truth):
/** 
 * Convert a chunk of contiguous text to a list of tokens, ready for indexing.
 * @param fieldName  The name of the Lucene database field that theresulting tokens will be place in. Used to decide which filters need to be applied to the text.
 * @param reader     A <code>Reader</code> object from which the sourcetext
 * @return A filtered <code>TokenStream</code> containing the tokens that should be indexed by the Lucene database. <br><br>
 */
public TokenStream tokenStream(String fieldName,Reader reader){
  FastStringReader fastReader;
  if (reader instanceof FastStringReader)   fastReader=(FastStringReader)reader;
 else   fastReader=new FastStringReader(reader);
  srcText=fastReader.getString();
  if (facetFields.contains(fieldName))   return new FacetTokenizer(srcText);
  TokenStream result=new FastTokenizer(fastReader);
  result=new StandardFilter(result);
  if (!fieldName.equals("String_Node_Str"))   result=new TagFilter(result,srcText);
  result=new XtfSpecialTokensFilter(result,srcText);
  result=new LowerCaseFilter(result);
  if (spellWriter != null && !misspelledFields.contains(fieldName))   result=new SpellWritingFilter(result,spellWriter);
  if (accentMap != null)   result=new AccentFoldingFilter(result,accentMap);
  if (pluralMap != null)   result=new PluralFoldingFilter(result,pluralMap);
  if (stopSet != null) {
    if (fieldName.equals("String_Node_Str"))     result=new BigramStopFilter(result,stopSet);
 else {
      result=new BigramStopFilter(result,stopSet){
        protected boolean isStopWord(        String word){
          if (word.length() > 0 && word.charAt(0) == Constants.FIELD_START_MARKER)           word=word.substring(1);
          if (word.length() > 0 && word.charAt(word.length() - 1) == Constants.FIELD_END_MARKER)           word=word.substring(0,word.length() - 1);
          return super.isStopWord(word);
        }
      }
;
    }
  }
  if (!fieldName.equals("String_Node_Str"))   result=new StartEndFilter(result);
  return result;
}