nus-yam/ex-repair huggingface dataset:
Program: 45248
Project: 45248
Buggy source:
/** 
 * Add a issue to the profile -- only during parsing!
 */
public void addIssue(final Issue i) throws Exception {
  if (_issues == null)   _issues=new HashMap<String,Issue>();
  if (_issues.get(i.getName()) != null) {
    throw new Exception("String_Node_Str" + i.getName());
  }
 else {
    _issues.put(i.getName(),i);
  }
}

Fixed version (ground truth):
/** 
 * Add a issue to the profile -- only during parsing!
 */
public void addIssue(final Issue i) throws Exception {
  if (_issues == null)   initIssueMap();
  if (_issues.get(i.getName()) != null) {
    throw new Exception("String_Node_Str" + i.getName());
  }
 else {
    _issues.put(i.getName(),i);
  }
}
Program: 45249
Project: 45249
Buggy source:
private void loadIssuesFromDB(){
  _issues=new HashMap<String,Issue>();
  for (  Issue i : _db.getIssues(this)) {
    _log.debug("String_Node_Str" + i.getName() + "String_Node_Str");
    _issues.put(i.getName(),i);
  }
}

Fixed version (ground truth):
private void loadIssuesFromDB(){
  initIssueMap();
  for (  Issue i : _db.getIssues(this)) {
    if (_log.isDebugEnabled())     _log.debug("String_Node_Str" + i.getName() + "String_Node_Str");
    _issues.put(i.getName(),i);
  }
}
Program: 45251
Project: 45251
Buggy source:
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 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;
}
Program: 45252
Project: 45252
Buggy source:
public String toString(){
  StringBuffer sb=new StringBuffer("String_Node_Str");
  sb.append(_name);
  sb.append("String_Node_Str");
  sb.append(_private);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  for (  Category c : getCategories())   sb.append(c);
  sb.append("String_Node_Str");
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * public String getTaxonomy() { StringBuffer sb = new StringBuffer(); sb.append("<issue>\n"); sb.append("<name>" + _name + "</name>\n"); for (Category c: getCategories()) sb.append(c.getTaxonomy()); sb.append("</issue>\n"); return sb.toString(); }
 */
public String toString(){
  StringBuffer sb=new StringBuffer("String_Node_Str");
  sb.append(_name);
  sb.append("String_Node_Str");
  sb.append(_private);
  sb.append("String_Node_Str");
  sb.append("String_Node_Str");
  for (  Category c : getCategories())   sb.append(c);
  sb.append("String_Node_Str");
  return sb.toString();
}
Program: 45253
Project: 45253
Buggy source:
/** 
 * This method updates the database with changes made to an user's entry
 * @param u User whose info. needs to be updated 
 */
public void updateUser(User u){
  UPDATE_USER.execute(new Object[]{u.getPassword(),u.getName(),u.getEmail(),u.isValidated(),u.getKey()});
}

Fixed version (ground truth):
/** 
 * This method updates the database with changes made to an user's entry
 * @param u User whose info. needs to be updated 
 */
public void updateUser(User u){
  UPDATE_USER.execute(new Object[]{u.getPassword(),u.getName(),u.getEmail(),u.isValidated(),u.getKey()});
  _cache.remove(u.getKey(),User.class);
  _cache.remove(u.getUid(),User.class);
}
Program: 45254
Project: 45254
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);
}

Fixed version (ground truth):
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);
}
Program: 45255
Project: 45255
Buggy source:
/** 
 * This method updates the database with changes made to a feed
 * @param f Feed whose info. needs to be updated
 */
public void updateFeedCacheability(Feed f){
  UPDATE_FEED_CACHEABILITY.execute(new Object[]{f.getCacheableFlag(),f.getCachedTextDisplayFlag(),f.getKey()});
}

Fixed version (ground truth):
/** 
 * This method updates the database with changes made to a feed
 * @param f Feed whose info. needs to be updated
 */
public void updateFeedCacheability(Feed f){
  UPDATE_FEED_CACHEABILITY.execute(new Object[]{f.getCacheableFlag(),f.getCachedTextDisplayFlag(),f.getKey()});
  _cache.remove(f.getKey(),Feed.class);
}
Program: 45256
Project: 45256
Buggy source:
/** 
 * Gets the active profile
 */
public String getLastDownloadTime(){
  return GlobalConstants.DF.format(newsrack.archiver.DownloadNewsTask.getLastDownloadTime());
}

Fixed version (ground truth):
public Date getLastDownloadTime(){
  return newsrack.archiver.DownloadNewsTask.getLastDownloadTime();
}
Program: 45257
Project: 45257
Buggy source:
public String loginAsAnotherUser(){
  User u=getAdmin();
  if (u == null)   return Action.ERROR;
  String username=getParam("String_Node_Str");
  if (username == null) {
    addActionError(getText("String_Node_Str"));
    log.error("String_Node_Str");
    return Action.INPUT;
  }
  try {
    log.info("String_Node_Str" + username);
    u=u.signInAsUser(username);
    log.info("String_Node_Str" + u.getUid());
    _user=u;
    _session.put(GlobalConstants.USER_KEY,_user);
    return Action.SUCCESS;
  }
 catch (  final Exception e) {
    addActionError(getText("String_Node_Str",new String[]{username}));
    log.error("String_Node_Str",e);
    return Action.INPUT;
  }
}

