nus-yam/ex-repair huggingface dataset:
Program: 45196
Project: 45196
Buggy source:
private RuleTerm buildRuleTree(Long termKey,Map<Long,Object[]> rtMap,Map<Long,Object> operandMap){
  Object[] rtVals=rtMap.get(termKey);
  FilterOp op=Filter.getTermType((Integer)rtVals[1]);
switch (op) {
case LEAF_CONCEPT:
    return new Filter.LeafConcept(SQL_Stmt._db.getConcept((Long)rtVals[2]),((Long)rtVals[3]).intValue());
case LEAF_FILTER:
  return new Filter.LeafFilter(SQL_Stmt._db.getFilter((Long)rtVals[2]));
case LEAF_CAT:
return new Filter.LeafCategory(SQL_Stmt._db.getCategory((Long)rtVals[2]));
case NOT_TERM:
return new Filter.NegTerm(buildRuleTree((Long)rtVals[2],rtMap,operandMap));
case CONTEXT_TERM:
return new Filter.ContextTerm(buildRuleTree((Long)rtVals[2],rtMap,operandMap),(List)operandMap.get(termKey));
case AND_TERM:
case OR_TERM:
return new Filter.AndOrTerm(op,buildRuleTree((Long)rtVals[2],rtMap,operandMap),buildRuleTree((Long)rtVals[3],rtMap,operandMap));
case PROXIMITY_TERM:
return new Filter.ProximityTerm(SQL_Stmt._db.getConcept((Long)rtVals[2]),SQL_Stmt._db.getConcept((Long)rtVals[3]),((Long)operandMap.get(termKey)).intValue());
}
SQL_Stmt._log.error("String_Node_Str");
return null;
}

Fixed version (ground truth):
private RuleTerm buildRuleTree(Long termKey,Map<Long,Object[]> rtMap,Map<Long,Object> operandMap){
  Object[] rtVals=rtMap.get(termKey);
  FilterOp op=Filter.getTermType((Integer)rtVals[1]);
switch (op) {
case LEAF_CONCEPT:
    return new Filter.LeafConcept(SQL_Stmt._db.getConcept((Long)rtVals[2]),((Long)rtVals[3]).intValue());
case LEAF_FILTER:
  return new Filter.LeafFilter(SQL_Stmt._db.getFilter((Long)rtVals[2]));
case SOURCE_FILTER:
return new Filter.SourceFilter((NR_SourceCollection)SQL_Stmt.GET_COLLECTION_BY_KEY.get((Long)rtVals[2]));
case LEAF_CAT:
return new Filter.LeafCategory(SQL_Stmt._db.getCategory((Long)rtVals[2]));
case NOT_TERM:
return new Filter.NegTerm(buildRuleTree((Long)rtVals[2],rtMap,operandMap));
case CONTEXT_TERM:
return new Filter.ContextTerm(buildRuleTree((Long)rtVals[2],rtMap,operandMap),(List)operandMap.get(termKey));
case AND_TERM:
case OR_TERM:
return new Filter.AndOrTerm(op,buildRuleTree((Long)rtVals[2],rtMap,operandMap),buildRuleTree((Long)rtVals[3],rtMap,operandMap));
case PROXIMITY_TERM:
return new Filter.ProximityTerm(SQL_Stmt._db.getConcept((Long)rtVals[2]),SQL_Stmt._db.getConcept((Long)rtVals[3]),((Long)operandMap.get(termKey)).intValue());
}
SQL_Stmt._log.error("String_Node_Str");
return null;
}
Program: 45198
Project: 45198
Buggy source:
/** 
 * Record a classified news item!
 * @param ni   News Item that has been classified in category c
 * @param c    Category into which ni has been classified
 * @param matchCount  Match weight
 */
public abstract void addNewsItem(NewsItem ni,Category c,int matchCount);

Fixed version (ground truth):
/** 
 * Record a classified news item!
 * @param ni    News Item that has been classified in category c
 * @param c     Category into which ni has been classified
 * @param score Match score
 */
public abstract void addNewsItem(NewsItem ni,Category c,int score);
Program: 45199
Project: 45199
Buggy source:
/** 
 * Record a classified news item!
 * @param ni   News Item that has been classified in category c
 * @param c    Category into which ni has been classified
 * @param matchCount  Match weight
 */
public void addNewsItem(NewsItem ni,Category cat,int matchCount){
  if (cat.isLeafCategory()) {
    SQL_NewsItem sni=(SQL_NewsItem)ni;
    if (!sni.inTheDB())     _log.error("String_Node_Str" + sni + "String_Node_Str");
    SQL_NewsIndex idx=sni.getNewsIndex();
    INSERT_INTO_CAT_NEWS_TABLE.execute(new Object[]{cat.getKey(),sni.getKey(),idx.getKey(),idx.getCreationTime()});
    cat.setNumArticles(1 + cat.getNumArticles());
    List<Category> l=_leafCatsToCommit.get(cat.getIssue().getKey());
    if (l == null) {
      l=new ArrayList<Category>();
      _leafCatsToCommit.put(cat.getIssue().getKey(),l);
    }
    l.add(cat);
  }
}

Fixed version (ground truth):
/** 
 * Record a classified news item!
 * @param ni    News Item that has been classified in category c
 * @param c     Category into which ni has been classified
 * @param score Match score
 */
public void addNewsItem(NewsItem ni,Category cat,int score){
  if (cat.isLeafCategory()) {
    SQL_NewsItem sni=(SQL_NewsItem)ni;
    if (!sni.inTheDB())     _log.error("String_Node_Str" + sni + "String_Node_Str");
    SQL_NewsIndex idx=sni.getNewsIndex();
    INSERT_INTO_CAT_NEWS_TABLE.execute(new Object[]{cat.getKey(),sni.getKey(),idx.getKey(),idx.getCreationTime()});
    cat.setNumArticles(1 + cat.getNumArticles());
    List<Category> l=_leafCatsToCommit.get(cat.getIssue().getKey());
    if (l == null) {
      l=new ArrayList<Category>();
      _leafCatsToCommit.put(cat.getIssue().getKey(),l);
    }
    l.add(cat);
  }
}
Program: 45200
Project: 45200
Buggy source:
public String getNewsInfo(){
  String uidList=getApiParamValue("String_Node_Str",true);
  String uid=getApiParamValue("String_Node_Str",true);
  String tname=getApiParamValue("String_Node_Str",true);
  if (tname == null)   tname=getApiParamValue("String_Node_Str",true);
  String url=_req.getQueryString().replaceAll("String_Node_Str","String_Node_Str");
  newsrack.util.URLCanonicalizer.canonicalize(url);
  _newsItem=NewsItem.getNewsItemFromURL(url);
  if (_newsItem == null) {
    _errMsg=getText("String_Node_Str");
    return Action.ERROR;
  }
  List<Category> allCats=_newsItem.getCategories();
  _cats=new ArrayList<Category>();
  if ((uid == null) && (uidList == null)) {
    _cats=allCats;
  }
 else   if (uidList != null) {
    String[] uids=uidList.split("String_Node_Str");
    for (int i=0; i < uids.length; i++)     uids[i]=uids[i].trim();
    for (    Category c : allCats) {
      String catUid=c.getUser().getUid();
      for (      String u : uids) {
        if (u.equals(catUid)) {
          _cats.add(c);
          break;
        }
      }
    }
  }
 else {
    for (    Category c : allCats) {
      if (uid.equals(c.getUser().getUid()) && ((tname == null) || tname.equals(c.getIssue().getName())))       _cats.add(c);
    }
  }
  return apiSuccess();
}

