nus-yam/ex-repair huggingface dataset:
Program: 24590
Project: 24590
Buggy source:
/** 
 * <p> Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>, passing the <code>SchedulingContext</code> associated with this instance. </p>
 */
public Date rescheduleJob(TriggerKey triggerKey,Trigger newTrigger) throws SchedulerException {
  return (Date)invoke("String_Node_Str",new Object[]{triggerKey.getName(),triggerKey.getGroup(),newTrigger},new String[]{String.class.getName(),String.class.getName(),Trigger.class.getName()});
}

Fixed version (ground truth):
/** 
 * <p> Calls the equivalent method on the 'proxied' <code>QuartzScheduler</code>, passing the <code>SchedulingContext</code> associated with this instance. </p>
 */
public Date rescheduleJob(TriggerKey triggerKey,Trigger newTrigger) throws SchedulerException {
  return (Date)invoke("String_Node_Str",new Object[]{triggerKey,newTrigger},new String[]{TriggerKey.class.getName(),Trigger.class.getName()});
}
Program: 24591
Project: 24591
Buggy source:
/** 
 * Find the key of the first non-serializable value in the given Map.
 * @return The key of the first non-serializable value in the given Map or null if all values are serializable.
 */
protected Object getKeyOfNonSerializableValue(Map data){
  for (Iterator entryIter=data.entrySet().iterator(); entryIter.hasNext(); ) {
    Map.Entry entry=(Map.Entry)entryIter.next();
    ByteArrayOutputStream baos=null;
    try {
      serializeObject(entry.getValue());
    }
 catch (    IOException e) {
      return entry.getKey();
    }
 finally {
      if (baos != null) {
        try {
          baos.close();
        }
 catch (        IOException ignore) {
        }
      }
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Find the key of the first non-serializable value in the given Map.
 * @return The key of the first non-serializable value in the given Map or null if all values are serializable.
 */
protected Object getKeyOfNonSerializableValue(Map data){
  for (Iterator entryIter=data.entrySet().iterator(); entryIter.hasNext(); ) {
    Map.Entry entry=(Map.Entry)entryIter.next();
    ByteArrayOutputStream baos=null;
    try {
      baos=serializeObject(entry.getValue());
    }
 catch (    IOException e) {
      return entry.getKey();
    }
 finally {
      if (baos != null) {
        try {
          baos.close();
        }
 catch (        IOException ignore) {
        }
      }
    }
  }
  return null;
}
Program: 24592
Project: 24592
Buggy source:
public RecoverMisfiredJobsResult(boolean hasMoreMisfiredTriggers,int processedMisfiredTriggerCount,long _earliestNewTime){
  _hasMoreMisfiredTriggers=hasMoreMisfiredTriggers;
  _processedMisfiredTriggerCount=processedMisfiredTriggerCount;
}

Fixed version (ground truth):
public RecoverMisfiredJobsResult(boolean hasMoreMisfiredTriggers,int processedMisfiredTriggerCount,long earliestNewTime){
  _hasMoreMisfiredTriggers=hasMoreMisfiredTriggers;
  _processedMisfiredTriggerCount=processedMisfiredTriggerCount;
  _earliestNewTime=earliestNewTime;
}
Program: 24593
Project: 24593
Buggy source:
public void addRuleInstances(Digester digester){
  digester.addObjectCreate(prefix,clazz);
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_NAME,"String_Node_Str");
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_GROUP,"String_Node_Str");
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_DESCRIPTION,"String_Node_Str");
  digester.addRule(prefix + "String_Node_Str" + TAG_MISFIRE_INSTRUCTION,new MisfireInstructionRule("String_Node_Str"));
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_CALENDAR_NAME,"String_Node_Str");
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_JOB_NAME,"String_Node_Str");
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_JOB_GROUP,"String_Node_Str");
  Converter converter=new DateConverter(new String[]{XSD_DATE_FORMAT,DTD_DATE_FORMAT});
  digester.addRule(prefix + "String_Node_Str" + TAG_START_TIME,new SimpleConverterRule("String_Node_Str",converter,Date.class));
  digester.addRule(prefix + "String_Node_Str" + TAG_END_TIME,new SimpleConverterRule("String_Node_Str",converter,Date.class));
}

Fixed version (ground truth):
public void addRuleInstances(Digester digester){
  digester.addObjectCreate(prefix,clazz);
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_NAME,"String_Node_Str");
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_GROUP,"String_Node_Str");
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_DESCRIPTION,"String_Node_Str");
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_VOLATILITY,"String_Node_Str");
  digester.addRule(prefix + "String_Node_Str" + TAG_MISFIRE_INSTRUCTION,new MisfireInstructionRule("String_Node_Str"));
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_CALENDAR_NAME,"String_Node_Str");
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_JOB_NAME,"String_Node_Str");
  digester.addBeanPropertySetter(prefix + "String_Node_Str" + TAG_JOB_GROUP,"String_Node_Str");
  Converter converter=new DateConverter(new String[]{XSD_DATE_FORMAT,DTD_DATE_FORMAT});
  digester.addRule(prefix + "String_Node_Str" + TAG_START_TIME,new SimpleConverterRule("String_Node_Str",converter,Date.class));
  digester.addRule(prefix + "String_Node_Str" + TAG_END_TIME,new SimpleConverterRule("String_Node_Str",converter,Date.class));
}
Program: 24594
Project: 24594
Buggy source:
/** 
 * <p> Get the convenience <code>JobDataMap</code> of this execution context. </p> <p> The <code>JobDataMap</code> found on this object serves as a convenience - it is a merge of the <code>JobDataMap</code> found on the  <code>JobDetail</code> and the one found on the <code>Trigger</code>, with  the value in the latter overriding any same-named values in the former. <i>It is thus considered a 'best practice' that the execute code of a Job retrieve data from the JobDataMap found on this object.</i> </p>
 */
public JobDataMap getJobDataMap(){
  return jobDataMap;
}

Fixed version (ground truth):
/** 
 * <p> Get the convenience <code>JobDataMap</code> of this execution context. </p> <p> The <code>JobDataMap</code> found on this object serves as a convenience - it is a merge of the <code>JobDataMap</code> found on the  <code>JobDetail</code> and the one found on the <code>Trigger</code>, with  the value in the latter overriding any same-named values in the former. <i>It is thus considered a 'best practice' that the execute code of a Job retrieve data from the JobDataMap found on this object</i> </p> <p>NOTE: Do not expect value 'set' into this JobDataMap to somehow be set back onto a <code>StatefulJob</code>'s own JobDataMap. </p>
 */
public JobDataMap getJobDataMap(){
  return jobDataMap;
}
Program: 24595
Project: 24595
Buggy source:
/** 
 * <p> Create a JobExcecutionContext with the given context data. </p>
 */