Fixed version (ground truth):
public String loginAsAnotherUser(){
  User u=getAdmin();
  if (u == null)   return Action.ERROR;
  String username=getParam("String_Node_Str");
  if (username == null) {
    addActionError(getText("String_Node_Str"));
    log.error("String_Node_Str");
    return Action.INPUT;
  }
  try {
    log.info("String_Node_Str" + username);
    u=u.signInAsUser(username);
    log.info("String_Node_Str" + u.getUid());
    _session.put(GlobalConstants.UID_KEY,u.getUid());
    _session.put(GlobalConstants.USER_KEY,u);
    _user=u;
    return Action.SUCCESS;
  }
 catch (  final Exception e) {
    addActionError(getText("String_Node_Str",new String[]{username}));
    log.error("String_Node_Str",e);
    return Action.INPUT;
  }
}
Program: 45258
Project: 45258
Buggy source:
private User getAdmin(){
  User u=getSessionUser();
  if (u != null && !u.isAdmin()) {
    addActionError(getText("String_Node_Str"));
    log.error("String_Node_Str" + u.getUid() + "String_Node_Str");
    return null;
  }
  return u;
}

Fixed version (ground truth):
/** 
 * private User _user; private User getUser() { return _user; }
 */
private User getAdmin(){
  User u=getSessionUser();
  if (u != null && !u.isAdmin()) {
    addActionError(getText("String_Node_Str"));
    log.error("String_Node_Str" + u.getUid() + "String_Node_Str");
    return null;
  }
  return u;
}
Program: 45259
Project: 45259
Buggy source:
User getSessionUser(){
  return (User)_session.get(GlobalConstants.USER_KEY);
}

Fixed version (ground truth):
User getSessionUser(){
  _user=User.getUser((String)_session.get(GlobalConstants.UID_KEY));
  _session.put(GlobalConstants.USER_KEY,_user);
  return _user;
}
Program: 45260
Project: 45260
Buggy source:
/** 
 * private int _start; private int _count;   
 */
public User getUser(){
  return _user;
}

Fixed version (ground truth):
public User getUser(){
  return _user;
}
Program: 45261
Project: 45261
Buggy source:
public static void setIssueUpdateLists(){
  List<Issue> l1=new ArrayList<Issue>();
  List<Issue> l2=new ArrayList<Issue>();
  List<Issue> l3=new ArrayList<Issue>();
  List<Issue> issues=User.getAllValidatedIssues();
  for (  Issue i : issues) {
    int n=i.getNumItemsSinceLastDownload();
    if (n > 0)     l1.add(i);
 else     if ((n == 0) && i.updatedWithinLastNHours(24))     l2.add(i);
 else     l3.add(i);
  }
  _updatesMostRecent=l1;
  _updatesLast24Hrs=l2;
  _updatesMoreThan24Hrs=l3;
  _lastUpdateTime=new Date();
}

Fixed version (ground truth):
public static void setIssueUpdateLists(){
  List<Issue> l1=new ArrayList<Issue>();
  List<Issue> l2=new ArrayList<Issue>();
  List<Issue> l3=new ArrayList<Issue>();
  List<Issue> issues=User.getAllValidatedIssues();
  for (  Issue i : issues) {
    int n=i.getNumItemsSinceLastDownload();
    if ((n > 0) && (_lastUpdateTime != null))     l1.add(i);
 else     if (i.updatedWithinLastNHours(24))     l2.add(i);
 else     l3.add(i);
  }
  _updatesMostRecent=l1;
  _updatesLast24Hrs=l2;
  _updatesMoreThan24Hrs=l3;
  _lastUpdateTime=new Date();
}
Program: 45263
Project: 45263
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(GlobalConstants.USER_KEY,u);
    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(GlobalConstants.UID_KEY,u.getUid());
    _session.put(GlobalConstants.USER_KEY,u);
    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: 45264
Project: 45264
Buggy source:
public void validateSendPasswordResetKey(){
  String uid=getParam("String_Node_Str");
  if ((uid == null) || uid.trim().equals("String_Node_Str"))   addFieldError("String_Node_Str",getText("String_Node_Str"));
}

Fixed version (ground truth):
/** 
 * private User _user; public User getUser() { return _user; }
 */
public void validateSendPasswordResetKey(){
  String uid=getParam("String_Node_Str");
  if ((uid == null) || uid.trim().equals("String_Node_Str"))   addFieldError("String_Node_Str",getText("String_Node_Str"));
}
Program: 45265
Project: 45265
Buggy source:
public String checkPasswordResetKey(){
  String uid=getParam("String_Node_Str");
  User u=User.getUser(uid);
  if (u == null) {
    addActionError(getText("String_Node_Str",new String[]{uid}));
    return Action.ERROR;
  }
  String key=getParam("String_Node_Str");
  if ((key == null) || !PasswordService.isAValidPasswordResetKey(uid,key)) {
    addActionError(getText("String_Node_Str"));
    return Action.ERROR;
  }
  _session.put(GlobalConstants.USER_KEY,u);
  return Action.SUCCESS;
}

Fixed version (ground truth):
public String checkPasswordResetKey(){
  String uid=getParam("String_Node_Str");
  User u=User.getUser(uid);
  if (u == null) {
    addActionError(getText("String_Node_Str",new String[]{uid}));
    return Action.ERROR;
  }
  String key=getParam("String_Node_Str");
  if ((key == null) || !PasswordService.isAValidPasswordResetKey(uid,key)) {
    addActionError(getText("String_Node_Str"));
    return Action.ERROR;
  }
  _session.put(GlobalConstants.UID_KEY,u.getUid());
  _session.put(GlobalConstants.USER_KEY,u);
  return Action.SUCCESS;
}
Program: 45266
Project: 45266
Buggy source:
public String logout(){
  _session.remove(GlobalConstants.USER_KEY);
  return "String_Node_Str";
}