Fixed version (ground truth):
public String getNewsInfo(){
  String uidList=getApiParamValue("String_Node_Str",true);
  String uid=getApiParamValue("String_Node_Str",true);
  String tname=getApiParamValue("String_Node_Str",true);
  if (tname == null)   tname=getApiParamValue("String_Node_Str",true);
  String url=_req.getQueryString().replaceAll("String_Node_Str","String_Node_Str");
  _log.info("String_Node_Str" + _req.getQueryString() + "String_Node_Str"+ url);
  newsrack.util.URLCanonicalizer.canonicalize(url);
  _newsItem=NewsItem.getNewsItemFromURL(url);
  if (_newsItem == null) {
    _errMsg=getText("String_Node_Str");
    return Action.ERROR;
  }
  List<Category> allCats=_newsItem.getCategories();
  _cats=new ArrayList<Category>();
  if ((uid == null) && (uidList == null)) {
    _cats=allCats;
  }
 else   if (uidList != null) {
    String[] uids=uidList.split("String_Node_Str");
    for (int i=0; i < uids.length; i++)     uids[i]=uids[i].trim();
    for (    Category c : allCats) {
      String catUid=c.getUser().getUid();
      for (      String u : uids) {
        if (u.equals(catUid)) {
          _cats.add(c);
          break;
        }
      }
    }
  }
 else {
    for (    Category c : allCats) {
      if (uid.equals(c.getUser().getUid()) && ((tname == null) || tname.equals(c.getIssue().getName())))       _cats.add(c);
    }
  }
  return apiSuccess();
}
Program: 45201
Project: 45201
Buggy source:
public static void revalidateUsers(Long ukey){
  if (ukey == null) {
    List<Long> ukeys_1=(List<Long>)SQL_StmtExecutor.query("String_Node_Str",new SQL_ValType[]{},new Object[]{},SQL_StmtExecutor._longProcessor,false);
    for (    Long k : ukeys_1)     _db.getUser(k).invalidateAllIssues();
    for (    Long k : ukeys_1) {
      User u=_db.getUser(k);
      try {
        u.validateAllIssues(false);
      }
 catch (      Exception e) {
        System.out.println("String_Node_Str" + e + "String_Node_Str"+ u.getName());
      }
    }
  }
 else {
    try {
      _db.getUser(ukey).invalidateAllIssues();
      _db.getUser(ukey).validateAllIssues(false);
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str" + e + "String_Node_Str"+ ukey);
    }
  }
}

Fixed version (ground truth):
public static void revalidateUsers(Long ukey){
  if (ukey == null) {
    List<Long> ukeys_1=(List<Long>)SQL_StmtExecutor.query("String_Node_Str",new SQL_ValType[]{},new Object[]{},SQL_StmtExecutor._longProcessor,false);
    for (    Long k : ukeys_1)     _db.getUser(k).invalidateAllIssues();
    for (    Long k : ukeys_1) {
      User u=_db.getUser(k);
      try {
        u.validateAllIssues(false);
      }
 catch (      Exception e) {
        System.out.println("String_Node_Str" + e + "String_Node_Str"+ u.getName());
      }
catch (      Error e) {
        System.out.println("String_Node_Str" + e + "String_Node_Str"+ u.getName());
      }
    }
  }
 else {
    try {
      _db.getUser(ukey).invalidateAllIssues();
      _db.getUser(ukey).validateAllIssues(false);
    }
 catch (    Exception e) {
      System.out.println("String_Node_Str" + e + "String_Node_Str"+ ukey);
    }
  }
}
Program: 45202
Project: 45202
Buggy source:
private void removeFile(final String f){
  if (_files == null)   loadUserFilesFromDB();
  for (  UserFile uf : _files) {
    if (uf.getName().equals(f)) {
      _files.remove(f);
      _db.deleteFile(uf);
    }
  }
}

Fixed version (ground truth):
private void removeFile(final String f){
  if (_files == null)   loadUserFilesFromDB();
  for (  UserFile uf : _files) {
    if (uf.getName().equals(f)) {
      _files.remove(uf);
      _db.deleteFile(uf);
    }
  }
}
Program: 45203
Project: 45203
Buggy source:
public String getNewsInfo(){
  String url=getApiParamValue("String_Node_Str",false);
  String uidList=getApiParamValue("String_Node_Str",true);
  String uid=getApiParamValue("String_Node_Str",true);
  String tname=getApiParamValue("String_Node_Str",true);
  if (tname == null)   tname=getApiParamValue("String_Node_Str",true);
  url=newsrack.util.URLCanonicalizer.canonicalize(url);
  _newsItem=NewsItem.getNewsItemFromURL(url);
  if (_newsItem == null) {
    _errMsg=getText("String_Node_Str");
    return Action.ERROR;
  }
  List<Category> allCats=_newsItem.getCategories();
  _cats=new ArrayList<Category>();
  if ((uid == null) && (uidList == null)) {
    _cats=allCats;
  }
 else   if (uidList != null) {
    String[] uids=uidList.split("String_Node_Str");
    for (int i=0; i < uids.length; i++)     uids[i]=uids[i].trim();
    for (    Category c : allCats) {
      String catUid=c.getUser().getUid();
      for (      String u : uids) {
        if (u.equals(catUid)) {
          _cats.add(c);
          break;
        }
      }
    }
  }
 else {
    for (    Category c : allCats) {
      if (uid.equals(c.getUser().getUid()) && ((tname == null) || tname.equals(c.getIssue().getName())))       _cats.add(c);
    }
  }
  return apiSuccess();
}

Fixed version (ground truth):
public String getNewsInfo(){
  String uidList=getApiParamValue("String_Node_Str",true);
  String uid=getApiParamValue("String_Node_Str",true);
  String tname=getApiParamValue("String_Node_Str",true);
  if (tname == null)   tname=getApiParamValue("String_Node_Str",true);
  String url=_req.getQueryString().replaceAll("String_Node_Str","String_Node_Str");
  newsrack.util.URLCanonicalizer.canonicalize(url);
  _newsItem=NewsItem.getNewsItemFromURL(url);
  if (_newsItem == null) {
    _errMsg=getText("String_Node_Str");
    return Action.ERROR;
  }
  List<Category> allCats=_newsItem.getCategories();
  _cats=new ArrayList<Category>();
  if ((uid == null) && (uidList == null)) {
    _cats=allCats;
  }
 else   if (uidList != null) {
    String[] uids=uidList.split("String_Node_Str");
    for (int i=0; i < uids.length; i++)     uids[i]=uids[i].trim();
    for (    Category c : allCats) {
      String catUid=c.getUser().getUid();
      for (      String u : uids) {
        if (u.equals(catUid)) {
          _cats.add(c);
          break;
        }
      }
    }
  }
 else {
    for (    Category c : allCats) {
      if (uid.equals(c.getUser().getUid()) && ((tname == null) || tname.equals(c.getIssue().getName())))       _cats.add(c);
    }
  }
  return apiSuccess();
}
Program: 45204
Project: 45204
Buggy source:
public Issue getIssue(User u,String issueName){
  String key=u.getUid() + "String_Node_Str" + issueName;
  Issue i=(Issue)_cache.get("String_Node_Str",key);
  if (i == null) {
    i=(Issue)GET_ISSUE_BY_USER_KEY.execute(new Object[]{u.getKey(),issueName});
    if (i != null) {
      _cache.add("String_Node_Str",u.getKey(),key,i);
      _cache.add("String_Node_Str",u.getKey(),i.getKey(),i);
      i.setUser(u);
    }
  }
  return i;
}