public JobExecutionContext(Scheduler scheduler,TriggerFiredBundle firedBundle,Job job){
  this.scheduler=scheduler;
  this.trigger=firedBundle.getTrigger();
  this.calendar=firedBundle.getCalendar();
  this.jobDetail=firedBundle.getJobDetail();
  this.job=job;
  this.recovering=firedBundle.isRecovering();
  this.fireTime=firedBundle.getFireTime();
  this.scheduledFireTime=firedBundle.getScheduledFireTime();
  this.prevFireTime=firedBundle.getPrevFireTime();
  this.nextFireTime=firedBundle.getNextFireTime();
  this.jobDataMap=jobDetail.getJobDataMap();
  jobDataMap.putAll(trigger.getJobDataMap());
}

Fixed version (ground truth):
/** 
 * <p> Create a JobExcecutionContext with the given context data. </p>
 */
public JobExecutionContext(Scheduler scheduler,TriggerFiredBundle firedBundle,Job job){
  this.scheduler=scheduler;
  this.trigger=firedBundle.getTrigger();
  this.calendar=firedBundle.getCalendar();
  this.jobDetail=firedBundle.getJobDetail();
  this.job=job;
  this.recovering=firedBundle.isRecovering();
  this.fireTime=firedBundle.getFireTime();
  this.scheduledFireTime=firedBundle.getScheduledFireTime();
  this.prevFireTime=firedBundle.getPrevFireTime();
  this.nextFireTime=firedBundle.getNextFireTime();
  this.jobDataMap=new JobDataMap();
  this.jobDataMap.putAll(jobDetail.getJobDataMap());
  this.jobDataMap.putAll(trigger.getJobDataMap());
}
Program: 24597
Project: 24597
Buggy source:
private void createPicture2(Graphics2D g){
  g.setColor(Color.GRAY);
  g.fillRect(0,0,205,304);
  ArrayList<GameItem> items=player.getInventory().getItems();
  int x=0, y=0;
  for (int i=0; i < items.size(); i++) {
    drawItem(items.get(i),g,2 + x * 40,29 + y * 40);
    if (++x == 5) {
      x=0;
      y++;
    }
  }
  g.drawImage(Resources.getImage("String_Node_Str"),0,27,this);
  g.setColor(Color.YELLOW);
  g.setFont(new Font("String_Node_Str",Font.PLAIN,20));
  g.drawString(player.getMoney() + "String_Node_Str",90,287);
}

Fixed version (ground truth):
private void createPicture2(Graphics2D g){
  g.setColor(Color.GRAY);
  g.fillRect(0,0,205,304);
  ArrayList<GameItem> items=player.getInventory().getItems();
  for (int i=0; i < items.size(); i++) {
    drawItem(items.get(i),g,2 + (i % 5) * 40,29 + (i / 5) * 40);
  }
  g.drawImage(Resources.getImage("String_Node_Str"),0,27,this);
  g.setColor(Color.YELLOW);
  g.setFont(new Font("String_Node_Str",Font.PLAIN,20));
  g.drawString(player.getMoney() + "String_Node_Str",90,287);
}
Program: 24598
Project: 24598
Buggy source:
@Override public void mouseClicked(MouseEvent e){
  int x=e.getX(), y=e.getY();
  int bodyPart=getEquipPlace(x,y);
  if (bodyPart != -1 && !player.isFree(bodyPart))   addActionRequest("String_Node_Str" + player.name + "String_Node_Str"+ bodyPart);
  if (x < 440 || x > 630 || y < 30 || y > 260)   return;
  x-=440;
  y-=30;
  x/=40;
  y/=40;
  int itemIndex=x + 5 * y;
  if (itemIndex < player.getInventory().getMaxSize()) {
    GameItem item=player.getInventory().getItem(itemIndex);
    if (item != null) {
      if (item instanceof Weapon || item instanceof Armor) {
        if (e.getButton() == 3)         addActionRequest("String_Node_Str" + player.name + "String_Node_Str"+ itemIndex);
 else         addActionRequest("String_Node_Str" + player.name + "String_Node_Str"+ itemIndex);
      }
 else       if (item instanceof UsableItem) {
        addActionRequest("String_Node_Str" + player.name + "String_Node_Str"+ itemIndex);
      }
    }
  }
}

Fixed version (ground truth):
@Override public void mouseClicked(MouseEvent e){
  int x=e.getX(), y=e.getY();
  int bodyPart=getEquipPlace(x,y);
  if (bodyPart != -1 && !player.isFree(bodyPart))   addActionRequest("String_Node_Str" + player.name + "String_Node_Str"+ bodyPart);
  if (x < 440 || x > 630 || y < 30 || y > 260)   return;
  x-=440;
  y-=30;
  x/=40;
  y/=40;
  int itemIndex=x + 5 * y;
  if (itemIndex < player.getInventory().getSize()) {
    GameItem item=player.getInventory().getItem(itemIndex);
    if (item != null) {
      if (item instanceof Weapon || item instanceof Armor) {
        if (e.getButton() == 3)         addActionRequest("String_Node_Str" + player.name + "String_Node_Str"+ itemIndex);
 else         addActionRequest("String_Node_Str" + player.name + "String_Node_Str"+ itemIndex);
      }
 else       if (item instanceof UsableItem) {
        addActionRequest("String_Node_Str" + player.name + "String_Node_Str"+ itemIndex);
      }
    }
  }
}
Program: 24599
Project: 24599
Buggy source:
@Override public void mouseMoved(MouseEvent e){
  int x=e.getX(), y=e.getY();
  int bodyPart=getEquipPlace(x,y);
  if (bodyPart != -1) {
    setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    selectedItem=player.getEquip(bodyPart);
    runOnUIThread(new Runnable(){
      @Override public void run(){
        if (selectedItem != null)         itemInfoLabel.setText(infoButton.getText().equals(INFO_ON) ? selectedItem.toPseudoHTML() : selectedItem.toPseudoHTMLShort());
      }
    }
);
    return;
  }
  if (x < 440 || x > 630 || y < 30 || y > 260) {
    setCursor(Cursor.getDefaultCursor());
    return;
  }
  x-=440;
  y-=30;
  x/=40;
  y/=40;
  setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  int itemIndex=x + 5 * y;
  if (itemIndex < player.getInventory().getMaxSize()) {
    GameItem item=player.getInventory().getItem(itemIndex);
    if (item != null && item != selectedItem) {
      selectedItem=item;
      runOnUIThread(new Runnable(){
        @Override public void run(){
          if (selectedItem != null)           itemInfoLabel.setText(infoButton.getText().equals(INFO_ON) ? selectedItem.toPseudoHTML() : selectedItem.toPseudoHTMLShort());
        }
      }
);
    }
  }
}