Fixed version (ground truth):
public String logout(){
  _session.remove(GlobalConstants.USER_KEY);
  _session.remove(GlobalConstants.UID_KEY);
  return "String_Node_Str";
}
Program: 45267
Project: 45267
Buggy source:
public ObjectCache(){
  Properties p=new Properties();
  p.setProperty("String_Node_Str","String_Node_Str");
  p.setProperty("String_Node_Str","String_Node_Str");
  p.setProperty("String_Node_Str",GlobalConstants.getProperty("String_Node_Str"));
  p.setProperty("String_Node_Str","String_Node_Str");
  _objectCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _userCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _issueCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _feedCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _srcCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _categoryCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _filterCache=new OCache("String_Node_Str",p);
  _caches=new java.util.HashMap<Class,OCache>(10);
  _caches.put(Object.class,_objectCache);
  _caches.put(Feed.class,_feedCache);
  _caches.put(User.class,_userCache);
  _caches.put(Issue.class,_issueCache);
  _caches.put(Source.class,_srcCache);
  _caches.put(Category.class,_categoryCache);
  _caches.put(Filter.class,_filterCache);
}

Fixed version (ground truth):
public ObjectCache(){
  Properties p=new Properties();
  p.setProperty("String_Node_Str","String_Node_Str");
  p.setProperty("String_Node_Str","String_Node_Str");
  p.setProperty("String_Node_Str",GlobalConstants.getProperty("String_Node_Str"));
  p.setProperty("String_Node_Str","String_Node_Str");
  _objectCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _userCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _issueCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _feedCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _srcCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _categoryCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _filterCache=new OCache("String_Node_Str",p);
  p.setProperty("String_Node_Str","String_Node_Str");
  _newsItemCache=new OCache("String_Node_Str",p);
  _caches=new java.util.HashMap<Class,OCache>(10);
  _caches.put(Object.class,_objectCache);
  _caches.put(Feed.class,_feedCache);
  _caches.put(NewsItem.class,_newsItemCache);
  _caches.put(User.class,_userCache);
  _caches.put(Issue.class,_issueCache);
  _caches.put(Source.class,_srcCache);
  _caches.put(Category.class,_categoryCache);
  _caches.put(Filter.class,_filterCache);
}
Program: 45268
Project: 45268
Buggy source:
public void removeEntriesForGroups(String[] cacheGroups){
  _userCache.removeGroups(cacheGroups);
  _feedCache.removeGroups(cacheGroups);
  _srcCache.removeGroups(cacheGroups);
  _issueCache.removeGroups(cacheGroups);
  _categoryCache.removeGroups(cacheGroups);
  _filterCache.removeGroups(cacheGroups);
  _objectCache.removeGroups(cacheGroups);
}

Fixed version (ground truth):
public void removeEntriesForGroups(String[] cacheGroups){
  for (  OCache c : _caches.values())   c.removeGroups(cacheGroups);
}
Program: 45269
Project: 45269
Buggy source:
public void printStats(){
  _objectCache.printStats();
  _feedCache.printStats();
  _userCache.printStats();
  _issueCache.printStats();
  _srcCache.printStats();
  _categoryCache.printStats();
  _filterCache.printStats();
}

Fixed version (ground truth):
public void printStats(){
  for (  OCache c : _caches.values())   c.printStats();
}
Program: 45270
Project: 45270
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()) {
    _cache.removeEntriesForGroups(new String[]{"String_Node_Str" + cat.getKey()});
    SQL_NewsItem sni=(SQL_NewsItem)ni;
    if (!sni.inTheDB())     _log.error("String_Node_Str" + sni + "String_Node_Str");
    INSERT_INTO_CAT_NEWS_TABLE.execute(new Object[]{cat.getKey(),sni.getKey(),sni.getNewsIndex().getKey()});
    cat.setNumArticles(1 + cat.getNumArticles());
  }
}

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 matchCount  Match weight
 */
public void addNewsItem(NewsItem ni,Category cat,int matchCount){
  if (cat.isLeafCategory()) {
    _cache.removeEntriesForGroups(new String[]{"String_Node_Str" + cat.getKey()});
    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());
  }
}
Program: 45271
Project: 45271
Buggy source:
/** 
 * Gets list of articles classified in a category -- starting at a specified index
 * @param c 		Category for which news is being sought
 * @param startId The starting index
 * @param numArts Number of articles requested
 */
public Iterator<NewsItem> getNews(Category cat,int startId,int numArts){
  Object news=null;
  String cacheKey="String_Node_Str" + cat.getKey() + "String_Node_Str"+ startId+ "String_Node_Str"+ numArts;
  news=_cache.get(cacheKey,List.class);
  if (news == null) {
    news=GET_NEWS_FROM_CAT.execute(new Object[]{cat.getKey(),startId,numArts});
    _cache.add(new String[]{cat.getUser().getKey().toString(),"String_Node_Str" + cat.getKey()},cacheKey,List.class,news);
  }
  return ((List<NewsItem>)news).iterator();
}

Fixed version (ground truth):
/** 
 * Gets list of articles classified in a category -- starting at a specified index
 * @param c 		Category for which news is being sought
 * @param startId The starting index
 * @param numArts Number of articles requested
 */