Fixed version (ground truth):
public Issue getIssue(User u,String issueName){
  String key=getSecondaryIssueKey(u,issueName);
  Issue i=(Issue)_cache.get("String_Node_Str",key);
  if (i == null) {
    i=(Issue)GET_ISSUE_BY_USER_KEY.execute(new Object[]{u.getKey(),issueName});
    if (i != null) {
      i.setUser(u);
      addIssueToCache(i);
    }
  }
  return i;
}
Program: 45205
Project: 45205
Buggy source:
public void readInCurrentRSSFeed(){
  final File feedFile=new File(_feedFileName);
  if (!feedFile.exists()) {
    IOUtils.createDir(_rssDir);
    createNewRSSFeed();
    publish();
  }
 else {
    try {
      _rssFeed=(new SyndFeedInput()).build(new XmlReader(feedFile));
      _feedItems=(ArrayList)_rssFeed.getEntries();
    }
 catch (    final Exception e) {
      _log.error("String_Node_Str" + _feedFileName,e);
    }
    rssFeedRomeWorkaround_FIXME(_rssFeed,_title,_url,_desc);
  }
}

Fixed version (ground truth):
public void readInCurrentRSSFeed(){
  final File feedFile=new File(_feedFileName);
  if (!feedFile.exists() || (feedFile.exists() && (feedFile.length() == 0))) {
    IOUtils.createDir(_rssDir);
    createNewRSSFeed();
    publish();
  }
 else {
    try {
      _rssFeed=(new SyndFeedInput()).build(new XmlReader(feedFile));
      _feedItems=(ArrayList)_rssFeed.getEntries();
    }
 catch (    final Exception e) {
      _log.error("String_Node_Str" + _feedFileName,e);
    }
    rssFeedRomeWorkaround_FIXME(_rssFeed,_title,_url,_desc);
  }
}
Program: 45206
Project: 45206
Buggy source:
/** 
 * This method returns a character reader for displaying a news item that has been archived in the local installation of News Rack.
 * @param niPath  Path of the news item relative to the news archive.
 * @return Returns a reader object for reading the news item
 */
public Reader getNewsItemReader(NewsItem ni) throws java.io.IOException {
  if (ni.getKey() == null) {
    _log.error("String_Node_Str" + ni.getURL() + "String_Node_Str");
    return null;
  }
  String[] dateStr=ni.getDateString().split("String_Node_Str");
  String pathPrefix=GLOBAL_NEWS_ARCHIVE_DIR + "String_Node_Str" + File.separator+ dateStr[2]+ File.separator+ dateStr[1]+ File.separator+ dateStr[0];
  String localName=((SQL_NewsItem)ni).getLocalFileName();
  String fullPath=pathPrefix + File.separator + ni.getFeed().getTag()+ File.separator+ localName;
  if ((new File(fullPath)).isFile())   return IOUtils.getUTF8Reader(fullPath);
  List<Long> allFeedKeys=(List<Long>)GET_ALL_FEEDS_FOR_NEWS.get(ni.getKey());
  Reader r=getReader(pathPrefix,localName,allFeedKeys);
  if (r == null)   r=getReader(pathPrefix,StringUtils.getBaseFileName(ni.getURL()),allFeedKeys);
  if (r == null)   r=getReader(pathPrefix,(String)GET_NEWS_ITEM_LOCALNAME.get(ni.getKey()),allFeedKeys);
  if (r != null)   return r;
 else   throw new java.io.FileNotFoundException();
}

Fixed version (ground truth):
/** 
 * This method returns a character reader for displaying a news item that has been archived in the local installation of News Rack.
 * @param niPath  Path of the news item relative to the news archive.
 * @return Returns a reader object for reading the news item
 */
public Reader getNewsItemReader(NewsItem ni) throws java.io.IOException {
  if (ni.getKey() == null) {
    _log.error("String_Node_Str" + ni.getURL() + "String_Node_Str");
    return null;
  }
  String[] dateStr=ni.getDateString().split("String_Node_Str");
  String pathPrefix=GLOBAL_NEWS_ARCHIVE_DIR + "String_Node_Str" + File.separator+ dateStr[2]+ File.separator+ dateStr[1]+ File.separator+ dateStr[0];
  String localName=((SQL_NewsItem)ni).getLocalFileName();
  String fullPath=pathPrefix + File.separator + ni.getFeed().getTag()+ File.separator+ localName;
  if ((new File(fullPath)).isFile())   return IOUtils.getUTF8Reader(fullPath);
  List<Long> allFeedKeys=(List<Long>)GET_ALL_FEEDS_FOR_NEWS.get(ni.getKey());
  Reader r=getReader(pathPrefix,localName,allFeedKeys);
  if (r == null)   r=getReader(pathPrefix,(String)GET_NEWS_ITEM_LOCALNAME.get(ni.getKey()),allFeedKeys);
  if (r == null)   r=getReader(pathPrefix,StringUtils.getBaseFileName(ni.getURL()),allFeedKeys);
  if (r != null)   return r;
 else   throw new java.io.FileNotFoundException();
}
Program: 45207
Project: 45207
Buggy source:
public String execute(){
  String uid=getParam("String_Node_Str");
  String pass=getParam("String_Node_Str");
  try {
    User u=User.signInUser(uid,pass);
    _session.put(NewsRack.UID_KEY,u.getUid());
    _session.put(NewsRack.USER_KEY,u);
    _log.info("String_Node_Str" + uid);
    if (u.isAdmin())     return "String_Node_Str";
 else     return Action.SUCCESS;
  }
 catch (  UnknownUserException e) {
    addFieldError("String_Node_Str",getText("String_Node_Str",new String[]{uid}));
    return Action.INPUT;
  }
catch (  InvalidPasswordException e) {
    addFieldError("String_Node_Str",getText("String_Node_Str"));
    return Action.INPUT;
  }
}

