nus-yam/ex-repair huggingface dataset:
Program: 179447
Project: 179447
Buggy source:
public List<Message> receiveSMSs(boolean markAsRead) throws SmesXException {
  List<Message> messages=new LinkedList<Message>();
  SmesXSMSReceive receiveSMS=null;
  do {
    receiveSMS=new SmesXSMSReceive();
    receiveSMS.setMarkAsRead(markAsRead);
    receiveSMS.setType(UNREAD);
    SmesXResponse response=execute(receiveSMS);
    SmesXOperation operation=response.getOperation();
    if (operation == null) {
      throw new SmesXException("String_Node_Str");
    }
    if (operation instanceof SmesXSMSReceive) {
      receiveSMS=(SmesXSMSReceive)operation;
      if (receiveSMS.containSMS()) {
        SmesXSMS sms=receiveSMS.getSMS();
        Message message=smsToMessage(sms);
        messages.add(message);
        if (receiveSMS.hasMore()) {
          receiveSMS.setAfterID(sms.getId());
        }
      }
    }
 else {
      throw new RuntimeException("String_Node_Str" + operation.getClass().getSimpleName() + "String_Node_Str"+ "String_Node_Str"+ receiveSMS.getClass().getSimpleName()+ "String_Node_Str");
    }
  }
 while (receiveSMS.hasMore());
  return messages;
}

Fixed version (ground truth):
public List<Message> receiveSMSs(boolean markAsRead) throws SmesXException {
  List<Message> messages=new LinkedList<Message>();
  SmesXSMSReceive receiveSMS=new SmesXSMSReceive();
  do {
    receiveSMS.setMarkAsRead(markAsRead);
    receiveSMS.setType(UNREAD);
    SmesXResponse response=execute(receiveSMS);
    SmesXOperation operation=response.getOperation();
    if (operation == null) {
      throw new SmesXException("String_Node_Str");
    }
    if (operation instanceof SmesXSMSReceive) {
      receiveSMS=(SmesXSMSReceive)operation;
      if (receiveSMS.containSMS()) {
        SmesXSMS sms=receiveSMS.getSMS();
        Message message=smsToMessage(sms);
        messages.add(message);
        if (receiveSMS.hasMore()) {
          receiveSMS.setSMS(null);
          receiveSMS.setAfterID(sms.getID());
        }
      }
    }
 else {
      throw new RuntimeException("String_Node_Str" + operation.getClass().getSimpleName() + "String_Node_Str"+ "String_Node_Str"+ receiveSMS.getClass().getSimpleName()+ "String_Node_Str");
    }
  }
 while (receiveSMS.hasMore());
  return messages;
}
Program: 179448
Project: 179448
Buggy source:
/** 
 * Convert   {@link SmesXSMS} to the {@link Message} object.
 * @param sms - SMS to convert
 * @return New message converted from SMS
 */
private Message smsToMessage(SmesXSMS sms){
  String body=sms.getBody();
  String code=null;
  Pattern pat=Pattern.compile("String_Node_Str");
  Matcher matcher=pat.matcher(body);
  if (matcher.find()) {
    code=matcher.group();
  }
  if (code != null) {
    body=body.substring(code.length()).trim();
    code=code.substring(0,code.length() - 1);
  }
  Message message=new Message();
  message.setBody(body);
  message.setCode(code);
  message.setSender(sms.getMSISDN());
  return message;
}

Fixed version (ground truth):
/** 
 * Convert   {@link SmesXSMS} to the {@link Message} object.
 * @param sms - SMS to convert
 * @return New message converted from SMS
 */