public Iterator<NewsItem> getNews(Category cat,int startId,int numArts){
  Object news=null;
  String cacheKey="String_Node_Str" + cat.getKey() + "String_Node_Str"+ startId+ "String_Node_Str"+ numArts;
  news=_cache.get(cacheKey,List.class);
  if (news == null) {
    news=GET_NEWS_KEYS_FROM_CAT.execute(new Object[]{cat.getKey(),startId,numArts});
    _cache.add(new String[]{cat.getUser().getKey().toString(),"String_Node_Str" + cat.getKey()},cacheKey,List.class,news);
  }
  List<NewsItem> nis=new ArrayList<NewsItem>();
  for (  Long k : (List<Long>)news)   nis.add(getNewsItem(k));
  return nis.iterator();
}
Program: 45274
Project: 45274
Buggy source:
/** 
 * This method registers the user with the database .. in the process, it might initialize user space.
 * @param u   User who has to be registered
 */
public void registerUser(User u){
  IOUtils.createDir(getUserHome(u));
  IOUtils.createDir(getFileUploadArea(u));
  u.setKey((Long)INSERT_USER.execute(new Object[]{u.getUid(),u.getPassword(),u.getName(),u.getEmail()}));
}

Fixed version (ground truth):
/** 
 * This method registers the user with the database .. in the process, it might initialize user space.
 * @param u   User who has to be registered
 */
public void registerUser(User u){
  IOUtils.createDir(getUserHome(u));
  IOUtils.createDir(getFileUploadArea(u));
  IOUtils.createDir(getUserSpaceWorkDir(u));
  u.setKey((Long)INSERT_USER.execute(new Object[]{u.getUid(),u.getPassword(),u.getName(),u.getEmail()}));
}
Program: 45275
Project: 45275
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.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);
}

Fixed version (ground truth):
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);
}
Program: 45276
Project: 45276
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.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()});
}
Program: 45277
Project: 45277
Buggy source:
public SQL_IssueStub(Long key,Long userKey,String name,int numArts,Date lut,boolean isValidated,boolean isFrozen,boolean isPrivate,String taxoPath){
  super(name,isValidated,isFrozen,isPrivate);
  _userKey=userKey;
  super.setKey(key);
  super.setNumArticles(numArts);
  super.setLastUpdateTime(lut);
  super.setTaxonomyPath(taxoPath);
  _loaded=false;
}