Fixed version (ground truth):
@Override public void mouseMoved(MouseEvent e){
  int x=e.getX(), y=e.getY();
  int bodyPart=getEquipPlace(x,y);
  if (bodyPart != -1) {
    setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    selectedItem=player.getEquip(bodyPart);
    runOnUIThread(new Runnable(){
      @Override public void run(){
        if (selectedItem != null)         itemInfoLabel.setText(infoButton.getText().equals(INFO_ON) ? selectedItem.toPseudoHTML() : selectedItem.toPseudoHTMLShort());
      }
    }
);
    return;
  }
  if (x < 440 || x > 630 || y < 30 || y > 260) {
    setCursor(Cursor.getDefaultCursor());
    return;
  }
  x-=440;
  y-=30;
  x/=40;
  y/=40;
  setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  int itemIndex=x + 5 * y;
  if (itemIndex < player.getInventory().getSize()) {
    GameItem item=player.getInventory().getItem(itemIndex);
    if (item != null && item != selectedItem) {
      selectedItem=item;
      runOnUIThread(new Runnable(){
        @Override public void run(){
          if (selectedItem != null)           itemInfoLabel.setText(infoButton.getText().equals(INFO_ON) ? selectedItem.toPseudoHTML() : selectedItem.toPseudoHTMLShort());
        }
      }
);
    }
  }
}
Program: 24600
Project: 24600
Buggy source:
public boolean addItem(GameItem item){
  if (items.size() < size) {
    return items.add(item);
  }
  Out.err("String_Node_Str");
  return false;
}

Fixed version (ground truth):
/** 
 * Adds item to inventory if inventory isnt full
 * @param item item to add
 * @return true if added, false otherwise
 */
public boolean addItem(GameItem item){
  if (isFull()) {
    Out.err("String_Node_Str");
    return false;
  }
  return items.add(item);
}
Program: 24601
Project: 24601
Buggy source:
public GameItem removeItem(GameItem item){
  if (!items.remove(item))   Out.err("String_Node_Str");
  return item;
}

Fixed version (ground truth):
/** 
 * Removes item from the inventory if it is in it
 * @param item
 * @return true if removed, false otherwise
 */
public boolean removeItem(GameItem item){
  if (!items.remove(item)) {
    Out.err("String_Node_Str");
    return false;
  }
  return true;
}
Program: 24602
Project: 24602
Buggy source:
public ArrayList<GameItem> getItems(){
  return new ArrayList<GameItem>(items);
}

Fixed version (ground truth):
/** 
 * @return a new copy of items list, retaining references to original items
 */
public ArrayList<GameItem> getItems(){
  return new ArrayList<GameItem>(items);
}
Program: 24603
Project: 24603
Buggy source:
public GameItem getItem(int index){
  if (index < items.size())   return items.get(index);
 else   return null;
}

Fixed version (ground truth):
/** 
 * Retrieve item at given index
 * @param index
 * @return item if index less than inventory size otherwise null
 */
public GameItem getItem(int index){
  return index < items.size() ? items.get(index) : null;
}
Program: 24604
Project: 24604
Buggy source:
public boolean isFull(){
  return items.size() >= size;
}

Fixed version (ground truth):
/** 
 * @return true if number of items in inventory reached maximum false otherwise
 */
public boolean isFull(){
  return items.size() == MAX_SIZE;
}
Program: 24606
Project: 24606
Buggy source:
public void update(){
  regenTick+=0.05f;
  if (regenTick >= 2.0f) {
    hp=Math.min((int)getTotalStat(MAX_HP),(int)(hp + getTotalStat(HP_REGEN)));
    sp=Math.min((int)getTotalStat(MAX_SP),(int)(sp + getTotalStat(SP_REGEN)));
    regenTick=0.0f;
  }
  for (  Skill sk : skills) {
    if (sk.active) {
      if (sk.getCurrentCooldown() > 0) {
        sk.reduceCurrentCooldown(0.05f);
      }
    }
 else {
      if (sk.getLevel() > 0)       sk.use(this,null);
    }
  }
  updateEffects();
  updateStatusEffects();
}

Fixed version (ground truth):
public void update(){
  regenTick+=0.05f;
  if (regenTick >= 2.0f) {
    hp=Math.min((int)getTotalStat(MAX_HP),(int)(hp + getTotalStat(HP_REGEN)));
    sp=Math.min((int)getTotalStat(MAX_SP),(int)(sp + getTotalStat(SP_REGEN)));
    regenTick=0.0f;
  }
  for (  Skill sk : skills) {
    if (sk.active) {
      if (sk.getCurrentCooldown() > 0) {
        sk.reduceCurrentCooldown(0.05f);
      }
    }
 else {
      if (sk.getLevel() > 0)       sk.use(this,null);
    }
  }
  updateEffects();
  updateStatusEffects();
  calculateStats();
}
Program: 24607
Project: 24607
Buggy source:
/** 
 * @param type
 * @param target can be null
 */
public AgentBehaviour(AgentType type,AgentGoalTarget target){
  this.type=type;
  currentGoal=type.initialGoal;
  currentTarget=target;
}

Fixed version (ground truth):
public AgentBehaviour(AgentType type,AgentGoal goal,AgentMode mode){
  this.type=type;
  currentGoal=goal;
  currentMode=mode;
}
Program: 24608
Project: 24608
Buggy source:
public AgentRule(AgentType type,AgentGoal goal){
  this.type=type;
  this.goal=goal;
}

Fixed version (ground truth):
public AgentRule(AgentType type,AgentGoal goal,AgentMode mode){
  this.type=type;
  this.goal=goal;
  this.mode=mode;
}
Program: 24609
Project: 24609
Buggy source:
public abstract void execute(EnemyAgent agent,AgentGoalTarget target);

Fixed version (ground truth):
public abstract void execute(Enemy agent,AgentGoalTarget target);
Program: 24610
Project: 24610
Buggy source:
public boolean matches(AgentType type,AgentGoal goal){
  return this.type == type && this.goal == goal;
}

Fixed version (ground truth):
public boolean matches(AgentType type,AgentGoal goal,AgentMode mode){
  return this.type == type && this.goal == goal && this.mode == mode;
}
Program: 24612
Project: 24612
Buggy source:
public void unEquipItem(int itemPlace){
  if (isFree(itemPlace) || inventory.isFull())   return;
  equip[itemPlace].onUnEquip(this);
  inventory.addItem(equip[itemPlace]);
  equip[itemPlace]=itemPlace >= RIGHT_HAND ? ObjectManager.getWeaponByID(ID.Weapon.HANDS) : ObjectManager.getArmorByID("String_Node_Str" + itemPlace);
  calculateStats();
}