Fixed version (ground truth):
public String execute(){
  String uid=getParam("String_Node_Str");
  String pass=getParam("String_Node_Str");
  try {
    User u=User.signInUser(uid,pass);
    _session.put(NewsRack.UID_KEY,u.getUid());
    _session.put(NewsRack.USER_KEY,u);
    newsrack.database.DB_Interface dbi=NewsRack.getDBInterface();
    dbi.updateUserAttribute(u,dbi.LAST_LOGIN,new java.util.Date());
    _log.info("String_Node_Str" + uid);
    if (u.isAdmin())     return "String_Node_Str";
 else     return Action.SUCCESS;
  }
 catch (  UnknownUserException e) {
    addFieldError("String_Node_Str",getText("String_Node_Str",new String[]{uid}));
    return Action.INPUT;
  }
catch (  InvalidPasswordException e) {
    addFieldError("String_Node_Str",getText("String_Node_Str"));
    return Action.INPUT;
  }
}
Program: 45209
Project: 45209
Buggy source:
/** 
 * This method goes through the entire news archive and fetches news indexes for a desired news source.  Note that for the same news source, multiple indexes can be returned.  This can happen, for instance, when the news archive is organized by date, and so, the iterator will return one news index for each date.
 * @param s   Source for which news indexes have to be fetched
 * @param sd  Start date (inclusive) from which indexes have to be fetched(in format yyyymmdd)
 * @param ed  End date (inclusive) beyond which indexes should not be fetched(in format yyyymmdd)
 */
public abstract Iterator<? extends NewsIndex> getIndexesOfAllArchivedNews(Source s,String sd,String ed);

Fixed version (ground truth):
/** 
 * This method goes through the entire news archive and fetches news indexes for a desired news source.  Note that for the same news source, multiple indexes can be returned.  This can happen, for instance, when the news archive is organized by date, and so, the iterator will return one news index for each date.
 * @param s   Source for which news indexes have to be fetched
 * @param sd  Start date (inclusive) from which indexes have to be fetched
 * @param ed  End date (inclusive) beyond which indexes should not be fetched
 */
public abstract Iterator<? extends NewsIndex> getIndexesOfAllArchivedNews(Source s,Date sd,Date ed);
Program: 45210
Project: 45210
Buggy source:
abstract public Timestamp getCreationTime();

Fixed version (ground truth):
abstract public Date getCreationTime();
Program: 45211
Project: 45211
Buggy source:
private Long getNewsIndexKey(Long feedKey,String dateStr){
  String cacheKey="String_Node_Str" + feedKey + "String_Node_Str"+ dateStr;
  Long niKey=(Long)_cache.get(cacheKey,SQL_NewsIndex.class);
  if (niKey == null) {
    niKey=(Long)GET_NEWS_INDEX_KEY.execute(new Object[]{feedKey,dateStr});
    if (niKey != null)     _cache.add((Long)null,cacheKey,Long.class,niKey);
  }
  return niKey;
}

Fixed version (ground truth):
private Long getNewsIndexKey(Long feedKey,String dateStr){
  String[] dateParts=dateStr.split("String_Node_Str");
  dateStr=((new StringBuffer(dateParts[2])).append('-').append(dateParts[1]).append('-').append(dateParts[0])).toString();
  String cacheKey="String_Node_Str" + feedKey + "String_Node_Str"+ dateStr;
  Long niKey=(Long)_cache.get(cacheKey,SQL_NewsIndex.class);
  if (niKey == null) {
    niKey=(Long)GET_NEWS_INDEX_KEY.execute(new Object[]{feedKey,dateStr});
    if (niKey != null)     _cache.add((Long)null,cacheKey,Long.class,niKey);
  }
  return niKey;
}
Program: 45212
Project: 45212
Buggy source:
/** 
 * This method goes through the entire news archive and fetches news index files for a desired news source.  Note that for the same news source, multiple index files can be returned.  This can happen, for instance, when the news archive is organized by date, and so, the iterator will return one news index file for each date.
 * @param s   Source for which news indexes have to be fetched
 * @param sd  Start date (inclusive) from which index files have to be fetched(in format yyyymmdd)
 * @param ed  End date (inclusive) beyond which index files should not be fetched(in format yyyymmdd)
 */
public Iterator<? extends NewsIndex> getIndexesOfAllArchivedNews(Source s,String sd,String ed){
  if (_log.isInfoEnabled()) {
    _log.info("String_Node_Str" + sd);
    _log.info("String_Node_Str" + ed);
  }
  List<NewsIndex> res=new ArrayList<NewsIndex>();
  List<SQL_NewsIndex> nis=(List<SQL_NewsIndex>)GET_ALL_NEWS_INDEXES_FROM_FEED_ID.get(s.getFeed().getKey());
  for (  SQL_NewsIndex si : nis) {
    String[] flds=si.getDateString().split("String_Node_Str");
    if (inBetweenDates(flds[2],flds[1],flds[0],sd,ed)) {
      res.add(new SQL_NewsIndex(si.getKey()));
    }
  }
  return res.iterator();
}

Fixed version (ground truth):
/** 
 * This method goes through the entire news archive and fetches news index files for a desired news source.  Note that for the same news source, multiple index files can be returned.  This can happen, for instance, when the news archive is organized by date, and so, the iterator will return one news index file for each date.
 * @param s   Source for which news indexes have to be fetched
 * @param sd  Start date (inclusive) from which index files have to be fetched
 * @param ed  End date (inclusive) beyond which index files should not be fetched
 */
public Iterator<? extends NewsIndex> getIndexesOfAllArchivedNews(Source s,Date sd,Date ed){
  if (_log.isInfoEnabled()) {
    _log.info("String_Node_Str" + sd);
    _log.info("String_Node_Str" + ed);
  }
  return ((List<SQL_NewsIndex>)GET_ALL_NEWS_INDEXES_BETWEEN_DATES_FROM_FEED_ID.execute(new Object[]{s.getFeed().getKey(),new java.sql.Date(sd.getTime()),new java.sql.Date(ed.getTime())})).iterator();
}
Program: 45213
Project: 45213
Buggy source:
private static boolean inBetweenDates(String ddy,String ddm,String ddd,String stDate,String endDate){
  if (ddd.length() == 1)   ddd="String_Node_Str" + ddd;
  if (ddm.length() == 1)   ddm="String_Node_Str" + ddm;
  String dirDate=ddy + ddm + ddd;
  int dDate=Integer.parseInt(dirDate);
  int sDate=Integer.parseInt(stDate);
  int eDate=Integer.parseInt(endDate);
  boolean retVal=(sDate <= dDate) && (dDate <= eDate);
  return retVal;
}

Fixed version (ground truth):
private static boolean inBetweenDates(String ddy,String ddm,String ddd,String stDate,String endDate){
  if (ddd.length() == 1)   ddd="String_Node_Str" + ddd;
  if (ddm.length() == 1)   ddm="String_Node_Str" + ddm;
  String dirDate=ddy + ddm + ddd;
  int dDate=Integer.parseInt(dirDate);
  int sDate=Integer.parseInt(stDate);
  int eDate=Integer.parseInt(endDate);
  return (sDate <= dDate) && (dDate <= eDate);
}
Program: 45214
Project: 45214
Buggy source:
public List<NewsItem> getNews(Issue i,Date start,Date end,int startId,int numArts){
  List<NewsItem> news=new ArrayList<NewsItem>();
  List<Long> keys;
  if (start == null)   keys=(List<Long>)GET_NEWS_KEYS_FROM_ISSUE.execute(new Object[]{i.getKey(),startId,numArts});
 else   keys=(List<Long>)GET_NEWS_KEYS_FROM_ISSUE_BETWEEN_DATES.execute(new Object[]{i.getKey(),new Timestamp(start.getTime()),new Timestamp(end.getTime()),startId,numArts});
  for (  Long k : keys)   news.add(getNewsItem(k));
  return news;
}