Fixed version (ground truth):
public SQL_IssueStub(Long key,Long userKey,String name,int numArts,Date lut,boolean isValidated,boolean isFrozen,boolean isPrivate,String taxoPath,int numNew){
  super(name,isValidated,isFrozen,isPrivate);
  _userKey=userKey;
  super.setKey(key);
  super.setNumArticles(numArts);
  super.setLastUpdateTime(lut);
  super.setTaxonomyPath(taxoPath);
  super.setNumItemsSinceLastDownload(numNew);
  _loaded=false;
}
Program: 45278
Project: 45278
Buggy source:
public static void main(String[] args){
  if (args.length < 2) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  String appPropertiesFile=args[0];
  String action=args[1];
  System.out.println("String_Node_Str" + appPropertiesFile);
  GlobalConstants.startup(null,appPropertiesFile);
  if (action.equals("String_Node_Str")) {
    migrateAllV1UsersToV2();
  }
 else   if (action.equals("String_Node_Str")) {
    updateArtCounts();
  }
 else {
    System.out.println("String_Node_Str" + action);
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public static void main(String[] args){
  if (args.length < 2) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  String appPropertiesFile=args[0];
  String action=args[1];
  System.out.println("String_Node_Str" + appPropertiesFile);
  GlobalConstants.startup(null,appPropertiesFile);
  if (action.equals("String_Node_Str")) {
    migrateAllV1UsersToV2();
  }
 else   if (action.equals("String_Node_Str")) {
    updateArtCounts();
  }
 else {
    System.out.println("String_Node_Str" + action);
  }
  System.out.println("String_Node_Str");
  System.exit(0);
}
Program: 45279
Project: 45279
Buggy source:
public static void main(String[] args){
  if (args.length < 2) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  String appPropertiesFile=args[0];
  String action=args[1];
  System.out.println("String_Node_Str" + appPropertiesFile);
  GlobalConstants.startup(null,appPropertiesFile);
  if (action.equals("String_Node_Str")) {
    migrateAllV1UsersToV2();
  }
 else   if (action.equals("String_Node_Str")) {
    updateArtCounts();
  }
 else {
    System.out.println("String_Node_Str" + action);
  }
  System.out.println("String_Node_Str");
  System.exit(0);
}

Fixed version (ground truth):
public static void main(String[] args){
  if (args.length < 2) {
    System.out.println("String_Node_Str");
    System.exit(0);
  }
  String appPropertiesFile=args[0];
  String action=args[1];
  System.out.println("String_Node_Str" + appPropertiesFile);
  GlobalConstants.startup(null,appPropertiesFile);
  if (action.equals("String_Node_Str")) {
    migrateAllV1UsersToV2();
  }
 else   if (action.equals("String_Node_Str")) {
    updateArtCounts();
  }
 else   if (action.equals("String_Node_Str")) {
    migrateUser(args[2]);
  }
 else {
    System.out.println("String_Node_Str" + action);
  }
  System.out.println("String_Node_Str");
  System.exit(0);
}
Program: 45280
Project: 45280
Buggy source:
public static void migrateAllV1UsersToV2(){
  List<User> allUsers=User.getAllUsers();
  List<User> validatedUsers=new ArrayList<User>();
  for (  User u : allUsers) {
    if (u.isValidated())     validatedUsers.add(u);
  }
  System.out.println("String_Node_Str");
  for (  User u : validatedUsers) {
    System.out.println("String_Node_Str" + u.getUid());
    try {
      u.invalidateAllIssues();
    }
 catch (    Exception e) {
      _log.error("String_Node_Str",e);
    }
  }
  try {
    _log.info("String_Node_Str");
    User.getUser("String_Node_Str").validateIssues(true);
    _log.info("String_Node_Str");
    User.getUser("String_Node_Str").validateIssues(true);
    _log.info("String_Node_Str");
    User.getUser("String_Node_Str").validateIssues(true);
  }
 catch (  Exception e) {
    _log.error("String_Node_Str",e);
  }
  System.out.println("String_Node_Str");
  for (  User u : validatedUsers) {
    String uid=u.getUid();
    if (!uid.equals("String_Node_Str") && !uid.equals("String_Node_Str") && !uid.equals("String_Node_Str")) {
      System.out.println("String_Node_Str" + u.getUid());
      try {
        u.validateIssues(true);
      }
 catch (      Exception e) {
        _log.error("String_Node_Str",e);
      }
    }
  }
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public static void migrateAllV1UsersToV2(){
  List<User> allUsers=User.getAllUsers();
  List<User> validatedUsers=new ArrayList<User>();
  for (  User u : allUsers) {
    if (u.isValidated())     validatedUsers.add(u);
  }
  System.out.println("String_Node_Str");
  for (  User u : validatedUsers) {
    System.out.println("String_Node_Str" + u.getUid());
    try {
      u.invalidateAllIssues();
    }
 catch (    Exception e) {
      _log.error("String_Node_Str",e);
    }
  }
  migrateUser("String_Node_Str");
  migrateUser("String_Node_Str");
  migrateUser("String_Node_Str");
  for (  User u : validatedUsers) {
    String uid=u.getUid();
    if (!uid.equals("String_Node_Str") && !uid.equals("String_Node_Str") && !uid.equals("String_Node_Str")) {
      System.out.println("String_Node_Str" + u.getUid());
      try {
        u.validateIssues(true);
      }
 catch (      Exception e) {
        _log.error("String_Node_Str",e);
      }
    }
  }
  System.out.println("String_Node_Str");
}
Program: 45281
Project: 45281
Buggy source:
public static boolean testing(){
  String t=getProperty("String_Node_Str");
  if ((t != null) && t.equalsIgnoreCase("String_Node_Str"))   return true;
 else   return false;
}

Fixed version (ground truth):
public static boolean testing(){
  return isTrue("String_Node_Str");
}
Program: 45282
Project: 45282
Buggy source:
public void contextInitialized(ServletContextEvent event){
  try {
    _initialized=false;
    _context=event.getServletContext();
    GlobalConstants.startup(_context,APP_PROPERTIES_FILE);
    _tm=new ThreadManager();
    _tm.initialize(new File(GlobalConstants.getWebappPath() + CRAWLERS_FILE));
    _initialized=true;
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
  log.info("String_Node_Str");
}

Fixed version (ground truth):
public void contextInitialized(ServletContextEvent event){
  try {
    _initialized=false;
    _context=event.getServletContext();
    GlobalConstants.startup(_context,APP_PROPERTIES_FILE);
    _tm=new ThreadManager();
    _tm.initialize(new File(GlobalConstants.getWebappPath() + File.separator + CRAWLERS_FILE));
    _initialized=true;
  }
 catch (  Exception e) {
    log.error("String_Node_Str",e);
  }
  log.info("String_Node_Str");
}
Program: 45283
Project: 45283
Buggy source:
public static void init(){
  INIT_DELAY=1000 * loadPropertyValue("String_Node_Str",60);
  PERIOD=1000 * 60 * loadPropertyValue("String_Node_Str",144);
  MAX_ATTEMPTS=loadPropertyValue("String_Node_Str",10);
  DOWNLOAD_MAX_THREADS=loadPropertyValue("String_Node_Str",20);
  CLASSIFY_MAX_THREADS=loadPropertyValue("String_Node_Str",5);
}

Fixed version (ground truth):
public static void init(){
  INIT_DELAY=1000 * loadPropertyValue("String_Node_Str",60);
  PERIOD=1000 * 60 * loadPropertyValue("String_Node_Str",144);
  MAX_ATTEMPTS=loadPropertyValue("String_Node_Str",10);
  DOWNLOAD_MAX_THREADS=loadPropertyValue("String_Node_Str",20);
  CLASSIFY_MAX_THREADS=loadPropertyValue("String_Node_Str",5);
  _log.info("String_Node_Str");
}
Program: 45285
Project: 45285
Buggy source:
public static boolean checkCrawlersFile(){
  if (_crawlersFile.lastModified() > _lastReadTime) {
    if (_log.isInfoEnabled())     _log.info("String_Node_Str");
    _timer.cancel();
    _tm.initialize(_crawlersFile);
    return true;
  }
 else   return false;
}

Fixed version (ground truth):
public static boolean checkCrawlersFile(){
  if (_crawlersFile.lastModified() > _lastReadTime) {
    if (_log.isInfoEnabled())     _log.info("String_Node_Str");
    _timer.cancel();
    _tm.initialize(_crawlersFile);
    return true;
  }
 else {
    return false;
  }
}
Program: 45286
Project: 45286
Buggy source:
/** 
 * Problem with these is when different object types are added / queried  for the same abstract class.  Ex: SQL_IssueStub vs. Issue; ArrayList vs. List public void add(Long userKey, Object key, Object o) { add(userKey, key, o.getClass(), o); } public void add(String[] cacheGroups, Object key, Object o) { add(cacheGroups, key, o.getClass(), o); }
 */
public Object get(Object key,Class c){
  String nKey;
  OCache cache=_caches.get(c);
  if (cache == null) {
    nKey=Integer.toString(c.hashCode()) + "String_Node_Str" + key.toString();
    cache=_objectCache;
  }
 else {
    nKey=key.toString();
  }
  return cache.get(nKey);
}

Fixed version (ground truth):
/** 
 * Problem with these is when different object types are added / queried  for the same abstract class.  Ex: SQL_IssueStub vs. Issue; ArrayList vs. LinkedList public void add(Long userKey, Object key, Object o) { add(userKey, key, o.getClass(), o); } public void add(String[] cacheGroups, Object key, Object o) { add(cacheGroups, key, o.getClass(), o); }
 */
public Object get(Object key,Class c){
  String nKey;
  OCache cache=_caches.get(c);
  if (cache == null) {
    nKey=Integer.toString(c.hashCode()) + "String_Node_Str" + key.toString();
    cache=_objectCache;
  }
 else {
    nKey=key.toString();
  }
  return cache.get(nKey);
}
Program: 45287
Project: 45287
Buggy source:
/** 
 * Initialize the database for downloading news for a particular date from a particular source.
 * @param f        Feed from which news is being downloaded
 * @param pubDate  Date for which news is being downloaded
 */
public void initializeNewsDownload(Feed f,Date pubDate){
  getArchiveDirForOrigArticle(f,pubDate);
  getArchiveDirForFilteredArticle(f,pubDate);
}

Fixed version (ground truth):
/** 
 * Initialize the database for downloading news for a particular date from a particular source.
 * @param f        Feed from which news is being downloaded
 * @param pubDate  Date for which news is being downloaded
 */
public void initializeNewsDownload(Feed f,Date pubDate){
  getArchiveDirForOrigArticles(f,pubDate);
  getArchiveDirForFilteredArticles(f,pubDate);
}
Program: 45288
Project: 45288
Buggy source:
private void drawZone(Canvas canvas,Paint paint,Zone zone){
  Path path=new Path();
  path.setLastPoint(zone.getPoints().get(0).x,zone.getPoints().get(0).y);
  for (  PointF point : zone.getPoints()) {
    path.lineTo(point.x,point.y);
  }
  path.close();
  path.setFillType(FillType.WINDING);
  canvas.drawPath(path,paint);
  Log.d("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
private void drawZone(Canvas canvas,Paint paint,Zone zone){
  Path path=new Path();
  path.setLastPoint(zone.getPoints().get(0).x,zone.getPoints().get(0).y);
  for (  PointF point : zone.getPoints()) {
    path.lineTo(point.x,point.y);
  }
  path.close();
  path.setFillType(FillType.WINDING);
  canvas.drawPath(path,paint);
}
Program: 45289
Project: 45289
Buggy source:
private Vertex findClosestVertexTo(PointF point){
  Vertex closestVertex=graph.getVertex("String_Node_Str");
  float shortestDist=Float.MAX_VALUE;
  for (  Vertex vertex : graph.getVertices()) {
    PointF vertexCoordinates=(PointF)vertex.getProperty(KEY_COORDINATES);
    float distToPoint=(float)Math.sqrt(Math.pow((vertexCoordinates.x - point.x),2) + Math.pow((vertexCoordinates.y - point.y),2));
    if (distToPoint < shortestDist) {
      shortestDist=distToPoint;
      closestVertex=vertex;
      StringBuilder sb=new StringBuilder().append("String_Node_Str");
      sb.append("String_Node_Str" + shortestDist + "String_Node_Str");
      sb.append("String_Node_Str" + closestVertex.getId());
      Log.d(TAG,sb.toString());
    }
  }
  return closestVertex;
}

Fixed version (ground truth):
private Vertex findClosestVertexTo(PointF point){
  Vertex closestVertex=graph.getVertex("String_Node_Str");
  float shortestDist=Float.MAX_VALUE;
  for (  Vertex vertex : graph.getVertices()) {
    PointF vertexCoordinates=(PointF)vertex.getProperty(KEY_COORDINATES);
    StringBuilder sb11=new StringBuilder().append("String_Node_Str");
    sb11.append(vertexCoordinates.x + "String_Node_Str");
    sb11.append(vertexCoordinates.y + "String_Node_Str");
    Log.d(TAG,sb11.toString());
    float distToPoint=(float)Math.sqrt(Math.pow((vertexCoordinates.x - point.x),2) + Math.pow((vertexCoordinates.y - point.y),2));
    StringBuilder sb=new StringBuilder().append("String_Node_Str");
    sb.append(distToPoint + "String_Node_Str");
    Log.d(TAG,sb.toString());
    if (distToPoint < shortestDist) {
      shortestDist=distToPoint;
      closestVertex=vertex;
      StringBuilder sb1=new StringBuilder().append("String_Node_Str");
      sb1.append("String_Node_Str" + shortestDist + "String_Node_Str");
      sb1.append("String_Node_Str" + closestVertex.getId());
      Log.d(TAG,sb1.toString());
    }
  }
  return closestVertex;
}
Program: 45290
Project: 45290
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (resultCode == Activity.RESULT_OK) {
    String roomName=(String)data.getExtras().get(FindRoomActivity.ROOM_NAME_EXTRA);
    RoomsDatabase roomsDatabase=RoomsDatabase.getRoomsDatabase();
    PointF roomCoordinates=roomsDatabase.getRoomCoordinates(roomName);
    StringBuilder sb=new StringBuilder().append("String_Node_Str");
    sb.append(roomCoordinates);
    Log.d(TAG,sb.toString());
    PointF position=new PointF(32.98f,2.92f);
    DijkstraRouter dijkstraRouter=new DijkstraRouter();
    Path routingPath=dijkstraRouter.findRoute(position,roomCoordinates);
    mapView.setRoute(routingPath);
  }
  super.onActivityResult(requestCode,resultCode,data);
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  String roomName=(String)data.getExtras().get(FindRoomActivity.ROOM_NAME_EXTRA);
  RoomsDatabase roomsDatabase=RoomsDatabase.getRoomsDatabase();
  PointF roomCoordinates=roomsDatabase.getRoomCoordinates(roomName);
  StringBuilder sb=new StringBuilder().append("String_Node_Str");
  sb.append(roomName);
  sb.append("String_Node_Str");
  sb.append(roomCoordinates.x);
  sb.append("String_Node_Str");
  sb.append(roomCoordinates.y);
  Log.d(TAG,sb.toString());
  PointF position=new PointF(32.98f,2.92f);
  DijkstraRouter dijkstraRouter=new DijkstraRouter();
  Path routingPath=dijkstraRouter.findRoute(position,roomCoordinates);
  mapView.setRoute(routingPath);
  super.onActivityResult(requestCode,resultCode,data);
}
Program: 45291
Project: 45291
Buggy source:
@Override protected void onDraw(Canvas canvas){
  canvas.save(Canvas.MATRIX_SAVE_FLAG);
  prepareDrawingArea(canvas,getWidth(),getHeight());
  canvas.drawRect(rectFTags,debugRectPaint);
  for (  Tag tag : tags) {
    drawTag(canvas,tagPaint,tag);
  }
  for (  Wall wall : walls) {
    canvas.drawLine(wall.getX1(),wall.getY1(),wall.getX2(),wall.getY2(),wallsPaint);
  }
  for (  Door door : doors) {
    float startAngle=door.getStartAngle();
    if ((door.getLength()) < 0) {
      startAngle=startAngle + 180;
    }
    canvas.drawArc(door.getRectF(),startAngle,door.getSweepAngle(),true,doorsPaint);
  }
  canvas.restore();
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  canvas.save(Canvas.MATRIX_SAVE_FLAG);
  prepareDrawingArea(canvas,getWidth(),getHeight());
  canvas.drawRect(rectFTags,debugRectPaint);
  for (  Tag tag : tags) {
    drawTag(canvas,tagPaint,tag);
  }
  for (  Wall wall : walls) {
    canvas.drawLine(wall.getX1(),wall.getY1(),wall.getX2(),wall.getY2(),wallsPaint);
  }
  for (  Door door : doors) {
    float startAngle=door.getStartAngle();
    if (door.getLength() < 0) {
      startAngle=startAngle + 180;
    }
    canvas.drawArc(door.getRectF(),startAngle,door.getSweepAngle(),true,doorsPaint);
  }
  canvas.restore();
}
Program: 45292
Project: 45292
Buggy source:
public Door(float xAxle,float yAxle,float length,float startAngle,float sweepAngle){
  super();
  this.xAxle=xAxle;
  this.yAxle=yAxle;
  this.length=length;
  this.startAngle=startAngle;
  this.sweepAngle=sweepAngle;
}

Fixed version (ground truth):
public Door(float distanceToAxle,float length,float sweepAngle,float wallX1,float wallY1,double alpha){
  super();
  this.length=length;
  this.sweepAngle=sweepAngle;
  this.xAxle=(float)(Math.cos(alpha)) * distanceToAxle + wallX1;
  this.yAxle=(float)(Math.sin(alpha)) * distanceToAxle + wallY1;
  this.startAngle=(float)(alpha) * 57.2974f;
}
Program: 45293
Project: 45293
Buggy source:
private void recognizeString(String content,boolean debug){
  walls=new ArrayList<Wall>();
  doors=new ArrayList<Door>();
  Pattern oneRow=Pattern.compile("String_Node_Str");
  Pattern oneNumber=Pattern.compile("String_Node_Str");
  String[] allRows=oneRow.split(content);
  for (  String entry : allRows) {
    String[] singlenumber=oneNumber.split(entry);
    if (singlenumber[0].equals("String_Node_Str")) {
      wallX1=Float.parseFloat(singlenumber[1]);
      wallY1=Float.parseFloat(singlenumber[2]);
      wallX2=Float.parseFloat(singlenumber[3]);
      wallY2=Float.parseFloat(singlenumber[4]);
      Wall wall=new Wall(wallX1,wallY1,wallX2,wallY2);
      alpha=wall.getAlpha();
      Log.d(TAG,"String_Node_Str" + wall.toString());
      walls.add(wall);
    }
 else     if (singlenumber[0].equals("String_Node_Str")) {
      Door door=new Door(Float.parseFloat(singlenumber[1]),Float.parseFloat(singlenumber[2]),Float.parseFloat(singlenumber[3]),Float.parseFloat(singlenumber[4]),Float.parseFloat(singlenumber[5]));
      Log.d(TAG,"String_Node_Str" + door.toString());
      doors.add(door);
    }
 else {
      distanceToAxle=Float.parseFloat(singlenumber[0]);
      length=Float.parseFloat(singlenumber[1]);
      sweepAngle=Float.parseFloat(singlenumber[2]);
      this.addDoor(distanceToAxle,length,sweepAngle);
    }
  }
}

Fixed version (ground truth):
private void recognizeString(String content,boolean debug){
  walls=new ArrayList<Wall>();
  doors=new ArrayList<Door>();
  Pattern oneRow=Pattern.compile("String_Node_Str");
  Pattern oneNumber=Pattern.compile("String_Node_Str");
  String[] allRows=oneRow.split(content);
  for (  String entry : allRows) {
    String[] singlenumber=oneNumber.split(entry);
    if (singlenumber[0].equals("String_Node_Str")) {
      wallX1=Float.parseFloat(singlenumber[1]);
      wallY1=Float.parseFloat(singlenumber[2]);
      wallX2=Float.parseFloat(singlenumber[3]);
      wallY2=Float.parseFloat(singlenumber[4]);
      Wall wall=new Wall(wallX1,wallY1,wallX2,wallY2);
      alpha=wall.getAlpha();
      Log.d(TAG,"String_Node_Str" + wall.toString());
      walls.add(wall);
    }
 else     if (singlenumber[0].equals("String_Node_Str")) {
      Door door=new Door(Float.parseFloat(singlenumber[1]),Float.parseFloat(singlenumber[2]),Float.parseFloat(singlenumber[3]),Float.parseFloat(singlenumber[4]),Float.parseFloat(singlenumber[5]));
      Log.d(TAG,"String_Node_Str" + door.toString());
      doors.add(door);
    }
 else {
      Door door=new Door(Float.parseFloat(singlenumber[0]),Float.parseFloat(singlenumber[1]),Float.parseFloat(singlenumber[2]),wallX1,wallY1,alpha);
      Log.d(TAG,"String_Node_Str" + door.toString());
      doors.add(door);
    }
  }
}
Program: 45294
Project: 45294
Buggy source:
@Override public void pause(){
  if (state == GameState.Running)   state=GameState.Paused;
  if (world.gameOver) {
    if (world.score > Settings.highscores[4]) {
      Settings.addScore(world.score,playerName);
    }
    Settings.save(game.getFileIO());
  }
}

Fixed version (ground truth):
@Override public void pause(){
  if (state == GameState.Running)   state=GameState.Paused;
  if (world.gameOver) {
    if (world.score > Settings.highscores[4]) {
      Settings.addScore(world.score,playerName);
      world.score=0;
      playerName=null;
    }
    Settings.save(game.getFileIO());
  }
}
Program: 45295
Project: 45295
Buggy source:
@Override public void update(float deltaTime){
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  game.getInput().getKeyEvents();
  if (state == GameState.Ready)   updateReady(touchEvents);
  if (state == GameState.Running)   updateRunning(touchEvents,deltaTime);
  if (state == GameState.Paused)   updatePaused(touchEvents);
  if (state == GameState.GameOver)   updateGameOver(touchEvents);
}

Fixed version (ground truth):
@Override public void update(float deltaTime){
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  if (state == GameState.Ready)   updateReady(touchEvents);
  if (state == GameState.Running)   updateRunning(touchEvents,keyEvents,deltaTime);
  if (state == GameState.Paused)   updatePaused(touchEvents);
  if (state == GameState.GameOver)   updateGameOver(touchEvents);
}
Program: 45297
Project: 45297
Buggy source:
public void turnUp(){
  direction=UP;
  already_turned=true;
}

Fixed version (ground truth):
public void turnUp(){
  if (direction != DOWN)   direction=UP;
  already_turned=true;
}
Program: 45298
Project: 45298
Buggy source:
public void turnRight(){
  direction=RIGHT;
  already_turned=true;
}

Fixed version (ground truth):
public void turnRight(){
  if (direction != LEFT)   direction=RIGHT;
  already_turned=true;
}
Program: 45299
Project: 45299
Buggy source:
public void turnDown(){
  direction=DOWN;
  already_turned=true;
}

Fixed version (ground truth):
public void turnDown(){
  if (direction != UP)   direction=DOWN;
  already_turned=true;
}
Program: 45300
Project: 45300
Buggy source:
public void turnLeft(){
  direction=LEFT;
  already_turned=true;
}

Fixed version (ground truth):
public void turnLeft(){
  if (direction != RIGHT)   direction=LEFT;
  already_turned=true;
}
Program: 45302
Project: 45302
Buggy source:
@Override public void update(float deltaTime){
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  int len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == kevent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  if (state == GameState.Ready)   updateReady(touchEvents);
  if (state == GameState.Running)   updateRunning(touchEvents,keyEvents,deltaTime);
  if (state == GameState.Paused)   updatePaused(touchEvents);
  if (state == GameState.GameOver)   updateGameOver(touchEvents);
}

Fixed version (ground truth):
@Override public void update(float deltaTime){
  List<TouchEvent> touchEvents=game.getInput().getTouchEvents();
  List<KeyEvent> keyEvents=game.getInput().getKeyEvents();
  int len=keyEvents.size();
  for (int i=0; i < len; i++) {
    KeyEvent kevent=keyEvents.get(i);
    if (kevent.keyCode == android.view.KeyEvent.KEYCODE_BACK && kevent.type == KeyEvent.KEY_UP)     game.setScreen(new MainMenuScreen(game));
  }
  if (state == GameState.Ready)   updateReady(touchEvents);
  if (state == GameState.Running)   updateRunning(touchEvents,keyEvents,deltaTime);
  if (state == GameState.Paused)   updatePaused(touchEvents);
  if (state == GameState.GameOver)   updateGameOver(touchEvents);
}