Fixed version (ground truth):
public void unEquipItem(int itemPlace){
  if (isFree(itemPlace) || inventory.isFull())   return;
  if (equip[itemPlace] instanceof Weapon) {
    Weapon w=(Weapon)equip[itemPlace];
    if (w.type.ordinal() >= WeaponType.TWO_H_SWORD.ordinal()) {
      if (itemPlace == RIGHT_HAND)       equip[LEFT_HAND]=ObjectManager.getWeaponByID(ID.Weapon.HANDS);
 else       equip[RIGHT_HAND]=ObjectManager.getWeaponByID(ID.Weapon.HANDS);
    }
  }
  equip[itemPlace].onUnEquip(this);
  inventory.addItem(equip[itemPlace]);
  equip[itemPlace]=itemPlace >= RIGHT_HAND ? ObjectManager.getWeaponByID(ID.Weapon.HANDS) : ObjectManager.getArmorByID("String_Node_Str" + itemPlace);
  calculateStats();
}
Program: 24613
Project: 24613
Buggy source:
public StatsGUI(final Player p){
  super(640,304,"String_Node_Str",true);
  this.setLocation(0,720);
  attributes.setBounds(0,0,320,304);
  stats.setBounds(320,0,320,304);
  attributes.setFocusable(false);
  stats.setFocusable(false);
  attributes.setVerticalAlignment(SwingConstants.TOP);
  stats.setVerticalAlignment(SwingConstants.TOP);
  attributes.setFont(new Font("String_Node_Str",Font.PLAIN,22));
  stats.setFont(new Font("String_Node_Str",Font.PLAIN,18));
  this.add(attributes);
  this.add(stats);
  for (int i=GameCharacter.STR; i <= GameCharacter.LUC; i++) {
    final int attr=i;
    buttons[i]=new JButton("String_Node_Str");
    buttons[i].setBounds(125,3 + 30 * i,45,28);
    buttons[i].setFont(new Font("String_Node_Str",Font.PLAIN,18));
    buttons[i].addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        actions.add("String_Node_Str" + p.name + "String_Node_Str"+ attr);
      }
    }
);
    add(buttons[i]);
  }
  setVisible(true);
}

Fixed version (ground truth):
public StatsGUI(final Player p){
  super(640,304,"String_Node_Str",true);
  this.setLocation(0,720);
  attributes.setBounds(0,0,320,304);
  stats.setBounds(320,0,320,304);
  attributes.setFocusable(false);
  stats.setFocusable(false);
  attributes.setVerticalAlignment(SwingConstants.TOP);
  stats.setVerticalAlignment(SwingConstants.TOP);
  attributes.setFont(new Font("String_Node_Str",Font.PLAIN,22));
  stats.setFont(new Font("String_Node_Str",Font.PLAIN,18));
  this.add(attributes);
  this.add(stats);
  for (int i=GameCharacter.STR; i <= GameCharacter.LUC; i++) {
    final int attr=i;
    buttons[i]=new JButton("String_Node_Str");
    buttons[i].setBounds(125,3 + 30 * i,45,28);
    buttons[i].setFont(new Font("String_Node_Str",Font.PLAIN,18));
    buttons[i].addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        actions.add("String_Node_Str" + p.name + "String_Node_Str"+ attr);
      }
    }
);
    add(buttons[i]);
  }
  ToolTipManager.sharedInstance().setInitialDelay(0);
  JButton btn=new JButton();
  btn.setLocation(150,150);
  btn.setSize(40,40);
  btn.setIcon(new ImageIcon(Resources.getImage("String_Node_Str")));
  btn.setToolTipText("String_Node_Str");
  this.add(btn);
  setVisible(true);
}
Program: 24614
Project: 24614
Buggy source:
private Player getPlayerByName(String name){
  for (  Player p : players)   if (p.name.equals(name))   return p;
  return null;
}

Fixed version (ground truth):
/** 
 * @param name player name
 * @return player if name exists on the server, if not then null
 */
private Player getPlayerByName(String name){
  for (  Player p : players)   if (p.name.equals(name))   return p;
  return null;
}
Program: 24616
Project: 24616
Buggy source:
public int dealDamage(GameCharacter target){
  int totalDamage=0, totalPhysicalDamage=0, totalMagicalDamage=0;
  double elementalDamageModifier=getWeaponElement().getDamageModifierAgainst(target.getArmorElement());
  int basePhysicalDamage=(int)getTotalStat(ATK);
  if (GameMath.checkChance((int)getTotalStat(CRIT))) {
    basePhysicalDamage*=atkCritDmg;
  }
  int physicalDamageAfterReduction=(int)(((100 - target.getTotalStat(ARM)) * basePhysicalDamage) / 100.0 - target.getTotalStat(DEF) + GameMath.random(baseLevel));
  totalPhysicalDamage=(int)(elementalDamageModifier * physicalDamageAfterReduction);
  totalDamage=totalPhysicalDamage + totalMagicalDamage;
  if (totalDamage > 0) {
    target.hp-=totalDamage;
  }
  return totalDamage;
}

Fixed version (ground truth):
public int dealDamage(GameCharacter target){
  int totalDamage=0, totalPhysicalDamage=0, totalMagicalDamage=0;
  double elementalDamageModifier=getWeaponElement().getDamageModifierAgainst(target.getArmorElement());
  int basePhysicalDamage=(int)getTotalStat(ATK);
  if (GameMath.checkChance((int)getTotalStat(CRIT))) {
    basePhysicalDamage*=atkCritDmg;
  }
  int physicalDamageAfterReduction=(int)(((100 - target.getTotalStat(ARM)) * basePhysicalDamage) / 100.0 - target.getTotalStat(DEF) + GameMath.random(baseLevel));
  totalPhysicalDamage=(int)(elementalDamageModifier * physicalDamageAfterReduction);
  totalDamage=totalPhysicalDamage + totalMagicalDamage;
  totalDamage=Math.max(totalDamage,0);
  target.hp-=totalDamage;
  return totalDamage;
}
Program: 24618
Project: 24618
Buggy source:
private void spawnEnemy(String id,int x,int y){
  Enemy e=ObjectManager.getEnemyByID(id);
  e.setRuntimeID(runtimeID++);
  e.setX(x);
  e.setY(y);
  enemies.add(e);
}

Fixed version (ground truth):
/** 
 * Spawns an enemy with given ID at x, y Also assigns runtimeID to that enemy
 * @param id ID of enemy to spawn
 * @param x x coord
 * @param y y coord
 */
private void spawnEnemy(String id,int x,int y){
  Enemy e=ObjectManager.getEnemyByID(id);
  e.setRuntimeID(runtimeID++);
  e.setX(x);
  e.setY(y);
  enemies.add(e);
}
Program: 24619
Project: 24619
Buggy source:
public void addEffect(Effect e){
synchronized (effects) {
    effects.add(e);
  }
}

Fixed version (ground truth):
public void addEffect(Effect e){
synchronized (effects) {
    e.onBegin(this);
    effects.add(e);
  }
}
Program: 24620
Project: 24620
Buggy source:
public void updateEffects(){
  for (Iterator<Effect> it=effects.iterator(); it.hasNext(); ) {
    Effect e=it.next();
    e.reduceDuration(0.05f);
    if (e.getDuration() <= 0)     it.remove();
  }
}

Fixed version (ground truth):
public void updateEffects(){
  for (Iterator<Effect> it=effects.iterator(); it.hasNext(); ) {
    Effect e=it.next();
    e.reduceDuration(0.05f);
    if (e.getDuration() <= 0) {
      e.onEnd(this);
      it.remove();
    }
  }
}
Program: 24621
Project: 24621
Buggy source:
@Override public void attackAI(AgentGoalTarget target){
  if (target instanceof GameCharacter)   this.attack((GameCharacter)target);
}