Fixed version (ground truth):
public List<NewsItem> getNews(Issue i,Date start,Date end,int startId,int numArts){
  List<NewsItem> news=new ArrayList<NewsItem>();
  List<Long> keys;
  if (start == null)   keys=(List<Long>)GET_NEWS_KEYS_FROM_ISSUE.execute(new Object[]{i.getKey(),startId,numArts});
 else   keys=(List<Long>)GET_NEWS_KEYS_FROM_ISSUE_BETWEEN_DATES.execute(new Object[]{i.getKey(),new java.sql.Date(start.getTime()),new java.sql.Date(end.getTime()),startId,numArts});
  for (  Long k : keys)   news.add(getNewsItem(k));
  return news;
}
Program: 45215
Project: 45215
Buggy source:
public void reclassifyNews(Source s,boolean allDates,String sd,String ed){
  getUser();
  super.reclassifyNews(s,allDates,sd,ed);
}

Fixed version (ground truth):
public void reclassifyNews(Source s,boolean allDates,Date sd,Date ed){
  getUser();
  super.reclassifyNews(s,allDates,sd,ed);
}
Program: 45216
Project: 45216
Buggy source:
public Timestamp getCreationTime(){
  return _createdAt;
}

Fixed version (ground truth):
public Date getCreationTime(){
  return _createdAt;
}
Program: 45217
Project: 45217
Buggy source:
public SQL_NewsIndex(Long key,Long feedKey,String dateString){
  _niKey=key;
  _feedKey=feedKey;
  _dateString=dateString;
}

Fixed version (ground truth):
public SQL_NewsIndex(Long key,Long feedKey,Date d){
  _niKey=key;
  _feedKey=feedKey;
  _createdAt=d;
}
Program: 45218
Project: 45218
Buggy source:
public SQL_NewsItem(String urlRoot,String urlTail,String title,String desc,String author,Long feedKey,String date){
  String baseName=SQL_DB._sqldb.getBaseNameForArticle(urlRoot + urlTail);
  init(urlRoot,urlTail,baseName);
  setTitle(title);
  setDescription(desc);
  setDate(date);
  setAuthor(author);
  _feedKey=feedKey;
}

Fixed version (ground truth):
public SQL_NewsItem(String urlRoot,String urlTail,String title,String desc,String author,Long feedKey,Date d){
  String baseName=SQL_DB._sqldb.getBaseNameForArticle(urlRoot + urlTail);
  init(urlRoot,urlTail,baseName);
  setTitle(title);
  setDescription(desc);
  setDate(d);
  setAuthor(author);
  _feedKey=feedKey;
}
Program: 45219
Project: 45219
Buggy source:
public Object processResultSet(ResultSet rs) throws java.sql.SQLException {
  String urlRoot=rs.getString(3);
  String urlTail=rs.getString(4);
  String title=rs.getString(5);
  String desc=rs.getString(6);
  String author=rs.getString(7);
  String dateStr=rs.getString(8);
  Long feedKey=rs.getLong(9);
  SQL_NewsItem ni=new SQL_NewsItem(urlRoot,urlTail,title,desc,author,feedKey,dateStr);
  ni.setKey(rs.getLong(1));
  ni.setNewsIndexKey(rs.getLong(2));
  return ni;
}

Fixed version (ground truth):
public Object processResultSet(ResultSet rs) throws java.sql.SQLException {
  String urlRoot=rs.getString(3);
  String urlTail=rs.getString(4);
  String title=rs.getString(5);
  String desc=rs.getString(6);
  String author=rs.getString(7);
  Date date=rs.getDate(8);
  Long feedKey=rs.getLong(9);
  SQL_NewsItem ni=new SQL_NewsItem(urlRoot,urlTail,title,desc,author,feedKey,date);
  ni.setKey(rs.getLong(1));
  ni.setNewsIndexKey(rs.getLong(2));
  return ni;
}
Program: 45220
Project: 45220
Buggy source:
/** 
 * public because the xml digester requires the methods to be public
 */
public static void recordDomain(String domain){
  domain=normalizeURL(domain);
  _domainsWithoutCachedTextDisplay.add(domain);
  _log.info("String_Node_Str" + domain);
}

Fixed version (ground truth):
/** 
 * public because the xml digester requires the methods to be public
 */
public static void recordDomain(String domain){
  domain=normalizeURL(domain);
  _domainsWithoutCachedTextDisplay.add(domain);
  _log.debug("String_Node_Str" + domain);
}
Program: 45221
Project: 45221
Buggy source:
/** 
 * public because the xml digester requires the methods to be public
 */
public static void recordFeed(String feed){
  feed=normalizeURL(feed);
  _feedsWithoutCachedTextDisplay.add(feed);
  _log.info("String_Node_Str" + feed);
}

Fixed version (ground truth):
/** 
 * public because the xml digester requires the methods to be public
 */
public static void recordFeed(String feed){
  feed=normalizeURL(feed);
  _feedsWithoutCachedTextDisplay.add(feed);
  _log.debug("String_Node_Str" + feed);
}
Program: 45223
Project: 45223
Buggy source:
public Source getSourceById(String tag){
  return _db.getSource(this,tag);
}

Fixed version (ground truth):
public Source getSourceById(String tag){
  _log.info("String_Node_Str" + tag);
  return _db.getSource(this,tag);
}
Program: 45224
Project: 45224
Buggy source:
public void setUploadedFile(File f){
  _uploadedFile=f;
}

Fixed version (ground truth):
public void setUploadedFile(File f){
  _log.info("String_Node_Str" + f);
  _uploadedFile=f;
}
Program: 45225
Project: 45225
Buggy source:
public void setUploadedFileName(String n){
  _file=n;
}

Fixed version (ground truth):
public void setUploadedFileName(String n){
  _log.info("String_Node_Str" + n);
  _file=n;
}
Program: 45226
Project: 45226
Buggy source:
public void setUploadedContentType(String ct){
  _uploadedContentType=ct;
}

Fixed version (ground truth):
public void setUploadedContentType(String ct){
  _log.info("String_Node_Str" + ct);
  _uploadedContentType=ct;
}
Program: 45227
Project: 45227
Buggy source:
public List<Category> getChildren(){
  List<Category> children=super.getChildren();
  if (!isLeafCategory() && children.isEmpty()) {
    children=new ArrayList<Category>();
    List<Long> childKeys=(List<Long>)SQL_Stmt.GET_NESTED_CAT_KEYS.get(getKey());
    for (    Long k : childKeys) {
      Category c=SQL_DB._sqldb.getCategory(k);
      c.setParent(this);
      c.setIssue(this.getIssue());
      children.add(c);
    }
    setChildren(children);
  }
  return children;
}

