Program: 45231
Project: 45231
Buggy source:
/** 
 * This method attempts to file an article into this category, if it is a leaf category, or attempts to file the article in all the sub-categories, if it is a non-leaf category.
 * @param article      The article to be filed
 * @param numTokens    Number of tokens encountered in the article
 * @param matchCounts  A table of all concepts that matched along withtheir corresponding match counts
 * @return             The hit count for this categoryIf a leaf category, the match count is determined by the filtering rule -- algorithm is not yet publicly documented. If a non-leaf category, the match count is the maximum of match count of its sub-categories
 */
public synchronized Count getMatchCount(final NewsItem article,final int numTokens,final Hashtable matchCounts){
  if (_log.isDebugEnabled())   _log.debug("String_Node_Str" + _name);
  ArrayList<Category> matchedCats=new ArrayList<Category>();
  int matchCount=0;
  if (isLeafCategory()) {
    if (_log.isDebugEnabled())     _log.debug("String_Node_Str" + _name + "String_Node_Str"+ _filter._ruleString+ "String_Node_Str");
    matchCount=_filter.getMatchCount(matchCounts);
    if ((matchCount >= Filter.MIN_REQD_MATCH_COUNT) || ((numTokens < 250) && (matchCount > 0) && (matchCount < Filter.MIN_REQD_MATCH_COUNT))) {
      if (containsArticle(article))       return DEFAULT_COUNT;
      matchedCats.add(this);
    }
  }
 else {
    if (_log.isDebugEnabled())     _log.debug("String_Node_Str" + _name + "String_Node_Str");
    for (    Category subCat : _children) {
      Count subCatCount=subCat.getMatchCount(article,numTokens,matchCounts);
      if (subCatCount.value() > matchCount)       matchCount=subCatCount.value();
      matchedCats.addAll(subCatCount.getMatchedCats());
    }
    if (_log.isDebugEnabled())     _log.debug("String_Node_Str" + _name + "String_Node_Str");
  }
  if (!matchedCats.isEmpty()) {
    _outputFeed.addNewsItem(article,matchedCats);
    _db.addNewsItem(article,this,matchCount);
    _lastUpdateTime=new Date();
    if (_log.isDebugEnabled())     _log.debug("String_Node_Str" + _name);
  }
  final Count retVal=new Count(matchCount,matchedCats);
  matchCounts.put("String_Node_Str" + _name + "String_Node_Str",retVal);
  for (  Category subCat : _children) {
    matchCounts.remove("String_Node_Str" + subCat._name + "String_Node_Str");
  }
  return retVal;
}

Fixed version (ground truth):
/** 
 * This method attempts to file an article into this category, if it is a leaf category, or attempts to file the article in all the sub-categories, if it is a non-leaf category.
 * @param article      The article to be filed
 * @param numTokens    Number of tokens encountered in the article
 * @param matchCounts  A table of all concepts that matched along withtheir corresponding match counts
 * @return             The hit count for this categoryIf a leaf category, the match count is determined by the filtering rule -- algorithm is not yet publicly documented. If a non-leaf category, the match count is the maximum of match count of its sub-categories
 */
public synchronized Count getMatchCount(NewsItem article,int numTokens,Hashtable matchCounts){
  if (_log.isDebugEnabled())   _log.debug("String_Node_Str" + _name);
  ArrayList<Category> matchedCats=new ArrayList<Category>();
  int matchCount=0;
  if (isLeafCategory()) {
    if (_log.isDebugEnabled())     _log.debug("String_Node_Str" + _name + "String_Node_Str"+ _filter._ruleString+ "String_Node_Str");
    matchCount=_filter.getMatchCount(article,numTokens,matchCounts);
    if ((matchCount >= Filter.MIN_REQD_MATCH_COUNT) || ((numTokens < 250) && (matchCount > 0) && (matchCount < Filter.MIN_REQD_MATCH_COUNT))) {
      if (containsArticle(article))       return DEFAULT_COUNT;
      matchedCats.add(this);
    }
  }
 else {
    if (_log.isDebugEnabled())     _log.debug("String_Node_Str" + _name + "String_Node_Str");
    for (    Category subCat : _children) {
      Count subCatCount=subCat.getMatchCount(article,numTokens,matchCounts);
      if (subCatCount.value() > matchCount)       matchCount=subCatCount.value();
      matchedCats.addAll(subCatCount.getMatchedCats());
    }
    if (_log.isDebugEnabled())     _log.debug("String_Node_Str" + _name + "String_Node_Str");
  }
  if (!matchedCats.isEmpty()) {
    _outputFeed.addNewsItem(article,matchedCats);
    _db.addNewsItem(article,this,matchCount);
    _lastUpdateTime=new Date();
    if (_log.isDebugEnabled())     _log.debug("String_Node_Str" + _name);
  }
  final Count retVal=new Count(matchCount,matchedCats);
  matchCounts.put("String_Node_Str" + _name + "String_Node_Str",retVal);
  for (  Category subCat : _children)   matchCounts.remove("String_Node_Str" + subCat._name + "String_Node_Str");
  return retVal;
}