Fixed version (ground truth):
@Override public void attackAI(AgentGoalTarget target){
  for (int i=0; i < 3; i++) {
    if (x > target.getX())     xSpeed=-1;
    if (x < target.getX())     xSpeed=1;
    if (y > target.getY())     ySpeed=-1;
    if (y < target.getY())     ySpeed=1;
    if (x == target.getX() && y == target.getY())     AI.currentTarget=null;
    move();
    xSpeed=0;
    ySpeed=0;
  }
}
Program: 24624
Project: 24624
Buggy source:
@Override public void execute(EnemyAgent agent,AgentGoalTarget target){
  List<Player> tmpPlayers=new ArrayList<Player>(players);
  for (  Player p : tmpPlayers) {
    if (agent.canSee(p)) {
      target=p;
      break;
    }
  }
  if (target != null)   agent.attackAI(target);
}

Fixed version (ground truth):
@Override public void execute(EnemyAgent agent,AgentGoalTarget target){
  List<Player> tmpPlayers=new ArrayList<Player>(players);
  for (  Player p : tmpPlayers) {
    if (agent.canSee(p)) {
      target=p;
      break;
    }
  }
  if (target != null)   processBasicAttack(agent,target);
}
Program: 24626
Project: 24626
Buggy source:
private void drawImage2(Graphics2D g){
  g.setColor(Color.GRAY);
  g.fillRect(0,0,205,304);
  ArrayList<GameItem> items=player.getInventory().getItems();
  int x=0, y=0;
  for (int i=0; i < items.size(); i++) {
    drawItem(items.get(i),g,2 + x * 40,29 + y * 40);
    if (++x == 6) {
      x=0;
      y++;
    }
  }
  g.drawImage(Resources.getImage("String_Node_Str"),0,27,this);
  g.setColor(Color.YELLOW);
  g.setFont(new Font("String_Node_Str",Font.PLAIN,20));
  g.drawString(player.getMoney() + "String_Node_Str",90,287);
}

Fixed version (ground truth):
private void drawImage2(Graphics2D g){
  g.setColor(Color.GRAY);
  g.fillRect(0,0,205,304);
  ArrayList<GameItem> items=player.getInventory().getItems();
  int x=0, y=0;
  for (int i=0; i < items.size(); i++) {
    drawItem(items.get(i),g,2 + x * 40,29 + y * 40);
    if (++x == 5) {
      x=0;
      y++;
    }
  }
  g.drawImage(Resources.getImage("String_Node_Str"),0,27,this);
  g.setColor(Color.YELLOW);
  g.setFont(new Font("String_Node_Str",Font.PLAIN,20));
  g.drawString(player.getMoney() + "String_Node_Str",90,287);
}
Program: 24627
Project: 24627
Buggy source:
@Override public void actionPerformed(ActionEvent e){
  actions.add("String_Node_Str" + p.name + "String_Node_Str"+ attr);
}

Fixed version (ground truth):
@Override public void actionPerformed(ActionEvent e){
  actions.add("String_Node_Str" + p.name + "String_Node_Str"+ skillValue);
}
Program: 24628
Project: 24628
Buggy source:
public void update(final Player p){
  if (p != null) {
    Skill[] skills=p.getSkills();
    for (int i=0; i < skills.length; i++) {
      skillButtons[i].setToolTipText(skills[i].description);
    }
  }
  if (p == null || equal(p))   return;
  if (!p.hasAttributePoints()) {
    for (    JButton btn : buttons)     btn.setVisible(false);
  }
 else {
    for (int i=GameCharacter.STR; i <= GameCharacter.LUC; i++) {
      buttons[i].setVisible(p.getBaseAttribute(i) < 100);
    }
  }
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      attributes.setText(p.attributesToPseudoHTML());
      stats.setText(p.statsToPseudoHTML());
    }
  }
);
}

Fixed version (ground truth):
public void update(final Player p){
  if (p != null) {
    Skill[] skills=p.getSkills();
    for (int i=0; i < skills.length; i++) {
      skillButtons[i].setToolTipText(skills[i].name + "String_Node_Str" + "String_Node_Str"+ skills[i].getLevel()+ "String_Node_Str"+ skills[i].description);
      if (skills[i].getLevel() < Skill.MAX_LEVEL) {
        skillButtons[i].setEnabled(p.hasSkillPoints());
      }
    }
  }
  if (p == null || equal(p))   return;
  if (!p.hasAttributePoints()) {
    for (    JButton btn : buttons)     btn.setVisible(false);
  }
 else {
    for (int i=GameCharacter.STR; i <= GameCharacter.LUC; i++) {
      buttons[i].setVisible(p.getBaseAttribute(i) < 100);
    }
  }
  SwingUtilities.invokeLater(new Runnable(){
    @Override public void run(){
      attributes.setText(p.attributesToPseudoHTML());
      stats.setText(p.statsToPseudoHTML());
    }
  }
);
}
Program: 24629
Project: 24629
Buggy source:
public StatsGUI(final Player p){
  super(640,304,"String_Node_Str",true);
  this.setLocation(0,720);
  attributes.setBounds(0,0,320,304);
  stats.setBounds(320,0,320,304);
  attributes.setFocusable(false);
  stats.setFocusable(false);
  attributes.setVerticalAlignment(SwingConstants.TOP);
  stats.setVerticalAlignment(SwingConstants.TOP);
  attributes.setFont(new Font("String_Node_Str",Font.PLAIN,22));
  stats.setFont(new Font("String_Node_Str",Font.PLAIN,18));
  this.add(attributes);
  this.add(stats);
  for (int i=GameCharacter.STR; i <= GameCharacter.LUC; i++) {
    final int attr=i;
    buttons[i]=new JButton("String_Node_Str");
    buttons[i].setBounds(125,3 + 30 * i,45,28);
    buttons[i].setFont(new Font("String_Node_Str",Font.PLAIN,18));
    buttons[i].addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        actions.add("String_Node_Str" + p.name + "String_Node_Str"+ attr);
      }
    }
);
    add(buttons[i]);
  }
  ToolTipManager.sharedInstance().setInitialDelay(0);
  for (int i=0; i < 10; i++) {
    skillButtons[i]=new JButton("String_Node_Str");
    skillButtons[i].setLocation(180 + 50 * (i % 3),25 + 50 * (i / 3));
    skillButtons[i].setSize(40,40);
    skillButtons[i].setIcon(new ImageIcon(Resources.getImage("String_Node_Str")));
    this.add(skillButtons[i]);
  }
  setVisible(true);
}