Fixed version (ground truth):
public List<Category> getChildren(){
  List<Category> children=super.getChildren();
  if (isLeafCategory() || !children.isEmpty())   return children;
synchronized (this) {
    children=super.getChildren();
    if (isLeafCategory() || !children.isEmpty())     return children;
    children=new ArrayList<Category>();
    List<Long> childKeys=(List<Long>)SQL_Stmt.GET_NESTED_CAT_KEYS.get(getKey());
    for (    Long k : childKeys) {
      Category c=SQL_DB._sqldb.getCategory(k);
      c.setParent(this);
      c.setIssue(this.getIssue());
      children.add(c);
    }
    setChildren(children);
    return children;
  }
}
Program: 45228
Project: 45228
Buggy source:
public Collection<Category> getCategories(){
  Collection<Category> topLevelCats;
  if (_loaded) {
    topLevelCats=super.getCategories();
  }
 else {
    getUser();
    topLevelCats=new ArrayList<Category>();
    List<Long> catKeys=(List<Long>)SQL_Stmt.GET_CAT_KEYS_FOR_ISSUE.get(getKey());
    for (    Long k : catKeys) {
      Category c=SQL_DB._sqldb.getCategory(k);
      c.setIssue(this);
      if (c.isTopLevelCategory())       topLevelCats.add(c);
    }
    _loaded=true;
    super.addCategories(topLevelCats);
  }
  return topLevelCats;
}

Fixed version (ground truth):
public Collection<Category> getCategories(){
  if (_loaded)   return super.getCategories();
synchronized (this) {
    if (_loaded)     return super.getCategories();
    getUser();
    Collection<Category> topLevelCats=new ArrayList<Category>();
    List<Long> catKeys=(List<Long>)SQL_Stmt.GET_CAT_KEYS_FOR_ISSUE.get(getKey());
    for (    Long k : catKeys) {
      Category c=SQL_DB._sqldb.getCategory(k);
      c.setIssue(this);
      if (c.isTopLevelCategory())       topLevelCats.add(c);
    }
    _loaded=true;
    super.setCategories(topLevelCats);
    return topLevelCats;
  }
}
Program: 45229
Project: 45229
Buggy source:
public Collection<Source> getMonitoredSources(){
  Collection<Source> srcs=super.getMonitoredSources();
  if (srcs == null) {
    srcs=(List<Source>)SQL_Stmt.GET_MONITORED_SOURCES_FOR_TOPIC.execute(new Object[]{getKey()});
    super.addSources(srcs);
  }
  return srcs;
}

Fixed version (ground truth):
public Collection<Source> getMonitoredSources(){
  Collection<Source> srcs=super.getMonitoredSources();
  if (srcs == null) {
synchronized (this) {
      srcs=super.getMonitoredSources();
      if (srcs == null) {
        srcs=(List<Source>)SQL_Stmt.GET_MONITORED_SOURCES_FOR_TOPIC.execute(new Object[]{getKey()});
        super.addSources(srcs);
      }
    }
  }
  return srcs;
}
Program: 45230
Project: 45230
Buggy source:
public void addCategories(Collection<Category> cats){
  _topLevelCats=new ArrayList<Category>();
  _topLevelCats.addAll(cats);
  _taxonomyPath=_user.getUid() + File.separator + StringUtils.getOSFriendlyName(_name);
  for (  Category c : getCategories())   c.setupForDownloading(this);
  Integer iid=new Integer(0);
  _catMap.put(this,iid);
  _catMap.put(iid,this);
  int catId=readInExistingCatMap();
  for (  Category c : getCategories())   catId=c.updateCatMap(catId,_catMap);
  if (!GlobalConstants.testing())   outputCatMap();
}

Fixed version (ground truth):
public void addCategories(Collection<Category> cats){
  setCategories(cats);
  _taxonomyPath=_user.getUid() + File.separator + StringUtils.getOSFriendlyName(_name);
  for (  Category c : getCategories())   c.setupForDownloading(this);
  Integer iid=new Integer(0);
  _catMap.put(this,iid);
  _catMap.put(iid,this);
  int catId=readInExistingCatMap();
  for (  Category c : getCategories())   catId=c.updateCatMap(catId,_catMap);
  if (!GlobalConstants.testing())   outputCatMap();
}
Program: 45232
Project: 45232
Buggy source:
public int getMatchCount(final Hashtable matchCounts){
  final int ltCount=_lTerm.getMatchCount(matchCounts);
  final int rtCount=_rTerm.getMatchCount(matchCounts);
  if (_op == FilterOp.AND_TERM) {
    if ((ltCount == 0) || (rtCount == 0))     return 0;
 else     if ((ltCount > MIN_MATCH) && (rtCount > MIN_MATCH))     return (ltCount + rtCount) / 2;
 else     return ((ltCount < rtCount) ? ltCount : rtCount);
  }
 else   return ltCount + rtCount;
}

Fixed version (ground truth):
public int getMatchCount(NewsItem article,int numTokens,Hashtable matchCounts){
  final int ltCount=_lTerm.getMatchCount(article,numTokens,matchCounts);
  final int rtCount=_rTerm.getMatchCount(article,numTokens,matchCounts);
  if (_op == FilterOp.AND_TERM) {
    if ((ltCount == 0) || (rtCount == 0))     return 0;
 else     if ((ltCount > MIN_MATCH) && (rtCount > MIN_MATCH))     return (ltCount + rtCount) / 2;
 else     return ((ltCount < rtCount) ? ltCount : rtCount);
  }
 else   return ltCount + rtCount;
}
Program: 45233
Project: 45233
Buggy source:
public void clearCaches(){
  for (  OCache c : _caches.values())   c.clear();
}

Fixed version (ground truth):
public void clearCaches(){
  Map<Class,OCache> oldCaches=_caches;
  buildAllCaches();
  for (  OCache c : oldCaches.values())   c.destroy();
}
Program: 45234
Project: 45234
Buggy source:
public ObjectCache(){
  _caches=new java.util.HashMap<Class,OCache>(10);
  Properties p=new Properties();
  p.setProperty("String_Node_Str","String_Node_Str");
  p.setProperty("String_Node_Str","String_Node_Str");
  buildCache("String_Node_Str",User.class,p);
  buildCache("String_Node_Str",Issue.class,p);
  buildCache("String_Node_Str",Feed.class,p);
  buildCache("String_Node_Str",Source.class,p);
  buildCache("String_Node_Str",Category.class,p);
  buildCache("String_Node_Str",Filter.class,p);
  buildCache("String_Node_Str",NewsItem.class,p);
  _objectCache=buildCache("String_Node_Str",Object.class,p);
}

Fixed version (ground truth):
public ObjectCache(){
  buildAllCaches();
}
Program: 45235
Project: 45235
Buggy source:
public synchronized Count getMatchCount(final NewsItem article,final int numTokens,final Hashtable matchCounts){
  getFilter();
  getParent();
  return super.getMatchCount(article,numTokens,matchCounts);
}

