Program: 101404
Project: 101404
Buggy source:
/** 
 * Produces TokenStream instance for tokenizing input text.  First, a language is determined, because a special treatment needs to be taken for Chinese. Then, the individual filters (length, stemming, stopword  removal) are hooked up and the corresponding TokenStream instance is returned.
 * @param fieldName
 * @param reader
 * @return 
 */
@Override public TokenStream tokenStream(String fieldName,Reader reader){
  if (lang == null || !lang.equals("String_Node_Str")) {
    Tokenizer tokenizer=new WikipediaTokenizer(reader);
    TokenStream stream=new StandardFilter(Version.LUCENE_30,tokenizer);
    stream=new LengthFilter(true,stream,3,100);
    stream=new LowerCaseFilter(Version.LUCENE_30,stream);
    if (stopWordSet != null) {
      stream=new StopFilter(Version.LUCENE_30,stream,stopWordSet);
    }
    if (snowballStemmer != null) {
      try {
        Class<SnowballProgram> stemmer=(Class<SnowballProgram>)Class.forName(snowballStemmer);
        stream=new SnowballFilter(stream,stemmer.newInstance());
      }
 catch (      InstantiationException ex) {
        Logger.getLogger(LUCENEWikipediaAnalyzer.class.getName()).log(Level.SEVERE,null,ex);
      }
catch (      IllegalAccessException ex) {
        Logger.getLogger(LUCENEWikipediaAnalyzer.class.getName()).log(Level.SEVERE,null,ex);
      }
catch (      ClassNotFoundException ex) {
        Logger.getLogger(LUCENEWikipediaAnalyzer.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
    return stream;
  }
 else   if (lang.equals("String_Node_Str")) {
    try {
      MediaWikiParserFactory pf=new MediaWikiParserFactory();
      MediaWikiParser parser=pf.createParser();
      StringWriter sw=new StringWriter();
      IOUtils.copy(reader,sw);
      ParsedPage p=parser.parse(sw.toString());
      reader=new StringReader(p.getText());
    }
 catch (    IOException ex) {
      Logger.getLogger(LUCENEWikipediaAnalyzer.class.getName()).log(Level.SEVERE,null,ex);
      reader=new StringReader("String_Node_Str");
    }
    Tokenizer tokenizer=new SentenceTokenizer(reader);
    TokenStream stream=new WordTokenFilter(tokenizer);
    stream=new PorterStemFilter(stream);
    stream=new StopFilter(Version.LUCENE_30,stream,stopWordSet);
    return stream;
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Produces TokenStream instance for tokenizing input text.  First, a language is determined, because a special treatment needs to be taken for Chinese. Then, the individual filters (length, stemming, stopword  removal) are hooked up and the corresponding TokenStream instance is returned.
 * @param fieldName
 * @param reader
 * @return 
 */
@Override public TokenStream tokenStream(String fieldName,Reader reader){
  if (lang == null || !lang.equals("String_Node_Str")) {
    Tokenizer tokenizer=new WikipediaTokenizer(reader);
    TokenStream stream=new StandardFilter(Version.LUCENE_30,tokenizer);
    stream=new LowerCaseFilter(Version.LUCENE_30,stream);
    if (stopWordSet != null) {
      stream=new StopFilter(Version.LUCENE_30,stream,stopWordSet);
    }
    if (snowballStemmer != null) {
      try {
        Class<SnowballProgram> stemmer=(Class<SnowballProgram>)Class.forName(snowballStemmer);
        stream=new SnowballFilter(stream,stemmer.newInstance());
      }
 catch (      InstantiationException ex) {
        Logger.getLogger(LUCENEWikipediaAnalyzer.class.getName()).log(Level.SEVERE,null,ex);
      }
catch (      IllegalAccessException ex) {
        Logger.getLogger(LUCENEWikipediaAnalyzer.class.getName()).log(Level.SEVERE,null,ex);
      }
catch (      ClassNotFoundException ex) {
        Logger.getLogger(LUCENEWikipediaAnalyzer.class.getName()).log(Level.SEVERE,null,ex);
      }
    }
    return stream;
  }
 else   if (lang.equals("String_Node_Str")) {
    try {
      MediaWikiParserFactory pf=new MediaWikiParserFactory();
      MediaWikiParser parser=pf.createParser();
      StringWriter sw=new StringWriter();
      IOUtils.copy(reader,sw);
      ParsedPage p=parser.parse(sw.toString());
      reader=new StringReader(p.getText());
    }
 catch (    IOException ex) {
      Logger.getLogger(LUCENEWikipediaAnalyzer.class.getName()).log(Level.SEVERE,null,ex);
      reader=new StringReader("String_Node_Str");
    }
    Tokenizer tokenizer=new SentenceTokenizer(reader);
    TokenStream stream=new WordTokenFilter(tokenizer);
    stream=new PorterStemFilter(stream);
    stream=new StopFilter(Version.LUCENE_30,stream,stopWordSet);
    return stream;
  }
 else {
    return null;
  }
}