Fixed version (ground truth):
public StatsGUI(final Player p){
  super(640,304,"String_Node_Str",true);
  this.setLocation(0,720);
  attributes.setBounds(0,0,320,304);
  stats.setBounds(320,0,320,304);
  attributes.setFocusable(false);
  stats.setFocusable(false);
  attributes.setVerticalAlignment(SwingConstants.TOP);
  stats.setVerticalAlignment(SwingConstants.TOP);
  attributes.setFont(new Font("String_Node_Str",Font.PLAIN,22));
  stats.setFont(new Font("String_Node_Str",Font.PLAIN,18));
  this.add(attributes);
  this.add(stats);
  for (int i=GameCharacter.STR; i <= GameCharacter.LUC; i++) {
    final int attr=i;
    buttons[i]=new JButton("String_Node_Str");
    buttons[i].setBounds(125,3 + 30 * i,45,28);
    buttons[i].setFont(new Font("String_Node_Str",Font.PLAIN,18));
    buttons[i].addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        actions.add("String_Node_Str" + p.name + "String_Node_Str"+ attr);
      }
    }
);
    add(buttons[i]);
  }
  ToolTipManager.sharedInstance().setInitialDelay(0);
  for (int i=0; i < 10; i++) {
    final int skillValue=i;
    skillButtons[i]=new JButton("String_Node_Str");
    skillButtons[i].setLocation(180 + 50 * (i % 3),25 + 50 * (i / 3));
    skillButtons[i].setSize(40,40);
    skillButtons[i].setIcon(new ImageIcon(Resources.getImage("String_Node_Str")));
    skillButtons[i].setEnabled(false);
    skillButtons[i].addActionListener(new ActionListener(){
      @Override public void actionPerformed(      ActionEvent e){
        actions.add("String_Node_Str" + p.name + "String_Node_Str"+ skillValue);
      }
    }
);
    this.add(skillButtons[i]);
  }
  setVisible(true);
}
Program: 24630
Project: 24630
Buggy source:
public void baseLevelUp(){
  baseLevel++;
  calculateStats();
}

Fixed version (ground truth):
public void baseLevelUp(){
  baseLevel++;
  calculateStats();
  this.hp=(int)this.getTotalStat(Stat.MAX_HP);
  this.sp=(int)this.getTotalStat(Stat.MAX_SP);
}
Program: 24634
Project: 24634
Buggy source:
private void drawImage2(Graphics2D g){
  g.setColor(Color.GRAY);
  g.fillRect(0,0,205,304);
  ArrayList<GameItem> items=player.getInventory().getItems();
  int x=0, y=0;
  for (int i=0; i < items.size(); i++) {
    drawItem(items.get(i),g,2 + x * 40,29 + y * 40);
    if (++x == 6) {
      x=0;
      y++;
    }
  }
  g.drawImage(Resources.getImage("String_Node_Str"),0,27,this);
}

Fixed version (ground truth):
private void drawImage2(Graphics2D g){
  g.setColor(Color.GRAY);
  g.fillRect(0,0,205,304);
  ArrayList<GameItem> items=player.getInventory().getItems();
  int x=0, y=0;
  for (int i=0; i < items.size(); i++) {
    drawItem(items.get(i),g,2 + x * 40,29 + y * 40);
    if (++x == 6) {
      x=0;
      y++;
    }
  }
  g.drawImage(Resources.getImage("String_Node_Str"),0,27,this);
  g.setColor(Color.YELLOW);
  g.setFont(new Font("String_Node_Str",Font.PLAIN,20));
  g.drawString(player.getMoney() + "String_Node_Str",100,285);
}
Program: 24635
Project: 24635
Buggy source:
public void repaint(Player p){
  if (!player.getInventory().toString().equals(p.getInventory().toString()) || !isSameEquip(p)) {
    player=p;
    repaint();
  }
}

Fixed version (ground truth):
public void repaint(Player p){
  if (!player.getInventory().toString().equals(p.getInventory().toString()) || !isSameEquip(p) || player.getMoney() != p.getMoney()) {
    player=p;
    repaint();
  }
}
Program: 24636
Project: 24636
Buggy source:
public Enemy(String name,String description,EnemyType type,AgentBehaviour AI,Element element,int level,int x,int y){
  super("String_Node_Str" + uniqueEnemyID++,name,description,GameCharacterClass.MONSTER);
  this.type=type;
  this.AI=AI;
  this.baseLevel=level;
  this.element=element;
  this.x=x;
  this.y=y;
  this.hp=5000;
  this.experience=15;
}

Fixed version (ground truth):
public Enemy(String name,String description,EnemyType type,AgentBehaviour AI,Element element,int level,int x,int y){
  super("String_Node_Str" + uniqueEnemyID++,name,description,GameCharacterClass.MONSTER);
  this.type=type;
  this.AI=AI;
  this.baseLevel=level;
  this.element=element;
  this.x=x;
  this.y=y;
  this.hp=300;
  this.experience=15;
}
Program: 24637
Project: 24637
Buggy source:
@Override public int dealDamage(GameCharacter target){
  int dmg=super.dealDamage(target);
  if (target.hp <= 0 && target instanceof Enemy) {
    Enemy mob=(Enemy)target;
    gainBaseExperience(mob.experience);
    gainStatExperience(mob.experience);
    gainJobExperience(mob.experience);
  }
  return dmg;
}