Fixed version (ground truth):
public synchronized Count getMatchCount(final NewsItem article,final int numTokens,final Hashtable matchCounts){
  setupAll();
  return super.getMatchCount(article,numTokens,matchCounts);
}
Program: 45236
Project: 45236
Buggy source:
protected void collectUsedConcepts(Set<Concept> usedConcepts){
  getFilter();
  getParent();
  super.collectUsedConcepts(usedConcepts);
}

Fixed version (ground truth):
protected void collectUsedConcepts(Set<Concept> usedConcepts){
  setupAll();
  super.collectUsedConcepts(usedConcepts);
}
Program: 45237
Project: 45237
Buggy source:
/** 
 * public String getTaxonomy() { getFilter(); getParent(); return super.getTaxonomy(); }
 */
public User getUser(){
  User u=super.getUser();
  if (u == null)   u=SQL_DB._sqldb.getUser(_userKey);
 else   _log.debug("String_Node_Str" + _userKey);
  return u;
}

Fixed version (ground truth):
public User getUser(){
  User u=super.getUser();
  if (u == null)   u=SQL_DB._sqldb.getUser(_userKey);
 else   _log.debug("String_Node_Str" + _userKey);
  return u;
}
Program: 45238
Project: 45238
Buggy source:
protected void setupForDownloading(Issue issue){
  getFilter();
  getParent();
  super.setupForDownloading(issue);
}

Fixed version (ground truth):
protected void setupForDownloading(Issue issue){
  setupAll();
  super.setupForDownloading(issue);
}
Program: 45239
Project: 45239
Buggy source:
/** 
 * Remove a classified news item from a category
 * @param catKey   Category key (globally unique)
 * @param niKeys   NewsItem keys (globally unique)
 */