protected Message smsToMessage(SmesXSMS sms){
  String body=sms.getBody();
  String code=null;
  Pattern pat=Pattern.compile("String_Node_Str");
  Matcher matcher=pat.matcher(body);
  if (matcher.find()) {
    code=matcher.group();
  }
  if (code != null) {
    body=body.substring(code.length()).trim();
    code=code.substring(0,code.length() - 1);
  }
  Message message=new Message();
  message.setBody(body);
  message.setCode(code);
  message.setSender(sms.getMSISDN());
  return message;
}
Program: 179449
Project: 179449
Buggy source:
public static void main(String[] args){
  Configuration cfg=Configuration.getInstance();
  String usr=cfg.getProperty("String_Node_Str","String_Node_Str");
  String pwd=cfg.getProperty("String_Node_Str","String_Node_Str");
  SmesXProvider p=new SmesXProvider(usr,pwd);
  try {
    Message m=p.receiveSMSForCode("String_Node_Str");
    System.out.println(m);
  }
 catch (  SmesXException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void main(String[] args){
  Configuration cfg=Configuration.getInstance();
  String usr=cfg.getProperty("String_Node_Str","String_Node_Str");
  String pwd=cfg.getProperty("String_Node_Str","String_Node_Str");
  SmesXProvider p=new SmesXProvider(usr,pwd);
  try {
    List<Message> messages=p.receiveSMSsUnread();
    for (    Message m : messages) {
      System.out.println(m);
    }
    System.out.println("String_Node_Str");
    SmesXSMS sms=p.receiveRawSMSForCode("String_Node_Str");
    System.out.println("String_Node_Str" + sms);
    p.markRawSMSAsRead(sms);
    System.out.println("String_Node_Str");
    messages=p.receiveSMSsUnread();
    for (    Message m : messages) {
      System.out.println(m);
    }
  }
 catch (  SmesXException e) {
    e.printStackTrace();
  }
}
Program: 179450
Project: 179450
Buggy source:
/** 
 * Add SMS ID to check status of. 
 * @param id - SMS ID
 */
public void addID(String id){
  if (ids == null) {
    ids=new LinkedList<String>();
  }
  ids.add(id);
}

Fixed version (ground truth):
/** 
 * Add SMS ID to check status of.
 * @param id - SMS ID
 */
public void addID(String id){
  if (ids == null) {
    ids=new LinkedList<String>();
  }
  ids.add(id);
}
Program: 179451
Project: 179451
Buggy source:
public static void main(String[] args) throws IOException {
  Issue issue=new Issue();
  issue.user="String_Node_Str";
  issue.project="String_Node_Str";
  issue.title="String_Node_Str";
  issue.body="String_Node_Str";
  issue.assignee="String_Node_Str";
  new GitHubIssueHelper().openIssue(issue,args[1],args[2]);
}

Fixed version (ground truth):
public static void main(String[] args) throws IOException {
  Issue issue=new Issue();
  issue.user="String_Node_Str";
  issue.project="String_Node_Str";
  issue.title="String_Node_Str";
  issue.body="String_Node_Str";
  issue.assignee="String_Node_Str";
  openIssue(issue,args[0],args[1]);
}
Program: 179452
Project: 179452
Buggy source:
public static void openIssue(Issue issue,String username,String password) throws IOException {
  String apiPage="String_Node_Str" + issue.user + "String_Node_Str"+ issue.project+ "String_Node_Str";
  String authString=username + "String_Node_Str" + password;
  byte[] authEncoded=Base64.encodeBase64(authString.getBytes());
  URL url=new URL(apiPage);
  URLConnection con=url.openConnection();
  con.setRequestProperty("String_Node_Str","String_Node_Str" + new String(authEncoded));
  con.setRequestProperty("String_Node_Str","String_Node_Str");
  con.setDoOutput(true);
  OutputStreamWriter wr=new OutputStreamWriter(con.getOutputStream());
  wr.write(issue.toJson());
  wr.flush();
  InputStream is=con.getInputStream();
  InputStreamReader isr=new InputStreamReader(is);
  int numCharsRead;
  char[] charArray=new char[1024];
  StringBuffer sb=new StringBuffer();
  while ((numCharsRead=isr.read(charArray)) > 0) {
    sb.append(charArray,0,numCharsRead);
  }
  String result=sb.toString();
  System.out.println("String_Node_Str");
  System.out.println(result);
  System.out.println("String_Node_Str");
}

Fixed version (ground truth):
public static void openIssue(Issue issue,String username,String password) throws IOException {
  try {
    String apiPage="String_Node_Str" + issue.user + "String_Node_Str"+ issue.project+ "String_Node_Str";
    String authString=username + "String_Node_Str" + password;
    byte[] authEncoded=Base64.encodeBase64(authString.getBytes());
    URL url=new URL(apiPage);
    URLConnection con=url.openConnection();
    con.setRequestProperty("String_Node_Str","String_Node_Str" + new String(authEncoded));
    con.setRequestProperty("String_Node_Str","String_Node_Str");
    con.setDoOutput(true);
    OutputStreamWriter wr=new OutputStreamWriter(con.getOutputStream());
    wr.write(issue.toJson());
    wr.flush();
    InputStream is=con.getInputStream();
    InputStreamReader isr=new InputStreamReader(is);
    int numCharsRead;
    char[] charArray=new char[1024];
    StringBuffer sb=new StringBuffer();
    while ((numCharsRead=isr.read(charArray)) > 0) {
      sb.append(charArray,0,numCharsRead);
    }
    String result=sb.toString();
    System.out.println("String_Node_Str");
    System.out.println(result);
    System.out.println("String_Node_Str");
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 179453
Project: 179453
Buggy source:
public void setProjectUrl(String githubProjectUrl){
  this.projectUrl=githubProjectUrl;
}

Fixed version (ground truth):
public void setProjectUrl(String projectUrl){
  this.projectUrl=projectUrl;
}
Program: 179454
Project: 179454
Buggy source:
@DataBoundConstructor public GitHubIssueNotifier(String githubProjectUrl){
  if (LOGGER.isLoggable(FINE)) {
    LOGGER.entering(this.getClass().getName(),"String_Node_Str",new Object[]{githubProjectUrl});
  }
  LOGGER.info("String_Node_Str" + githubProjectUrl);
  this.projectUrl=githubProjectUrl;
}

Fixed version (ground truth):
@DataBoundConstructor public GitHubIssueNotifier(String projectUrl){
  if (LOGGER.isLoggable(FINE)) {
    LOGGER.entering(this.getClass().getName(),"String_Node_Str",new Object[]{projectUrl});
  }
  this.projectUrl=projectUrl;
}
Program: 179456
Project: 179456
Buggy source:
void setCourseInfo(String input){
  Pattern pattern1=Pattern.compile("String_Node_Str");
  Matcher matcher1=pattern1.matcher(input);
  Pattern pattern2=Pattern.compile("String_Node_Str");
  Matcher matcher2=pattern2.matcher(input);
  coursesInfo=new ArrayList<CourseInfo>();
  if (matcher1.find() && matcher2.find()) {
    int start=matcher1.start();
    int end=matcher1.end();
    String course_link=input.substring(start,end);
    start=matcher2.start() + 1;
    end=matcher2.end() - 1;
    String course_name=input.substring(start,end);
    coursesInfo.add(new CourseInfo(course_name,course_link));
  }
}

Fixed version (ground truth):
void setCourseInfo(String input){
  Pattern pattern1=Pattern.compile("String_Node_Str");
  Matcher matcher1=pattern1.matcher(input);
  Pattern pattern2=Pattern.compile("String_Node_Str");
  Matcher matcher2=pattern2.matcher(input);
  coursesInfo=new ArrayList<CourseInfo>();
  if (matcher1.find() && matcher2.find()) {
    int start=matcher1.start();
    int end=matcher1.end();
    String course_link=input.substring(start,end);
    start=matcher2.start() + 1;
    end=matcher2.end() - 1;
    String course_name=input.substring(start,end).trim();
    coursesInfo.add(new CourseInfo(course_name,course_link));
  }
}
Program: 179458
Project: 179458
Buggy source:
public static void sendMessage(Rider rider,String suffix){
  Player player=rider.getPlayer();
  LivingEntity ride=rider.getRide();
  if (player != null && ride != null && !(ride instanceof HumanEntity)) {
    player.sendMessage("String_Node_Str" + getHealthString(rider) + "String_Node_Str"+ ride.getType().getName()+ "String_Node_Str"+ rider.getRideType().getNoise()+ suffix);
  }
}

Fixed version (ground truth):
public static void sendMessage(Rider rider,String suffix){
  Player player=rider.getPlayer();
  LivingEntity ride=rider.getRide();
  if (player != null && ride != null && rider.getRideType() != null && !(ride instanceof HumanEntity)) {
    player.sendMessage("String_Node_Str" + getHealthString(rider) + "String_Node_Str"+ ride.getType().getName()+ "String_Node_Str"+ rider.getRideType().getNoise()+ suffix);
  }
}
Program: 179459
Project: 179459
Buggy source:
public void removeRider(Player player){
  Entity entity=player.getVehicle();
  if (entity instanceof LivingEntity) {
    LivingEntity target=(LivingEntity)entity;
    player.eject();
    if (DependencyUtils.hasPermission(player,"String_Node_Str") && hasSpawnEgg(target)) {
      SpawnEggTask spawnEggTask=new SpawnEggTask(target);
      spawnEggTask.setTaskId(Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin,spawnEggTask,0,1));
    }
  }
}

Fixed version (ground truth):
public void removeRider(Player player){
  Entity entity=player.getVehicle();
  if (entity instanceof LivingEntity) {
    LivingEntity target=(LivingEntity)entity;
    player.eject();
    if (DependencyUtils.hasPermission(player,"String_Node_Str")) {
      scheduleSpawnEgg(target);
    }
  }
}
Program: 179460
Project: 179460
Buggy source:
public RiderManager(MobRider plugin){
  this.plugin=plugin;
  metrics=plugin.getMetricsManager();
  configManager=plugin.getConfigManager();
  goalManager=plugin.getGoalManager();
  riders=new ConcurrentHashMap<String,Rider>();
  if (Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin,this,UPDATE_DELAY,Math.min(configManager.updatePeriod,MAX_UPDATE_PERIOD)) < 0) {
    Bukkit.getPluginManager().disablePlugin(plugin);
    LoggerUtil.getInstance().severe("String_Node_Str");
  }
}

Fixed version (ground truth):
public RiderManager(MobRider plugin){
  this.plugin=plugin;
  metrics=plugin.getMetricsManager();
  configManager=plugin.getConfigManager();
  goalManager=plugin.getGoalManager();
  riders=new ConcurrentHashMap<String,Rider>();
  spawnEggTag=new FixedMetadataValue(plugin,true);
  if (Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin,this,UPDATE_DELAY,Math.min(configManager.updatePeriod,MAX_UPDATE_PERIOD)) < 0) {
    Bukkit.getPluginManager().disablePlugin(plugin);
    LoggerUtil.getInstance().severe("String_Node_Str");
  }
}
Program: 179461
Project: 179461
Buggy source:
public void removeRider(Player player){
  Entity entity=player.getVehicle();
  if (entity instanceof LivingEntity) {
    LivingEntity target=(LivingEntity)entity;
    player.eject();
    if (DependencyUtils.hasPermission(player,"String_Node_Str")) {
      scheduleSpawnEgg(target);
    }
  }
}

Fixed version (ground truth):
public void removeRider(Player player){
  Entity entity=player.getVehicle();
  if (entity instanceof LivingEntity) {
    LivingEntity target=(LivingEntity)entity;
    entity.eject();
    if (DependencyUtils.hasPermission(player,"String_Node_Str")) {
      scheduleSpawnEgg(target);
    }
  }
}
Program: 179462
Project: 179462
Buggy source:
private static boolean isAllowed(Player player,Entity entity){
  if (player == null || entity == null) {
    return false;
  }
  if (player.isOp() || isOwner(player,entity)) {
    return true;
  }
  if (entity.getPassenger() != null) {
    player.sendMessage("String_Node_Str");
    return false;
  }
  if (entity instanceof Animals || entity instanceof Squid || entity instanceof Golem|| entity instanceof Villager|| entity instanceof Bat) {
    if (DependencyUtils.hasPermission(player,"String_Node_Str") || DependencyUtils.hasPermission(player,"String_Node_Str" + EntityUtils.getCreatureName(entity).toLowerCase())) {
      return true;
    }
 else {
      player.sendMessage("String_Node_Str");
      return false;
    }
  }
  if (entity instanceof Monster || entity instanceof Ghast || entity instanceof Slime|| entity instanceof EnderDragon) {
    if (DependencyUtils.hasPermission(player,"String_Node_Str") || DependencyUtils.hasPermission(player,"String_Node_Str" + EntityUtils.getCreatureName(entity).toLowerCase())) {
      return true;
    }
 else {
      player.sendMessage("String_Node_Str");
      return false;
    }
  }
  if (entity instanceof Player) {
    if (DependencyUtils.hasPermission(player,"String_Node_Str") || DependencyUtils.hasPermission(player,"String_Node_Str" + ((Player)entity).getName().toLowerCase())) {
      return true;
    }
 else {
      player.sendMessage("String_Node_Str");
      return false;
    }
  }
  return false;
}

Fixed version (ground truth):
private static boolean isAllowed(Player player,Entity entity){
  if (player == null || entity == null) {
    return false;
  }
  if (entity.getPassenger() != null) {
    player.sendMessage("String_Node_Str");
    return false;
  }
  if (entity instanceof Animals || entity instanceof Squid || entity instanceof Golem|| entity instanceof Villager|| entity instanceof Bat) {
    if (DependencyUtils.hasPermission(player,"String_Node_Str") || DependencyUtils.hasPermission(player,"String_Node_Str" + EntityUtils.getCreatureName(entity).toLowerCase())) {
      return true;
    }
 else {
      player.sendMessage("String_Node_Str");
      return false;
    }
  }
  if (entity instanceof Monster || entity instanceof Ghast || entity instanceof Slime|| entity instanceof EnderDragon) {
    if (DependencyUtils.hasPermission(player,"String_Node_Str") || DependencyUtils.hasPermission(player,"String_Node_Str" + EntityUtils.getCreatureName(entity).toLowerCase())) {
      return true;
    }
 else {
      player.sendMessage("String_Node_Str");
      return false;
    }
  }
  if (entity instanceof Player) {
    if (DependencyUtils.hasPermission(player,"String_Node_Str") || DependencyUtils.hasPermission(player,"String_Node_Str" + ((Player)entity).getName().toLowerCase())) {
      return true;
    }
 else {
      player.sendMessage("String_Node_Str");
      return false;
    }
  }
  return false;
}
Program: 179463
Project: 179463
Buggy source:
public static boolean canRide(Player player,Entity entity){
  return isAllowed(player,entity) && isWinner(player,entity) && isWithdrawSuccess(player,entity);
}

Fixed version (ground truth):
public static boolean canRide(Player player,Entity entity){
  return isAllowed(player,entity) && (player.isOp() || isOwner(player,entity) || isWinner(player,entity) && isWithdrawSuccess(player,entity));
}
Program: 179464
Project: 179464
Buggy source:
@Override public void run(){
  for (  String playerName : riders.keySet()) {
    Rider rider=riders.get(playerName);
    if (rider.isValid()) {
      goalManager.update(rider);
    }
 else {
      rider.setTarget(null);
      riders.remove(playerName);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  for (  Entry<String,Rider> entry : riders.entrySet()) {
    String playerName=entry.getKey();
    Rider rider=entry.getValue();
    if (rider.isValid()) {
      goalManager.update(rider);
    }
 else {
      rider.setTarget(null);
      riders.remove(playerName);
    }
  }
}
Program: 179465
Project: 179465
Buggy source:
public RiderManager(MobRider plugin){
  this.plugin=plugin;
  metrics=plugin.getMetricsManager();
  configManager=plugin.getConfigManager();
  goalManager=plugin.getGoalManager();
  riders=new Hashtable<String,Rider>();
  if (Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin,this,UPDATE_DELAY,Math.min(configManager.updatePeriod,MAX_UPDATE_PERIOD)) < 0) {
    Bukkit.getPluginManager().disablePlugin(plugin);
    MRLogger.getInstance().severe("String_Node_Str");
  }
}

Fixed version (ground truth):
public RiderManager(MobRider plugin){
  this.plugin=plugin;
  metrics=plugin.getMetricsManager();
  configManager=plugin.getConfigManager();
  goalManager=plugin.getGoalManager();
  riders=new ConcurrentHashMap<String,Rider>();
  if (Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin,this,UPDATE_DELAY,Math.min(configManager.updatePeriod,MAX_UPDATE_PERIOD)) < 0) {
    Bukkit.getPluginManager().disablePlugin(plugin);
    MRLogger.getInstance().severe("String_Node_Str");
  }
}
Program: 179466
Project: 179466
Buggy source:
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    LivingEntity ride=rider.getRide();
    if (target == null) {
      goalManager.setStopGoal(rider);
    }
 else {
      if (target.isDead()) {
        target=null;
        goalManager.setStopGoal(rider);
      }
 else {
        if (isWithinRange(ride.getLocation(),target.getLocation(),rangeSquared)) {
          rider.setTarget(target);
        }
 else {
          setPathEntity(rider,target.getLocation());
        }
        updateSpeed(rider);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    LivingEntity ride=rider.getRide();
    if (target == null) {
      isGoalDone=true;
    }
 else {
      if (target.isDead()) {
        target=null;
        isGoalDone=true;
      }
 else {
        if (isWithinRange(ride.getLocation(),target.getLocation(),rangeSquared)) {
          rider.setTarget(target);
        }
 else {
          setPathEntity(rider,target.getLocation());
        }
        updateSpeed(rider);
      }
    }
  }
}
Program: 179467
Project: 179467
Buggy source:
public BasicGoal(MobRider plugin){
  configManager=plugin.getConfigManager();
  goalManager=plugin.getGoalManager();
  rangeSquared=configManager.MOUNT_RANGE * configManager.MOUNT_RANGE;
  timeCreated=System.currentTimeMillis();
}

Fixed version (ground truth):
public BasicGoal(MobRider plugin){
  configManager=plugin.getConfigManager();
  rangeSquared=configManager.MOUNT_RANGE * configManager.MOUNT_RANGE;
  timeCreated=System.currentTimeMillis();
  isGoalDone=false;
}
Program: 179468
Project: 179468
Buggy source:
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    rider.setTarget(null);
    LivingEntity ride=rider.getRide();
    if (target == null) {
      goalManager.setStopGoal(rider);
    }
 else {
      if (target.isDead()) {
        target=null;
        goalManager.setStopGoal(rider);
      }
 else {
        if (isWithinRange(ride.getLocation(),target.getLocation(),rangeSquared)) {
          setPathEntity(rider,ride.getLocation());
        }
 else {
          setPathEntity(rider,target.getLocation());
          updateSpeed(rider);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    rider.setTarget(null);
    LivingEntity ride=rider.getRide();
    if (target == null) {
      isGoalDone=true;
    }
 else {
      if (target.isDead()) {
        target=null;
        isGoalDone=true;
      }
 else {
        if (isWithinRange(ride.getLocation(),target.getLocation(),rangeSquared)) {
          setPathEntity(rider,ride.getLocation());
        }
 else {
          setPathEntity(rider,target.getLocation());
          updateSpeed(rider);
        }
      }
    }
  }
}
Program: 179469
Project: 179469
Buggy source:
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    rider.setTarget(null);
    LivingEntity ride=rider.getRide();
    if (target == null) {
      goalManager.setStopGoal(rider);
    }
 else {
      if (target.isDead()) {
        target=null;
        goalManager.setStopGoal(rider);
      }
 else {
        if (isWithinRange(ride.getLocation(),target.getLocation(),rangeSquared)) {
          goalManager.setStopGoal(rider);
        }
 else {
          setPathEntity(rider,target.getLocation());
          updateSpeed(rider);
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    rider.setTarget(null);
    LivingEntity ride=rider.getRide();
    if (target == null) {
      isGoalDone=true;
    }
 else {
      if (target.isDead()) {
        target=null;
        isGoalDone=true;
      }
 else {
        if (isWithinRange(ride.getLocation(),target.getLocation(),rangeSquared)) {
          isGoalDone=true;
        }
 else {
          setPathEntity(rider,target.getLocation());
          updateSpeed(rider);
        }
      }
    }
  }
}
Program: 179470
Project: 179470
Buggy source:
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    rider.setTarget(null);
    LivingEntity ride=rider.getRide();
    if (ride != null) {
      if (isWithinRange(ride.getLocation(),destination,rangeSquared)) {
        goalManager.setStopGoal(rider);
      }
 else {
        setPathEntity(rider,destination);
        updateSpeed(rider);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    rider.setTarget(null);
    LivingEntity ride=rider.getRide();
    if (ride != null) {
      if (isWithinRange(ride.getLocation(),destination,rangeSquared)) {
        isGoalDone=true;
      }
 else {
        setPathEntity(rider,destination);
        updateSpeed(rider);
      }
    }
  }
}
Program: 179471
Project: 179471
Buggy source:
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    rider.setTarget(null);
    LivingEntity ride=rider.getRide();
    if (ride != null) {
      if (isWithinRange(ride.getLocation(),destination,rangeSquared) || isWithinRegion(ride.getLocation())) {
        goalManager.setStopGoal(rider);
      }
 else {
        setPathEntity(rider,destination);
        updateSpeed(rider);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    rider.setTarget(null);
    LivingEntity ride=rider.getRide();
    if (ride != null) {
      if (isWithinRange(ride.getLocation(),destination,rangeSquared) || isWithinRegion(ride.getLocation())) {
        isGoalDone=true;
      }
 else {
        setPathEntity(rider,destination);
        updateSpeed(rider);
      }
    }
  }
}
Program: 179472
Project: 179472
Buggy source:
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    rider.setTarget(null);
    LivingEntity ride=rider.getRide();
    if (ride != null) {
      if (isWithinRange(ride.getLocation(),destination,rangeSquared) || isWithinResidence(ride.getLocation())) {
        goalManager.setStopGoal(rider);
      }
 else {
        setPathEntity(rider,destination);
        updateSpeed(rider);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void executeUpdate(Rider rider){
  if (rider != null) {
    rider.setTarget(null);
    LivingEntity ride=rider.getRide();
    if (ride != null) {
      if (isWithinRange(ride.getLocation(),destination,rangeSquared) || isWithinResidence(ride.getLocation())) {
        isGoalDone=true;
      }
 else {
        setPathEntity(rider,destination);
        updateSpeed(rider);
      }
    }
  }
}
Program: 179473
Project: 179473
Buggy source:
public void update(Rider rider){
  Goal goal=rider.getGoal();
  if (goal != null) {
    goal.executeUpdate(rider);
  }
}

Fixed version (ground truth):
public void update(Rider rider){
  if (rider.hasGoal()) {
    if (rider.getGoal().isGoalDone()) {
      setStopGoal(rider);
    }
    rider.getGoal().executeUpdate(rider);
  }
}
Program: 179474
Project: 179474
Buggy source:
public void setFollowGoal(Rider rider,String entityName){
  LivingEntity entity=findGoal(rider,entityName,configManager.MAX_SEARCH_RANGE);
  if (entity != null) {
    rider.setGoal(new FollowGoal(plugin,entity));
    messageManager.sendMessage(rider,configManager.followConfirmedMessage);
  }
 else {
    messageManager.sendMessage(rider,configManager.followConfusedMessage);
  }
}

Fixed version (ground truth):
public void setFollowGoal(Rider rider,String entityName){
  LivingEntity entity=findLivingEntity(rider,entityName,configManager.MAX_SEARCH_RANGE);
  if (entity != null) {
    rider.setGoal(new FollowGoal(plugin,entity));
    messageManager.sendMessage(rider,configManager.followConfirmedMessage);
  }
 else {
    messageManager.sendMessage(rider,configManager.followConfusedMessage);
  }
}
Program: 179475
Project: 179475
Buggy source:
public void setGotoGoal(Rider rider,String goalName){
  LivingEntity entity;
  if ((entity=findGoal(rider,goalName,configManager.MAX_SEARCH_RANGE)) != null) {
    rider.setGoal(new GotoGoal(plugin,entity));
    messageManager.sendMessage(rider,configManager.goConfirmedMessage);
  }
 else   if (foundPortal(rider,goalName) || foundResidence(rider,goalName) || foundRegion(rider,goalName)) {
    messageManager.sendMessage(rider,configManager.goConfirmedMessage);
  }
 else {
    messageManager.sendMessage(rider,configManager.goConfusedMessage);
  }
}

Fixed version (ground truth):
public void setGotoGoal(Rider rider,String goalName){
  LivingEntity entity;
  if ((entity=findLivingEntity(rider,goalName,configManager.MAX_SEARCH_RANGE)) != null) {
    rider.setGoal(new GotoGoal(plugin,entity));
    messageManager.sendMessage(rider,configManager.goConfirmedMessage);
  }
 else   if (foundPortal(rider,goalName) || foundResidence(rider,goalName) || foundRegion(rider,goalName)) {
    messageManager.sendMessage(rider,configManager.goConfirmedMessage);
  }
 else {
    messageManager.sendMessage(rider,configManager.goConfusedMessage);
  }
}
Program: 179476
Project: 179476
Buggy source:
private static Location getDestination(ProtectedRegion region,World world){
  Location midPoint=null;
  if (region != null && world != null) {
    BlockVector minPoint=region.getMinimumPoint();
    BlockVector maxPoint=region.getMaximumPoint();
    double x=minPoint.getX() + maxPoint.getX() / 2;
    double z=minPoint.getZ() + maxPoint.getZ() / 2;
    midPoint=world.getHighestBlockAt((int)x,(int)z).getLocation();
  }
  return midPoint;
}

Fixed version (ground truth):
private static Location getDestination(ProtectedRegion region,World world){
  Location midPoint=null;
  if (region != null && world != null) {
    BlockVector minPoint=region.getMinimumPoint();
    BlockVector maxPoint=region.getMaximumPoint();
    double x=(minPoint.getX() + maxPoint.getX()) / 2;
    double z=(minPoint.getZ() + maxPoint.getZ()) / 2;
    midPoint=world.getHighestBlockAt((int)x,(int)z).getLocation();
  }
  return midPoint;
}
Program: 179477
Project: 179477
Buggy source:
private static Location getMidPoint(CuboidArea area){
  Location midPoint=null;
  if (area != null) {
    Location lowLoc=area.getLowLoc();
    Location highLoc=area.getHighLoc();
    double x=lowLoc.getX() + highLoc.getX() / 2;
    double z=lowLoc.getZ() + highLoc.getZ() / 2;
    midPoint=area.getWorld().getHighestBlockAt((int)x,(int)z).getLocation();
  }
  return midPoint;
}

Fixed version (ground truth):
private static Location getMidPoint(CuboidArea area){
  Location midPoint=null;
  if (area != null) {
    Location lowLoc=area.getLowLoc();
    Location highLoc=area.getHighLoc();
    double x=(lowLoc.getX() + highLoc.getX()) / 2;
    double z=(lowLoc.getZ() + highLoc.getZ()) / 2;
    midPoint=area.getWorld().getHighestBlockAt((int)x,(int)z).getLocation();
  }
  return midPoint;
}
Program: 179478
Project: 179478
Buggy source:
private void registerKeyBindings(){
  if (hasSpout()) {
    BindingExecutionDelegate riderControlDelegate=new RiderControlDelegate(this);
    SpoutManager.getKeyBindingManager().registerBinding("String_Node_Str",Keyboard.KEY_UP,"String_Node_Str",riderControlDelegate,this);
    SpoutManager.getKeyBindingManager().registerBinding("String_Node_Str",Keyboard.KEY_LEFT,"String_Node_Str",riderControlDelegate,this);
    SpoutManager.getKeyBindingManager().registerBinding("String_Node_Str",Keyboard.KEY_DOWN,"String_Node_Str",riderControlDelegate,this);
    SpoutManager.getKeyBindingManager().registerBinding("String_Node_Str",Keyboard.KEY_RIGHT,"String_Node_Str",riderControlDelegate,this);
  }
}

Fixed version (ground truth):
private void registerKeyBindings(){
  if (hasSpout()) {
    new RiderControlDelegate(this);
  }
}
Program: 179479
Project: 179479
Buggy source:
public RiderControlDelegate(MobRider plugin){
  goalManager=plugin.getGoalManager();
  riderManager=plugin.getRiderManager();
}

Fixed version (ground truth):
public RiderControlDelegate(MobRider plugin){
  goalManager=plugin.getGoalManager();
  riderManager=plugin.getRiderManager();
  SpoutManager.getKeyBindingManager().registerBinding("String_Node_Str",Keyboard.KEY_UP,"String_Node_Str",this,plugin);
  SpoutManager.getKeyBindingManager().registerBinding("String_Node_Str",Keyboard.KEY_LEFT,"String_Node_Str",this,plugin);
  SpoutManager.getKeyBindingManager().registerBinding("String_Node_Str",Keyboard.KEY_DOWN,"String_Node_Str",this,plugin);
  SpoutManager.getKeyBindingManager().registerBinding("String_Node_Str",Keyboard.KEY_RIGHT,"String_Node_Str",this,plugin);
}
Program: 179480
Project: 179480
Buggy source:
protected static boolean isWithinRange(Location start,Location end,double distanceSquared){
  return start.distanceSquared(end) < distanceSquared;
}

Fixed version (ground truth):
protected static boolean isWithinRange(Location start,Location end,double distanceSquared){
  return !start.getWorld().equals(end.getWorld()) || start.distanceSquared(end) < distanceSquared;
}
Program: 179481
Project: 179481
Buggy source:
private Location getInterimLocation(LivingEntity ride,Location destination){
  Location interimTarget=null;
  if (ride != null && ride.getLocation().distanceSquared(destination) > 64.0D) {
    interimTarget=ride.getLocation().clone().add(new Vector(destination.getX() - ride.getLocation().getX(),destination.getY() - ride.getLocation().getY(),destination.getZ() - ride.getLocation().getZ()).normalize().multiply(8));
  }
 else {
    interimTarget=destination;
  }
  return interimTarget;
}

Fixed version (ground truth):
private Location getInterimLocation(LivingEntity ride,Location destination){
  Location interimTarget=null;
  if (ride != null && ride.getLocation().getWorld().equals(destination.getWorld()) && ride.getLocation().distanceSquared(destination) > 64.0D) {
    interimTarget=ride.getLocation().clone().add(new Vector(destination.getX() - ride.getLocation().getX(),destination.getY() - ride.getLocation().getY(),destination.getZ() - ride.getLocation().getZ()).normalize().multiply(8));
  }
 else {
    interimTarget=destination;
  }
  return interimTarget;
}
Program: 179482
Project: 179482
Buggy source:
public void setAttackGoal(Rider rider,LivingEntity entity){
  if (MRUtil.isAggressive(entity)) {
    rider.setGoal(new AttackGoal(plugin,entity));
    messageManager.sendMessage(rider,configManager.attackConfirmedMessage);
  }
 else {
    messageManager.sendMessage(rider,configManager.attackConfusedMessage);
  }
}

Fixed version (ground truth):
public void setAttackGoal(Rider rider,LivingEntity entity){
  if (MRUtil.isAggressive(rider.getRide())) {
    rider.setGoal(new AttackGoal(plugin,entity));
    messageManager.sendMessage(rider,configManager.attackConfirmedMessage);
  }
 else {
    messageManager.sendMessage(rider,configManager.attackConfusedMessage);
  }
}
Program: 179483
Project: 179483
Buggy source:
public boolean isValid(){
  Player player=getPlayer();
  return hasRide(player);
}

Fixed version (ground truth):
public boolean isValid(){
  Player player=getPlayer();
  return hasRide(player) && !player.isDead();
}
Program: 179484
Project: 179484
Buggy source:
public void updateGoal(){
  if (!isCreature())   return;
  if (hasGoal()) {
switch (intent) {
case ATTACK:
      LivingEntity goalEntity=((EntityGoal)goal).getEntity();
    if (vehicle.getBukkitEntity().getLocation().distanceSquared(goalEntity.getLocation()) > ATTACK_RANGE) {
      setPathEntity(((EntityGoal)goal).getEntity().getLocation());
    }
 else {
      setTarget(((EntityGoal)goal).getEntity());
    }
  break;
case FOLLOW:
setTarget(null);
if (vehicle.getBukkitEntity().getLocation().distanceSquared(goal.getLocation()) < GOAL_RANGE) {
setPathEntity(getBukkitEntity().getLocation());
intent=IntentType.PAUSE;
}
 else {
setPathEntity(((EntityGoal)goal).getEntity().getLocation());
}
break;
case PAUSE:
setTarget(null);
if (vehicle.getBukkitEntity().getLocation().distanceSquared(goal.getLocation()) > GOAL_RANGE) {
setPathEntity(((EntityGoal)goal).getEntity().getLocation());
intent=IntentType.FOLLOW;
}
 else {
setPathEntity(getBukkitEntity().getLocation());
}
break;
case MOUNT:
break;
case PASSIVE:
if (vehicle.getBukkitEntity().getLocation().distanceSquared(goal.getLocation()) < GOAL_RANGE) stop();
break;
case STOP:
setTarget(null);
setPathEntity(((LocationGoal)goal).getLocation());
break;
}
updateSpeed();
}
}

Fixed version (ground truth):
public void updateGoal(){
  if (!isCreature())   return;
  if (hasGoal()) {
switch (intent) {
case ATTACK:
      LivingEntity goalEntity=((EntityGoal)goal).getEntity();
    if (vehicle.getBukkitEntity().getLocation().distanceSquared(goalEntity.getLocation()) > ATTACK_RANGE) {
      setPathEntity(((EntityGoal)goal).getEntity().getLocation());
    }
 else {
      setTarget(((EntityGoal)goal).getEntity());
    }
  break;
case FOLLOW:
setTarget(null);
if (vehicle.getBukkitEntity().getLocation().distanceSquared(goal.getLocation()) < GOAL_RANGE) {
setPathEntity(getBukkitEntity().getLocation());
intent=IntentType.PAUSE;
}
 else {
setPathEntity(((EntityGoal)goal).getEntity().getLocation());
}
break;
case PAUSE:
setTarget(null);
if (vehicle.getBukkitEntity().getLocation().distanceSquared(goal.getLocation()) > GOAL_RANGE) {
setPathEntity(((EntityGoal)goal).getEntity().getLocation());
intent=IntentType.FOLLOW;
}
 else {
setPathEntity(getBukkitEntity().getLocation());
}
break;
case MOUNT:
break;
case PASSIVE:
if (vehicle.getBukkitEntity().getLocation().distanceSquared(goal.getLocation()) < GOAL_RANGE) {
stop();
}
 else {
setTarget(null);
setPathEntity(goal.getLocation());
}
break;
case STOP:
setTarget(null);
setPathEntity(((LocationGoal)goal).getLocation());
break;
}
updateSpeed();
}
}
Program: 179485
Project: 179485
Buggy source:
public void setTarget(LivingEntity target){
  LivingEntity ride=getRide();
  if (ride != null) {
    ((Creature)ride).setTarget(target);
  }
}

Fixed version (ground truth):
public void setTarget(LivingEntity target){
  LivingEntity ride=getRide();
  if (ride != null) {
    if (ride instanceof Creature) {
      ((Creature)ride).setTarget(target);
    }
 else     if (ride instanceof Slime) {
    }
 else     if (ride instanceof Ghast) {
    }
 else     if (ride instanceof EnderDragon) {
    }
  }
}
Program: 179486
Project: 179486
Buggy source:
private void setPathEntity(Location location){
  LivingEntity ride=getRide();
  if (ride != null) {
    if (hasNewAI()) {
      if (ride.getLocation().distanceSquared(location) > 64.0D) {
        Vector distance=new Vector(location.getX() - ride.getLocation().getX(),location.getY() - ride.getLocation().getY(),location.getZ() - ride.getLocation().getZ()).normalize().multiply(8);
        ((CraftLivingEntity)ride).getHandle().al().a(ride.getLocation().getX() + distance.getX(),ride.getLocation().getY() + distance.getY(),ride.getLocation().getZ() + distance.getZ(),getSpeed());
      }
 else {
        ((CraftLivingEntity)ride).getHandle().al().a(location.getX(),location.getY(),location.getZ(),getSpeed());
      }
    }
 else {
      ((CraftCreature)ride).getHandle().setPathEntity(new PathEntity(new PathPoint[]{new PathPoint(location.getBlockX(),location.getBlockY(),location.getBlockZ())}));
    }
  }
}

Fixed version (ground truth):
private void setPathEntity(Location location){
  LivingEntity ride=getRide();
  if (ride instanceof CraftCreature) {
    CraftCreature livingEntity=(CraftCreature)ride;
    if (hasNewAI()) {
      Location interimLocation=getInterimLocation(location);
      livingEntity.getHandle().al().a(interimLocation.getX(),interimLocation.getY(),interimLocation.getZ(),getSpeed());
    }
 else {
      ((CraftCreature)ride).getHandle().setPathEntity(new PathEntity(new PathPoint[]{new PathPoint(location.getBlockX(),location.getBlockY(),location.getBlockZ())}));
    }
  }
 else   if (ride instanceof CraftSlime) {
  }
 else   if (ride instanceof CraftGhast) {
  }
 else   if (ride instanceof CraftEnderDragon) {
  }
}
Program: 179487
Project: 179487
Buggy source:
private void updateSpeed(){
  if (!isCreature() || intent == IntentType.STOP) {
    return;
  }
  CreatureType type=MRUtil.getCreatureType(vehicle.getBukkitEntity());
  if (RideType.fromType(type) == null) {
    return;
  }
  Vector velocity=vehicle.getBukkitEntity().getVelocity();
  velocity.normalize().multiply(getSpeed());
  vehicle.getBukkitEntity().setVelocity(velocity);
}

Fixed version (ground truth):
private void updateSpeed(){
  if (!isCreature() || intent == IntentType.STOP) {
    return;
  }
  CreatureType type=MRUtil.getCreatureType(vehicle.getBukkitEntity());
  if (RideType.fromType(type) == null) {
    return;
  }
  Vector velocity=vehicle.getBukkitEntity().getVelocity();
  double saveY=velocity.getY();
  velocity.normalize().multiply(getSpeed());
  velocity.setY(saveY);
  vehicle.getBukkitEntity().setVelocity(velocity);
}
Program: 179488
Project: 179488
Buggy source:
public boolean dispatch(CommandSender sender,Command command,String label,String[] args){
  if (args.length < 1) {
    return false;
  }
 else   if (!isRider(sender)) {
    return true;
  }
  String input=label + "String_Node_Str";
  for (  String s : args) {
    input=input + s + "String_Node_Str";
  }
  BaseCommand match=null;
  String[] trimmedArgs=(String[])null;
  StringBuilder identifier=new StringBuilder();
  for (  BaseCommand cmd : this.commands) {
    StringBuilder tmpIdentifier=new StringBuilder();
    String[] tmpArgs=cmd.validate(input,tmpIdentifier);
    if (tmpIdentifier.length() > identifier.length()) {
      identifier=tmpIdentifier;
      match=cmd;
      trimmedArgs=tmpArgs;
    }
  }
  if (match != null) {
    if (trimmedArgs != null) {
      if (hasPermission(sender,match.getPermission())) {
        match.execute(sender,trimmedArgs);
      }
 else {
        sender.sendMessage("String_Node_Str");
      }
    }
    sender.sendMessage("String_Node_Str" + match.getUsage());
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean dispatch(CommandSender sender,Command command,String label,String[] args){
  if (args.length < 1) {
    return false;
  }
 else   if (!isRider(sender)) {
    return true;
  }
  String input=label + "String_Node_Str";
  for (  String s : args) {
    input=input + s + "String_Node_Str";
  }
  BaseCommand match=null;
  String[] trimmedArgs=(String[])null;
  StringBuilder identifier=new StringBuilder();
  for (  BaseCommand cmd : this.commands) {
    StringBuilder tmpIdentifier=new StringBuilder();
    String[] tmpArgs=cmd.validate(input,tmpIdentifier);
    if (tmpIdentifier.length() > identifier.length()) {
      identifier=tmpIdentifier;
      match=cmd;
      trimmedArgs=tmpArgs;
    }
  }
  if (match != null) {
    if (trimmedArgs != null) {
      if (hasPermission(sender,match.getPermission())) {
        match.execute(sender,trimmedArgs);
      }
 else {
        sender.sendMessage("String_Node_Str");
      }
    }
 else {
      sender.sendMessage("String_Node_Str" + match.getUsage());
    }
    return true;
  }
  return false;
}
Program: 179490
Project: 179490
Buggy source:
public BasicCookieStore getNewCookieStore() throws JSONException, ParseException {
  BasicCookieStore basicCookieStore=new BasicCookieStore();
  Iterator<String> cookieNames=jsonCookies.keys();
  while (cookieNames.hasNext()) {
    String cookieName=cookieNames.next();
    JSONObject cookie=(JSONObject)jsonCookies.get(cookieName);
    System.out.println("String_Node_Str" + cookie);
    BasicClientCookie basicCookie=new BasicClientCookie(cookieName,cookie.getString(VALUE));
    System.out.println(dateFormat);
    System.out.println(cookie.getString(EXPIRES));
    basicCookie.setExpiryDate(new Date(cookie.getString(EXPIRES)));
    basicCookie.setDomain("String_Node_Str");
    basicCookie.setPath("String_Node_Str");
    basicCookieStore.addCookie(basicCookie);
  }
  return basicCookieStore;
}

Fixed version (ground truth):
public BasicCookieStore getNewCookieStore() throws JSONException, ParseException {
  BasicCookieStore basicCookieStore=new BasicCookieStore();
  Iterator<String> cookieNames=jsonCookies.keys();
  while (cookieNames.hasNext()) {
    String cookieName=cookieNames.next();
    JSONObject cookie=(JSONObject)jsonCookies.get(cookieName);
    System.out.println("String_Node_Str" + cookie);
    BasicClientCookie basicCookie=new BasicClientCookie(cookieName,cookie.getString(VALUE));
    System.out.println(cookie.getString(EXPIRES));
    basicCookie.setExpiryDate(dateFormatWithoutTimeZone.parse(cookie.getString(EXPIRES)));
    basicCookie.setDomain("String_Node_Str");
    basicCookie.setPath("String_Node_Str");
    basicCookieStore.addCookie(basicCookie);
  }
  return basicCookieStore;
}
Program: 179491
Project: 179491
Buggy source:
public CookieManager(MyApplication myApp) throws IOException, JSONException, ParseException {
  this.myApp=myApp;
  dateFormat=new SimpleDateFormat(DATE_FORMAT);
  jsonCookies=new JSONObject();
  basicCookies=new BasicCookieStore();
  cookiesFile=myApp.getFileStreamPath(COOKIESFILE);
  if (cookiesFile.exists()) {
    String recoveredJSONStr=readCookiesFromFile();
    System.out.println("String_Node_Str" + recoveredJSONStr);
    if (recoveredJSONStr != null) {
      jsonCookies=new JSONObject(recoveredJSONStr);
      basicCookies=getNewCookieStore();
    }
  }
}

Fixed version (ground truth):
public CookieManager(MyApplication myApp) throws IOException, JSONException, ParseException {
  this.myApp=myApp;
  dateFormatWithoutTimeZone=new SimpleDateFormat(DATE_FORMAT_WITHOUT_TIMEZONE);
  dateFormatWithTimeZone=new SimpleDateFormat(DATE_FORMAT_WITH_TIMEZONE);
  jsonCookies=new JSONObject();
  basicCookies=new BasicCookieStore();
  cookiesFile=myApp.getFileStreamPath(COOKIESFILE);
  if (cookiesFile.exists()) {
    String recoveredJSONStr=readCookiesFromFile();
    System.out.println("String_Node_Str" + recoveredJSONStr);
    if (recoveredJSONStr != null) {
      jsonCookies=new JSONObject(recoveredJSONStr);
      basicCookies=getNewCookieStore();
    }
  }
}
Program: 179492
Project: 179492
Buggy source:
public void storeCookies(CookieStore cookieStore) throws JSONException, IOException {
  System.out.println("String_Node_Str" + basicCookies.getCookies());
  System.out.println("String_Node_Str" + cookieStore.getCookies());
  basicCookies.clearExpired(new Date());
  if (basicCookies.getCookies().size() < cookieStore.getCookies().size()) {
    basicCookies=(BasicCookieStore)cookieStore;
    jsonCookies=new JSONObject();
    List<Cookie> cookieList=cookieStore.getCookies();
    for (int i=0; i < cookieList.size(); i++) {
      Cookie cookie=cookieList.get(i);
      JSONObject jsonCookie=new JSONObject();
      jsonCookie.put(EXPIRES,cookie.getExpiryDate());
      jsonCookie.put(PATH,NULL);
      jsonCookie.put(DOMAIN,Router.mOX);
      jsonCookie.put(VALUE,cookie.getValue());
      jsonCookie.put(NAME,cookie.getName());
      jsonCookies.put(cookie.getName(),jsonCookie);
    }
    System.out.println("String_Node_Str" + jsonCookies);
    writeCookiesToFile();
  }
}

Fixed version (ground truth):
public void storeCookies(CookieStore cookieStore) throws JSONException, IOException {
  System.out.println("String_Node_Str" + basicCookies.getCookies());
  System.out.println("String_Node_Str" + cookieStore.getCookies());
  basicCookies.clearExpired(new Date());
  if (basicCookies.getCookies().size() < cookieStore.getCookies().size()) {
    basicCookies=(BasicCookieStore)cookieStore;
    jsonCookies=new JSONObject();
    List<Cookie> cookieList=cookieStore.getCookies();
    for (int i=0; i < cookieList.size(); i++) {
      Cookie cookie=cookieList.get(i);
      JSONObject jsonCookie=new JSONObject();
      jsonCookie.put(EXPIRES,dateFormatWithoutTimeZone.format(cookie.getExpiryDate()));
      jsonCookie.put(PATH,NULL);
      jsonCookie.put(DOMAIN,Router.mOX);
      jsonCookie.put(VALUE,cookie.getValue());
      jsonCookie.put(NAME,cookie.getName());
      jsonCookies.put(cookie.getName(),jsonCookie);
    }
    System.out.println("String_Node_Str" + jsonCookies);
    writeCookiesToFile();
  }
}
Program: 179493
Project: 179493
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.content_page_template);
  homeBreadcrumb.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent myIntent=new Intent(v.getContext(),MyApplication.getPageClass("String_Node_Str"));
      startActivityForResult(myIntent,0);
    }
  }
);
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.content_page_template);
  homeBreadcrumb.setOnClickListener(new OnClickListener(){
    @Override public void onClick(    View v){
      Intent myIntent=new Intent(v.getContext(),MyApplication.getPageClass("String_Node_Str"));
      HomePage.firstHomeLoad=true;
      startActivityForResult(myIntent,0);
    }
  }
);
}