Fixed version (ground truth):
@Override public int dealDamage(GameCharacter target){
  int dmg=super.dealDamage(target);
  return dmg;
}
Program: 24640
Project: 24640
Buggy source:
public void updateGameClient(){
  if (move) {
    n=getNext();
    parent=playerParent;
  }
  if (n != parent) {
    move=false;
    if (player.getX() > n.getX() * 40)     player.xSpeed=-10;
    if (player.getX() < n.getX() * 40)     player.xSpeed=10;
    if (player.getY() > n.getY() * 40)     player.ySpeed=-10;
    if (player.getY() < n.getY() * 40)     player.ySpeed=10;
    if (player.getX() == n.getX() * 40 && player.getY() == n.getY() * 40) {
      playerParent=n;
      move=true;
      if (target != null && target == playerParent) {
        target=null;
      }
    }
    renderX=player.getX() - 640;
    renderY=player.getY() - 360;
  }
  if (!stop) {
    try {
      String[] actions=new String[st.actions.size()];
      ArrayList<String> tmp=new ArrayList<String>(st.actions);
      tmp.toArray(actions);
      st.actions.clear();
      String[] actions2=new String[inv.actions.size()];
      ArrayList<String> tmp2=new ArrayList<String>(inv.actions);
      tmp2.toArray(actions2);
      inv.actions.clear();
      client.send(new DataPacket(player));
      client.send(new DataPacket(actions));
      client.send(new DataPacket(actions2));
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  repaint();
}

Fixed version (ground truth):
public void updateGameClient(){
  if (move) {
    n=getNext();
    parent=playerParent;
  }
  if (n != parent) {
    move=false;
    if (player.getX() > n.getX() * 40)     player.xSpeed=-10;
    if (player.getX() < n.getX() * 40)     player.xSpeed=10;
    if (player.getY() > n.getY() * 40)     player.ySpeed=-10;
    if (player.getY() < n.getY() * 40)     player.ySpeed=10;
    if (player.getX() == n.getX() * 40 && player.getY() == n.getY() * 40) {
      playerParent=n;
      move=true;
      if (target != null && target == playerParent) {
        target=null;
      }
    }
    renderX=player.getX() - 640;
    renderY=player.getY() - 360;
  }
  if (!stop) {
    try {
      String[] actions=new String[st.actions.size()];
      ArrayList<String> tmp=new ArrayList<String>(st.actions);
      tmp.toArray(actions);
      st.actions.clear();
      String[] actions2=new String[inv.actions.size()];
      ArrayList<String> tmp2=new ArrayList<String>(inv.actions);
      tmp2.toArray(actions2);
      inv.actions.clear();
      String[] actions3=new String[actionsUI.size()];
      ArrayList<String> tmp3=new ArrayList<String>(actionsUI);
      tmp3.toArray(actions3);
      actionsUI.clear();
      client.send(new DataPacket(player));
      client.send(new DataPacket(actions));
      client.send(new DataPacket(actions2));
      client.send(new DataPacket(actions3));
    }
 catch (    IOException e) {
      e.printStackTrace();
    }
  }
  repaint();
}
Program: 24641
Project: 24641
Buggy source:
@Override public void mousePressed(MouseEvent e){
  mouseX=e.getX();
  mouseY=e.getY();
  movePlayer(mouseX,mouseY);
  isPressed=true;
}

Fixed version (ground truth):
@Override public void mousePressed(MouseEvent e){
  mouseX=e.getX();
  mouseY=e.getY();
  if (!choosingTarget) {
    movePlayer(mouseX,mouseY);
    isPressed=true;
  }
 else {
    choosingTarget=false;
    for (    Enemy enemy : tmpEnemies) {
      Rectangle r=new Rectangle(enemy.getX(),enemy.getY(),40,40);
      if (r.contains(new Point(mouseX + renderX,mouseY + renderY))) {
        actionsUI.add("String_Node_Str" + player.name + "String_Node_Str"+ input+ "String_Node_Str"+ enemy.getRuntimeID());
        return;
      }
    }
  }
}
Program: 24642
Project: 24642
Buggy source:
public GUI(String ip,String playerName){
  super(1280,720,"String_Node_Str",true);
  name=playerName;
  this.setLocation(0,0);
  this.addMouseListener(mouse);
  List<String> lines=Resources.getText("String_Node_Str");
  mapHeight=lines.size();
  mapWidth=lines.get(0).length();
  map=new AStarNode[mapWidth][mapHeight];
  for (int i=0; i < lines.size(); i++) {
    String line=lines.get(i);
    for (int j=0; j < line.length(); j++) {
      map[j][i]=new AStarNode(j,i,0,line.charAt(j) == '1' ? 1 : 0);
    }
  }
  player=new Player("String_Node_Str",name,GameCharacterClass.NOVICE,0 * 40,0 * 40);
  st=new StatsGUI(player);
  inv=new InventoryGUI(player);
  playerParent=map[0][0];
  renderX=player.getX() - 640;
  renderY=player.getY() - 360;
  try {
    client=new UDPClient(ip,55555,new ServerResponseParser());
    client.send(new DataPacket(System.getProperty("String_Node_Str")));
    client.send(new DataPacket(player));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  walkCursor=Toolkit.getDefaultToolkit().createCustomCursor(Resources.getImage("String_Node_Str"),new Point(16,16),"String_Node_Str");
  setCursor(walkCursor);
  setVisible(true);
}

Fixed version (ground truth):
public GUI(String ip,String playerName){
  super(1280,720,"String_Node_Str",true);
  name=playerName;
  this.setLocation(0,0);
  this.addKeyListener(new Keyboard());
  this.addMouseListener(mouse);
  List<String> lines=Resources.getText("String_Node_Str");
  mapHeight=lines.size();
  mapWidth=lines.get(0).length();
  map=new AStarNode[mapWidth][mapHeight];
  for (int i=0; i < lines.size(); i++) {
    String line=lines.get(i);
    for (int j=0; j < line.length(); j++) {
      map[j][i]=new AStarNode(j,i,0,line.charAt(j) == '1' ? 1 : 0);
    }
  }
  player=new Player("String_Node_Str",name,GameCharacterClass.NOVICE,0 * 40,0 * 40);
  st=new StatsGUI(player);
  inv=new InventoryGUI(player);
  playerParent=map[0][0];
  renderX=player.getX() - 640;
  renderY=player.getY() - 360;
  try {
    client=new UDPClient(ip,55555,new ServerResponseParser());
    client.send(new DataPacket(System.getProperty("String_Node_Str")));
    client.send(new DataPacket(player));
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
  walkCursor=Toolkit.getDefaultToolkit().createCustomCursor(Resources.getImage("String_Node_Str"),new Point(16,16),"String_Node_Str");
  setCursor(walkCursor);
  setVisible(true);
}
Program: 24643
Project: 24643
Buggy source:
@Override protected void createPicture(Graphics2D g){
}

Fixed version (ground truth):
@Override protected void createPicture(Graphics2D g){
  attributes.repaint();
  stats.repaint();
}
Program: 24644
Project: 24644
Buggy source:
public void useSkill(GameCharacter target){
}

Fixed version (ground truth):
public void useSkill(int skillCode,GameCharacter target){
  ActiveSkill sk=new ActiveSkill("String_Node_Str","String_Node_Str"){
    /** 
 */
    private static final long serialVersionUID=299880583047861121L;
    @Override public void use(    GameCharacter caster,    GameCharacter target){
      caster.hp+=10;
    }
    @Override public int getManaCost(){
      return 0;
    }
  }
;
  if (skillCode < 5) {
    sk.use(this,target);
  }
}
Program: 24646
Project: 24646
Buggy source:
public String statsToPseudoHTML(){
  return HTML_START + B + this.name+ B_END+ BR+ "String_Node_Str"+ BLUE+ charClass.toString()+ FBR+ "String_Node_Str"+ BLUE+ baseLevel+ FONT_END+ "String_Node_Str"+ PURPLE+ statLevel+ FONT_END+ "String_Node_Str"+ MAGENTA+ jobLevel+ "String_Node_Str"+ FBR+ "String_Node_Str"+ RED+ hp+ "String_Node_Str"+ getTotalStat(MAX_HP)+ FONT_END+ "String_Node_Str"+ DARK_BLUE+ sp+ "String_Node_Str"+ getTotalStat(MAX_SP)+ "String_Node_Str"+ FBR+ "String_Node_Str"+ BLUE+ stats[ATK]+ "String_Node_Str"+ bStats[ATK]+ FONT_END+ "String_Node_Str"+ BLUE+ stats[MATK]+ "String_Node_Str"+ bStats[MATK]+ FBR+ "String_Node_Str"+ BLUE+ stats[DEF]+ "String_Node_Str"+ bStats[DEF]+ FONT_END+ "String_Node_Str"+ BLUE+ stats[MDEF]+ "String_Node_Str"+ bStats[MDEF]+ FBR+ "String_Node_Str"+ BLUE+ (stats[ARM] + bStats[ARM])+ "String_Node_Str"+ FONT_END+ "String_Node_Str"+ BLUE+ (stats[MARM] + bStats[MARM])+ "String_Node_Str"+ FBR+ "String_Node_Str"+ BLUE+ getTotalStat(ASPD)+ "String_Node_Str"+ FONT_END+ "String_Node_Str"+ BLUE+ getTotalStat(MSPD)+ "String_Node_Str"+ FBR+ "String_Node_Str"+ BLUE+ getTotalStat(CRIT)+ "String_Node_Str"+ FONT_END+ "String_Node_Str"+ BLUE+ getTotalStat(MCRIT)+ "String_Node_Str"+ FONT_END;
}

Fixed version (ground truth):
public String statsToPseudoHTML(){
  return HTML_START + B + this.name+ B_END+ BR+ "String_Node_Str"+ BLUE+ charClass.toString()+ FBR+ "String_Node_Str"+ BLUE+ baseLevel+ FONT_END+ "String_Node_Str"+ PURPLE+ statLevel+ FONT_END+ "String_Node_Str"+ MAGENTA+ jobLevel+ "String_Node_Str"+ FBR+ "String_Node_Str"+ RED+ hp+ "String_Node_Str"+ (int)getTotalStat(MAX_HP)+ FONT_END+ "String_Node_Str"+ DARK_BLUE+ sp+ "String_Node_Str"+ (int)getTotalStat(MAX_SP)+ "String_Node_Str"+ FBR+ "String_Node_Str"+ BLUE+ stats[ATK]+ "String_Node_Str"+ bStats[ATK]+ FONT_END+ "String_Node_Str"+ BLUE+ stats[MATK]+ "String_Node_Str"+ bStats[MATK]+ FBR+ "String_Node_Str"+ BLUE+ stats[DEF]+ "String_Node_Str"+ bStats[DEF]+ FONT_END+ "String_Node_Str"+ BLUE+ stats[MDEF]+ "String_Node_Str"+ bStats[MDEF]+ FBR+ "String_Node_Str"+ BLUE+ (stats[ARM] + bStats[ARM])+ "String_Node_Str"+ FONT_END+ "String_Node_Str"+ BLUE+ (stats[MARM] + bStats[MARM])+ "String_Node_Str"+ FBR+ "String_Node_Str"+ BLUE+ getTotalStat(ASPD)+ "String_Node_Str"+ FONT_END+ "String_Node_Str"+ BLUE+ getTotalStat(MSPD)+ "String_Node_Str"+ FBR+ "String_Node_Str"+ BLUE+ getTotalStat(CRIT)+ "String_Node_Str"+ FONT_END+ "String_Node_Str"+ BLUE+ getTotalStat(MCRIT)+ "String_Node_Str"+ FONT_END;
}
Program: 24649
Project: 24649
Buggy source:
/** 
 * Runs on UI thread Invoked when button is pressed
 * @param event
 */
public void processLogin(ActionEvent event){
  login.setDisable(true);
  showProgressBar(true);
  new Thread(new LoginTask()).start();
}

Fixed version (ground truth):
/** 
 * Runs on UI thread Invoked when button is pressed
 * @param event
 */
public void processLogin(ActionEvent event){
  enableButton(false);
  showProgressBar(true);
  new Thread(new LoginTask()).start();
}
Program: 24651
Project: 24651
Buggy source:
public void close() throws IOException {
  if (realStore != null)   realStore.close();
  if (tmpPath != null) {
    if (!tmpPath.renameTo(finalPath)) {
      finalPath.delete();
      if (!tmpPath.renameTo(finalPath))       throw new IOException("String_Node_Str" + finalPath);
    }
  }
  realStore=null;
  finalPath=tmpPath=null;
}

Fixed version (ground truth):
public void close() throws IOException {
  if (realStore != null)   realStore.close();
  if (tmpPath != null && tmpPath.canRead()) {
    if (!tmpPath.renameTo(finalPath))     throw new IOException("String_Node_Str" + finalPath);
  }
  realStore=null;
  finalPath=tmpPath=null;
}
Program: 24653
Project: 24653
Buggy source:
/** 
 * Build a string representing any non-XTF attributes in the given attribute list. This will be a series of name="value" pairs, separated by spaces. If there are no non-XTF attributes, empty string is returned. <br><br>
 */
private String processMetaAttribs(Attributes atts){
  StringBuffer buf=new StringBuffer();
  for (int i=0; i < atts.getLength(); i++) {
    String attrUri=atts.getURI(i);
    if (attrUri.equals(xtfUri))     continue;
    if (buf.length() > 0)     buf.append(' ');
    String name=atts.getLocalName(i);
    String value=atts.getValue(i);
    buf.append(name + "String_Node_Str" + value+ "String_Node_Str");
  }
  return buf.toString();
}

Fixed version (ground truth):
/** 
 * Build a string representing any non-XTF attributes in the given attribute list. This will be a series of name="value" pairs, separated by spaces. If there are no non-XTF attributes, empty string is returned. <br><br>
 */
private String processMetaAttribs(Attributes atts){
  StringBuffer buf=new StringBuffer();
  for (int i=0; i < atts.getLength(); i++) {
    String attrUri=atts.getURI(i);
    if (attrUri.equals(xtfUri))     continue;
    if (buf.length() > 0)     buf.append(' ');
    String name=atts.getLocalName(i);
    String value=atts.getValue(i);
    buf.append(name + "String_Node_Str" + mapXMLChars(value)+ "String_Node_Str");
  }
  return buf.toString();
}
Program: 24655
Project: 24655
Buggy source:
@Override public int read(byte[] b,int off,int len) throws IOException {
  int origLen=len;
  if (havePrevByte && len > 0) {
    havePrevByte=false;
    b[0]=prevByte;
    ++off;
    --len;
  }
  int toCopy=Math.min(bufferLength - bufferPos,len);
  if (toCopy > 0) {
    System.arraycopy(buffer,bufferPos,b,off,toCopy);
    bufferPos+=toCopy;
    off+=toCopy;
    len-=toCopy;
  }
  if (len > 0) {
    int nRead=baseFile.read(b,off,len);
    off+=nRead;
    len-=nRead;
  }
  return origLen - len;
}

Fixed version (ground truth):
@Override public int read(byte[] b,int off,int len) throws IOException {
  int origLen=len;
  if (havePrevByte && len > 0) {
    havePrevByte=false;
    b[off]=prevByte;
    ++off;
    --len;
  }
  int toCopy=Math.min(bufferLength - bufferPos,len);
  if (toCopy > 0) {
    System.arraycopy(buffer,bufferPos,b,off,toCopy);
    bufferPos+=toCopy;
    off+=toCopy;
    len-=toCopy;
  }
  if (len > 0) {
    int nRead=baseFile.read(b,off,len);
    off+=nRead;
    len-=nRead;
  }
  return origLen - len;
}