public void deleteNewsItemsFromCategory(Long catKey,List<Long> niKeys){
  _cache.removeEntriesForGroups(new String[]{"String_Node_Str" + catKey});
  Connection c=null;
  PreparedStatement stmt=null;
  try {
    c=_dbPool.getConnection();
    stmt=c.prepareStatement(DELETE_5_NEWS_ITEMS_FROM_CAT._stmtString);
    stmt.setLong(1,catKey);
    int i=0;
    int numDeleted=0;
    Long lastVal=(long)0;
    for (    Long k : niKeys) {
      stmt.setLong(i + 2,k);
      i++;
      if (i % 5 == 0) {
        int n=stmt.executeUpdate();
        numDeleted+=n;
        i=0;
      }
      lastVal=k;
    }
    if (i % 5 != 0) {
      while (i % 5 != 0) {
        stmt.setLong(i + 2,lastVal);
        i++;
      }
      int n=stmt.executeUpdate();
      numDeleted+=n;
    }
    _log.info("String_Node_Str" + numDeleted + "String_Node_Str");
    if (numDeleted > 0) {
      Category cat=getCategory(catKey);
      cat.setNumArticles(cat.getNumArticles() - numDeleted);
      updateCatInfo(cat);
      updateArtCounts(cat.getIssue());
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    _log.error("String_Node_Str" + catKey);
  }
 finally {
    SQL_StmtExecutor.closeStatement(stmt);
    SQL_StmtExecutor.closeConnection(c);
  }
}

Fixed version (ground truth):
/** 
 * Remove a classified news item from a category
 * @param catKey   Category key (globally unique)
 * @param niKeys   NewsItem keys (globally unique)
 */
public void deleteNewsItemsFromCategory(Long catKey,List<Long> niKeys){
  _cache.removeEntriesForGroups(new String[]{"String_Node_Str" + catKey});
  Connection c=null;
  PreparedStatement stmt=null;
  try {
    c=_dbPool.getConnection();
    stmt=c.prepareStatement(DELETE_5_NEWS_ITEMS_FROM_CAT._stmtString);
    stmt.setLong(1,catKey);
    int i=0;
    int numDeleted=0;
    Long lastVal=(long)0;
    for (    Long k : niKeys) {
      stmt.setLong(i + 2,k);
      i++;
      if (i % 5 == 0) {
        int n=stmt.executeUpdate();
        numDeleted+=n;
        i=0;
      }
      lastVal=k;
    }
    if (i % 5 != 0) {
      while (i % 5 != 0) {
        stmt.setLong(i + 2,lastVal);
        i++;
      }
      int n=stmt.executeUpdate();
      numDeleted+=n;
    }
    _log.info("String_Node_Str" + numDeleted + "String_Node_Str");
    if (numDeleted > 0) {
      Category cat=getCategory(catKey);
      cat.setNumArticles(cat.getNumArticles() - numDeleted);
      updateCatInfo(cat,true);
      updateArtCounts(cat.getIssue());
    }
  }
 catch (  Exception e) {
    e.printStackTrace();
    _log.error("String_Node_Str" + catKey);
  }
 finally {
    SQL_StmtExecutor.closeStatement(stmt);
    SQL_StmtExecutor.closeConnection(c);
  }
}
Program: 45240
Project: 45240
Buggy source:
private int updateArtCountsForCat(Category cat){
  if (!cat.isLeafCategory()) {
    int n=0;
    for (    Category ch : cat.getChildren())     n+=updateArtCountsForCat(ch);
    cat.setNumArticles(n);
  }
  updateCatInfo(cat);
  return cat.getNumArticles();
}

Fixed version (ground truth):
private int updateArtCountsForCat(Category cat){
  if (!cat.isLeafCategory()) {
    int n=0;
    for (    Category ch : cat.getChildren())     n+=updateArtCountsForCat(ch);
    cat.setNumArticles(n);
  }
  updateCatInfo(cat,false);
  return cat.getNumArticles();
}
Program: 45241
Project: 45241
Buggy source:
private void updateCatInfo(Category cat){
  if (_log.isDebugEnabled())   _log.debug("String_Node_Str" + cat.getName() + "String_Node_Str"+ cat.getKey()+ "String_Node_Str"+ cat.getNumArticles());
  Date lut=cat.getLastUpdateTime();
  if (lut != null)   lut=new Timestamp(lut.getTime());
  UPDATE_CAT_NEWS_INFO.execute(new Object[]{cat.getNumArticles(),lut,cat.getNumItemsSinceLastDownload(),cat.getKey()});
  User u=cat.getUser();
  Issue i=cat.getIssue();
  _cache.remove(cat.getKey(),Category.class);
  _cache.remove(i.getKey(),Issue.class);
  _cache.remove(u.getUid() + "String_Node_Str" + i.getName(),Issue.class);
  _cache.remove(u.getKey(),User.class);
  _cache.remove(u.getUid(),User.class);
}

Fixed version (ground truth):
private void updateCatInfo(Category cat,boolean purgeAllStaleCacheEntries){
  if (_log.isDebugEnabled())   _log.debug("String_Node_Str" + cat.getName() + "String_Node_Str"+ cat.getKey()+ "String_Node_Str"+ cat.getNumArticles());
  Date lut=cat.getLastUpdateTime();
  if (lut != null)   lut=new Timestamp(lut.getTime());
  UPDATE_CAT_NEWS_INFO.execute(new Object[]{cat.getNumArticles(),lut,cat.getNumItemsSinceLastDownload(),cat.getKey()});
  _cache.remove(cat.getKey(),Category.class);
  if (purgeAllStaleCacheEntries) {
    User u=cat.getUser();
    Issue i=cat.getIssue();
    _cache.remove(i.getKey(),Issue.class);
    _cache.remove(u.getUid() + "String_Node_Str" + i.getName(),Issue.class);
    _cache.remove(u.getKey(),User.class);
    _cache.remove(u.getUid(),User.class);
    updateIssueForCat(cat,getIssue(i.getKey()));
  }
}
Program: 45242
Project: 45242
Buggy source:
public List<Issue> getIssues(User u){
  List<Issue> issues=(List<Issue>)GET_ALL_ISSUES_BY_USER_KEY.execute(new Object[]{u.getKey()});
  for (  Issue i : issues) {
    i.setUser(u);
  }
  return issues;
}

Fixed version (ground truth):
public List<Issue> getIssues(User u){
  List<Issue> issues=(List<Issue>)GET_ALL_ISSUES_BY_USER_KEY.execute(new Object[]{u.getKey()});
  for (  Issue i : issues) {
    i.setUser(u);
    _cache.add(u.getKey(),u.getUid() + "String_Node_Str" + i.getName(),Issue.class,i);
  }
  return issues;
}
Program: 45243
Project: 45243
Buggy source:
private void updateArtCounts(Issue i){
  int n=0;
  for (  Category c : i.getCategories())   n+=updateArtCountsForCat(c);
  i.setNumArticles(n);
  if (_log.isDebugEnabled())   _log.debug("String_Node_Str" + i.getName() + "String_Node_Str"+ i.getKey()+ "String_Node_Str"+ n);
  UPDATE_ARTCOUNT_FOR_TOPIC.execute(new Object[]{n,new Timestamp(i.getLastUpdateTime().getTime()),i.getNumItemsSinceLastDownload(),i.getKey()});
}

Fixed version (ground truth):
private void updateArtCounts(Issue i){
  int n=0;
  for (  Category c : i.getCategories())   n+=updateArtCountsForCat(c);
  i.setNumArticles(n);
  if (_log.isDebugEnabled())   _log.debug("String_Node_Str" + i.getName() + "String_Node_Str"+ i.getKey()+ "String_Node_Str"+ n);
  UPDATE_ARTCOUNT_FOR_TOPIC.execute(new Object[]{n,new Timestamp(i.getLastUpdateTime().getTime()),i.getNumItemsSinceLastDownload(),i.getKey()});
  User u=i.getUser();
  _cache.remove(i.getKey(),Issue.class);
  _cache.remove(u.getUid() + "String_Node_Str" + i.getName(),Issue.class);
  _cache.remove(u.getKey(),User.class);
  _cache.remove(u.getUid(),User.class);
  i=getIssue(i.getKey());
  for (  Category c : i.getCategories())   updateIssueForCat(c,i);
}
Program: 45244
Project: 45244
Buggy source:
public Issue getIssue(User u,String issueName){
  String key=u.getUid() + "String_Node_Str" + issueName;
  Issue i=(Issue)_cache.get(key,Issue.class);
  if (i == null) {
    i=(Issue)GET_ISSUE_BY_USER_KEY.execute(new Object[]{u.getKey(),issueName});
    if (i != null) {
      _cache.add(u.getKey(),key,Issue.class,i);
      i.setUser(u);
    }
  }
  return i;
}

Fixed version (ground truth):
public Issue getIssue(User u,String issueName){
  String key=u.getUid() + "String_Node_Str" + issueName;
  Issue i=(Issue)_cache.get(key,Issue.class);
  if (i == null) {
    _log.info("String_Node_Str" + key + "String_Node_Str");
    i=(Issue)GET_ISSUE_BY_USER_KEY.execute(new Object[]{u.getKey(),issueName});
    if (i != null) {
      _cache.add(u.getKey(),key,Issue.class,i);
      i.setUser(u);
    }
  }
  return i;
}
Program: 45245
Project: 45245
Buggy source:
/** 
 * Remove a classified news item from a category
 * @param catKey   Category key (globally unique)
 * @param niKey    NewsItem key (globally unique)
 */
public void deleteNewsItemFromCategory(Long catKey,Long niKey){
  _cache.removeEntriesForGroups(new String[]{"String_Node_Str" + catKey});
  Integer numDeleted=(Integer)DELETE_NEWS_FROM_CAT.execute(new Object[]{catKey,niKey});
  if (_log.isDebugEnabled())   _log.debug("String_Node_Str" + numDeleted + "String_Node_Str"+ catKey);
  if (numDeleted > 0) {
    Category cat=getCategory(catKey);
    cat.setNumArticles(cat.getNumArticles() - numDeleted);
    updateCatInfo(cat);
    updateArtCounts(cat.getIssue());
  }
}

Fixed version (ground truth):
/** 
 * Remove a classified news item from a category
 * @param catKey   Category key (globally unique)
 * @param niKey    NewsItem key (globally unique)
 */
public void deleteNewsItemFromCategory(Long catKey,Long niKey){
  _cache.removeEntriesForGroups(new String[]{"String_Node_Str" + catKey});
  Integer numDeleted=(Integer)DELETE_NEWS_FROM_CAT.execute(new Object[]{catKey,niKey});
  if (_log.isDebugEnabled())   _log.debug("String_Node_Str" + numDeleted + "String_Node_Str"+ catKey);
  if (numDeleted > 0) {
    Category cat=getCategory(catKey);
    cat.setNumArticles(cat.getNumArticles() - numDeleted);
    updateCatInfo(cat,true);
    updateArtCounts(cat.getIssue());
  }
}
Program: 45246
Project: 45246
Buggy source:
/** 
 * Clears the list of articles classified in a category
 * @param c Category for which news is to be cleared
 */
public void clearNews(Category cat){
  CLEAR_CAT_NEWS.execute(new Object[]{cat.getKey()});
  cat.setNumArticles(0);
  updateCatInfo(cat);
  _cache.removeEntriesForGroups(new String[]{"String_Node_Str" + cat.getKey()});
}

Fixed version (ground truth):
/** 
 * Clears the list of articles classified in a category
 * @param c Category for which news is to be cleared
 */
public void clearNews(Category cat){
  CLEAR_CAT_NEWS.execute(new Object[]{cat.getKey()});
  cat.setNumArticles(0);
  updateCatInfo(cat,true);
  _cache.removeEntriesForGroups(new String[]{"String_Node_Str" + cat.getKey()});
  for (  Category c : cat.getChildren())   c.clearNews();
}
Program: 45247
Project: 45247
Buggy source:
/** 
 * This method clears all previously categorized news
 */
public void clearNews(){
  _db.clearNews(this);
  if (!isLeafCategory()) {
    for (    Category c : _children)     c.clearNews();
  }
}

Fixed version (ground truth):
/** 
 * This method clears all previously categorized news
 */
public void clearNews(){
  _db.clearNews(this);
}