nus-yam/ex-repair huggingface dataset:
Program: 2048
Project: 2048
Buggy source:
private void levelUp(Player player,HumanNPC npc){
  if (EconomyHandler.useEconomy()) {
    int level=HealerPropertyPool.getLevel(npc.getUID()) + 1;
    int paid=EconomyHandler.pay(Operation.HEALER_LEVEL_UP,player);
    if (paid > 0) {
      player.sendMessage(getLevelUpPaidMessage(Operation.HEALER_LEVEL_UP,npc,paid,level));
    }
    HealerPropertyPool.saveLevel(npc.getUID(),level);
  }
}

Fixed version (ground truth):
private void levelUp(Player player,HumanNPC npc){
  if (EconomyHandler.useEconomy()) {
    int level=HealerPropertyPool.getLevel(npc.getUID());
    int paid=EconomyHandler.pay(Operation.HEALER_LEVEL_UP,player);
    if (paid > 0) {
      if (level < 10) {
        HealerPropertyPool.saveLevel(npc.getUID(),level + 1);
        player.sendMessage(getLevelUpPaidMessage(Operation.HEALER_LEVEL_UP,npc,paid,level + 1));
      }
 else {
        player.sendMessage(StringUtils.yellowify(npc.getStrippedName()) + "String_Node_Str");
      }
    }
  }
 else {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
  }
}
Program: 2049
Project: 2049
Buggy source:
private String getLevelUpPaidMessage(Operation op,HumanNPC npc,int paid,int level){
  String message="String_Node_Str";
  message=ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(npc.getStrippedName())+ "String_Node_Str"+ StringUtils.yellowify("String_Node_Str" + HealerPropertyPool.getLevel(npc.getUID()) + 1)+ "String_Node_Str"+ StringUtils.yellowify(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid,ChatColor.GREEN) + "String_Node_Str");
  return message;
}

Fixed version (ground truth):
private String getLevelUpPaidMessage(Operation op,HumanNPC npc,int paid,int level){
  String message=ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(npc.getStrippedName())+ "String_Node_Str"+ StringUtils.yellowify("String_Node_Str" + level)+ "String_Node_Str"+ StringUtils.yellowify(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid,ChatColor.GREEN) + "String_Node_Str");
  return message;
}
Program: 2050
Project: 2050
Buggy source:
private void displayStatus(Player player,HumanNPC npc){
  player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(npc.getStrippedName() + "String_Node_Str")+ "String_Node_Str");
  displayHealerStrength(player,npc);
  displayHealerLevel(player,npc);
}

Fixed version (ground truth):
private void displayStatus(Player player,HumanNPC npc){
  player.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(npc.getStrippedName() + "String_Node_Str")+ "String_Node_Str");
  displayHealerStrength(player,npc);
  displayHealerLevel(player,npc);
  player.sendMessage(ChatColor.GREEN + "String_Node_Str");
}
Program: 2052
Project: 2052
Buggy source:
/** 
 * Buys an NPC state.
 * @param player
 * @param toggleable
 * @param op
 */
private void buyState(Player player,Toggleable toggleable,Operation op){
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(op,player)) {
    if (EconomyHandler.useEconomy()) {
      int paid=EconomyHandler.pay(op,player);
      if (paid > 0)       player.sendMessage(MessageUtils.getPaidMessage(op,paid,toggleable.getName(),toggleable.getType(),true));
      toggleState(player,toggleable);
      toggleable.saveState();
    }
 else {
      player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(op,player));
    return;
  }
}

Fixed version (ground truth):
/** 
 * Buys an NPC state.
 * @param player
 * @param toggleable
 * @param op
 */
private void buyState(Player player,Toggleable toggleable,Operation op){
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(op,player)) {
    if (EconomyHandler.useEconomy()) {
      int paid=EconomyHandler.pay(op,player);
      if (paid > 0)       player.sendMessage(MessageUtils.getPaidMessage(op,paid,toggleable.getName(),toggleable.getType(),true));
      toggleable.registerState();
      toggleState(player,toggleable);
    }
 else {
      player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(op,player));
    return;
  }
}
Program: 2053
Project: 2053
Buggy source:
@Override public void run(){
  if (stop)   return;
  if (npc == null || player == null || eplayer.activeContainer == eplayer.defaultContainer) {
    kill();
    return;
  }
  if (mode == Mode.STOCK)   return;
  if (player.getHandle().inventory.j() == null)   return;
  stop=true;
  int count=0;
  boolean found=false;
  for (  ItemStack i : npc.getInventory().getContents()) {
    if (!previousNPCInv.getItem(count).equals(i) && previousNPCInv.getItem(count).getTypeId() == eplayer.inventory.j().id) {
      found=true;
      handleItemClicked((Player)npc.getPlayer(),count,false);
      break;
    }
    count+=1;
  }
  count=0;
  if (!found) {
    for (    ItemStack i : player.getInventory().getContents()) {
      if (!previousPlayerInv.getItem(count).equals(i) && previousPlayerInv.getItem(count).getTypeId() == eplayer.inventory.j().id) {
        handleItemClicked(player,count,true);
        break;
      }
      count+=1;
    }
  }
  clonePlayerInventory(npc.getInventory(),this.previousNPCInv);
  clonePlayerInventory(player.getInventory(),this.previousPlayerInv);
  eplayer.inventory.b((net.minecraft.server.ItemStack)null);
  Packet103SetSlot packet=new Packet103SetSlot(-1,-1,null);
  eplayer.netServerHandler.sendPacket(packet);
  stop=false;
}

Fixed version (ground truth):
@Override public void run(){
  if (stop)   return;
  if (npc == null || player == null || eplayer.activeContainer == eplayer.defaultContainer) {
    kill();
    return;
  }
  if (mode == Mode.STOCK)   return;
  if (player.getHandle().inventory.j() == null)   return;
  stop=true;
  int count=0;
  boolean found=false;
  for (  ItemStack i : npc.getInventory().getContents()) {
    if (!previousNPCInv.getItem(count).equals(i) && previousNPCInv.getItem(count).getTypeId() == eplayer.inventory.j().id) {
      found=true;
      handleNPCItemClicked(count,npc.getInventory());
      break;
    }
    count+=1;
  }
  count=0;
  if (!found) {
    for (    ItemStack i : player.getInventory().getContents()) {
      if (!previousPlayerInv.getItem(count).equals(i) && previousPlayerInv.getItem(count).getTypeId() == eplayer.inventory.j().id) {
        handlePlayerItemClicked(count,player.getInventory());
        break;
      }
      count+=1;
    }
  }
  clonePlayerInventory(npc.getInventory(),this.previousNPCInv);
  clonePlayerInventory(player.getInventory(),this.previousPlayerInv);
  eplayer.inventory.b((net.minecraft.server.ItemStack)null);
  Packet103SetSlot packet=new Packet103SetSlot(-1,-1,null);
  eplayer.netServerHandler.sendPacket(packet);
  stop=false;
}
Program: 2055
Project: 2055
Buggy source:
private void levelUp(Player player,HumanNPC npc){
  if (EconomyHandler.useEconomy()) {
    int level=HealerPropertyPool.getLevel(npc.getUID());
    int paid=EconomyHandler.pay(Operation.HEALER_LEVEL_UP,player);
    if (paid > 0) {
      if (level < 10) {
        HealerPropertyPool.saveLevel(npc.getUID(),level + 1);
        plugin.scheduleHealTask();
        player.sendMessage(getLevelUpPaidMessage(Operation.HEALER_LEVEL_UP,npc,paid,level + 1));
      }
 else {
        player.sendMessage(StringUtils.yellowify(npc.getStrippedName()) + "String_Node_Str");
      }
    }
  }
 else {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
  }
}

Fixed version (ground truth):
private void levelUp(Player player,HumanNPC npc,int multiple){
  if (EconomyHandler.useEconomy()) {
    int level=HealerPropertyPool.getLevel(npc.getUID());
    int paid=EconomyHandler.pay(Operation.HEALER_LEVEL_UP,player,multiple);
    if (paid > 0) {
      if (level < 10) {
        HealerPropertyPool.saveLevel(npc.getUID(),level + multiple);
        plugin.scheduleHealTask();
        player.sendMessage(getLevelUpPaidMessage(Operation.HEALER_LEVEL_UP,npc,paid,level + multiple,multiple));
      }
 else {
        player.sendMessage(StringUtils.yellowify(npc.getStrippedName()) + "String_Node_Str");
      }
    }
  }
 else {
    player.sendMessage(ChatColor.GRAY + "String_Node_Str");
  }
}
Program: 2056
Project: 2056
Buggy source:
private String getLevelUpPaidMessage(Operation op,HumanNPC npc,int paid,int level){
  String message=ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(npc.getStrippedName())+ "String_Node_Str"+ StringUtils.yellowify("String_Node_Str" + level)+ "String_Node_Str"+ StringUtils.yellowify(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid,ChatColor.GREEN) + "String_Node_Str");
  return message;
}

Fixed version (ground truth):
private String getLevelUpPaidMessage(Operation op,HumanNPC npc,int paid,int level,int multiple){
  String message=ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(npc.getStrippedName())+ "String_Node_Str"+ StringUtils.yellowify("String_Node_Str" + level)+ "String_Node_Str"+ StringUtils.yellowify(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid * multiple,ChatColor.GREEN) + "String_Node_Str");
  return message;
}
Program: 2057
Project: 2057
Buggy source:
/** 
 * Pays for a payment from the player's inventory.
 * @param player
 * @param payment
 * @return
 */
public static int pay(Player player,Payment payment){
  PlayerInventory inv=player.getInventory();
  int currencyID=payment.getItem().getTypeId();
  int current=payment.getPrice();
  int count=0;
  for (  ItemStack i : inv.getContents()) {
    if (i != null && i.getTypeId() == currencyID) {
      int amount=i.getAmount();
      int toChange=0;
      current-=amount;
      if (current < 0) {
        toChange-=current;
      }
      if (toChange == 0)       i=null;
 else {
        i.setAmount(toChange);
      }
      inv.setItem(count,i);
    }
    count+=1;
  }
  return payment.getPrice();
}

Fixed version (ground truth):
/** 
 * Pays for a payment from the player's inventory.
 * @param player
 * @param payment
 * @return
 */
public static int pay(Player player,Payment payment){
  PlayerInventory inv=player.getInventory();
  int currencyID=payment.getItem().getTypeId();
  int current=payment.getPrice();
  int count=0;
  outer:   for (  ItemStack i : inv.getContents()) {
    if (i != null && i.getTypeId() == currencyID) {
      int amount=i.getAmount();
      int toChange=0;
      current-=amount;
      if (current < 0) {
        toChange-=current;
      }
      if (toChange == 0)       i=null;
 else {
        i.setAmount(toChange);
        break outer;
      }
      inv.setItem(count,i);
    }
    count+=1;
  }
  return payment.getPrice();
}
Program: 2058
Project: 2058
Buggy source:
public Payment(ItemPrice price2){
  this.setPrice(price2.getPrice());
  ItemStack stack=new ItemStack(price2.getItemID(),price2.getPrice());
  stack.setData(new MaterialData(price2.getData()));
  this.setItem(stack);
  this.setiConomy(price2.isiConomy());
}

Fixed version (ground truth):
public Payment(ItemStack stocking,boolean iConomy){
  this.setiConomy(iConomy);
  this.setItem(stocking);
  this.setPrice(stocking.getAmount());
}
Program: 2061
Project: 2061
Buggy source:
private void setName(String name,CommandSender sender){
  Player p=(Player)sender;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  if (name.length() > 16) {
    sender.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  plugin.handler.setName(n.getUID(),name,n.getOwner());
  sender.sendMessage(ChatColor.GREEN + StringUtils.yellowify(n.getName(),ChatColor.GREEN) + "String_Node_Str"+ StringUtils.yellowify(name,ChatColor.GREEN)+ "String_Node_Str");
  return;
}

Fixed version (ground truth):
private void setName(String name,CommandSender sender){
  Player p=(Player)sender;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  if (name.length() > 16) {
    sender.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  plugin.handler.setName(n.getUID(),name,n.getOwner());
  sender.sendMessage(ChatColor.GREEN + StringUtils.yellowify(n.getName()) + "String_Node_Str"+ StringUtils.yellowify(name)+ "String_Node_Str");
  return;
}
Program: 2062
Project: 2062
Buggy source:
private void changeLookWhenClose(Player p,String bool){
  boolean look=false;
  if (bool.equals("String_Node_Str"))   look=true;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  PropertyPool.setLookWhenClose(n.getUID(),look);
  if (look)   p.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(n.getStrippedName(),ChatColor.GREEN)+ "String_Node_Str");
 else   if (!look)   p.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(n.getStrippedName(),ChatColor.GREEN)+ "String_Node_Str");
}

Fixed version (ground truth):
private void changeLookWhenClose(Player p,String bool){
  boolean look=false;
  if (bool.equals("String_Node_Str"))   look=true;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  PropertyPool.setLookWhenClose(n.getUID(),look);
  if (look)   p.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(n.getStrippedName())+ "String_Node_Str");
 else   if (!look)   p.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(n.getStrippedName())+ "String_Node_Str");
}
Program: 2064
Project: 2064
Buggy source:
private void addText(String[] args,CommandSender sender){
  Player p=(Player)sender;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  String text="String_Node_Str";
  int i=0;
  for (  String s : args) {
    if (i == 1 && !s.isEmpty() && !s.equals("String_Node_Str")) {
      text+=s;
    }
    if (i > 1 && !s.isEmpty() && !s.equals("String_Node_Str")) {
      text+="String_Node_Str" + s;
    }
    i+=1;
  }
  plugin.handler.addNPCText(n.getUID(),text);
  sender.sendMessage(StringUtils.yellowify(text,ChatColor.GREEN) + "String_Node_Str" + StringUtils.yellowify(n.getStrippedName() + "String_Node_Str",ChatColor.GREEN)+ "String_Node_Str");
}

Fixed version (ground truth):
private void addText(String[] args,CommandSender sender){
  Player p=(Player)sender;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  String text="String_Node_Str";
  int i=0;
  for (  String s : args) {
    if (i == 1 && !s.isEmpty() && !s.equals("String_Node_Str")) {
      text+=s;
    }
    if (i > 1 && !s.isEmpty() && !s.equals("String_Node_Str")) {
      text+="String_Node_Str" + s;
    }
    i+=1;
  }
  plugin.handler.addNPCText(n.getUID(),text);
  sender.sendMessage(StringUtils.yellowify(text) + "String_Node_Str" + StringUtils.yellowify(n.getStrippedName() + "String_Node_Str")+ "String_Node_Str");
}
Program: 2066
Project: 2066
Buggy source:
private void moveNPC(CommandSender sender,String name,int UID){
  Location loc=PropertyPool.getLocationFromID(UID);
  if (loc != null) {
    PropertyPool.saveLocation(name,loc,UID);
  }
  plugin.handler.moveNPC(UID,((Player)sender).getLocation());
  sender.sendMessage(StringUtils.yellowify(name,ChatColor.GREEN) + "String_Node_Str");
}

Fixed version (ground truth):
private void moveNPC(CommandSender sender,String name,int UID){
  Location loc=PropertyPool.getLocationFromID(UID);
  if (loc != null) {
    PropertyPool.saveLocation(name,loc,UID);
  }
  plugin.handler.moveNPC(UID,((Player)sender).getLocation());
  sender.sendMessage(StringUtils.yellowify(name) + "String_Node_Str");
}
Program: 2067
Project: 2067
Buggy source:
private void resetText(String[] args,CommandSender sender){
  Player p=(Player)sender;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  plugin.handler.resetText(n.getUID());
  sender.sendMessage(StringUtils.yellowify(n.getStrippedName() + "String_Node_Str",ChatColor.GREEN) + "String_Node_Str");
}

Fixed version (ground truth):
private void resetText(String[] args,CommandSender sender){
  Player p=(Player)sender;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  plugin.handler.resetText(n.getUID());
  sender.sendMessage(StringUtils.yellowify(n.getStrippedName() + "String_Node_Str") + "String_Node_Str");
}
Program: 2068
Project: 2068
Buggy source:
private void changeTalkWhenClose(Player p,String bool){
  boolean talk=false;
  if (bool.equals("String_Node_Str"))   talk=true;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  PropertyPool.setTalkWhenClose(n.getUID(),talk);
  if (talk)   p.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(n.getStrippedName(),ChatColor.GREEN)+ "String_Node_Str");
 else   if (!talk)   p.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(n.getStrippedName(),ChatColor.GREEN)+ "String_Node_Str");
}

Fixed version (ground truth):
private void changeTalkWhenClose(Player p,String bool){
  boolean talk=false;
  if (bool.equals("String_Node_Str"))   talk=true;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  PropertyPool.setTalkWhenClose(n.getUID(),talk);
  if (talk)   p.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(n.getStrippedName())+ "String_Node_Str");
 else   if (!talk)   p.sendMessage(ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(n.getStrippedName())+ "String_Node_Str");
}
Program: 2069
Project: 2069
Buggy source:
private void setText(String[] args,CommandSender sender){
  Player p=(Player)sender;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  String text="String_Node_Str";
  if (args.length >= 2) {
    int i=0;
    for (    String s : args) {
      if (i == 1 && !s.isEmpty() && !s.equals("String_Node_Str"))       text+=s;
      if (i > 1 && !s.isEmpty() && !s.equals("String_Node_Str"))       text+="String_Node_Str" + s;
      i+=1;
    }
  }
  ArrayList<String> texts=new ArrayList<String>();
  texts.add(text);
  plugin.handler.setNPCText(n.getUID(),texts);
  sender.sendMessage(ChatColor.GREEN + StringUtils.yellowify(n.getName(),ChatColor.GREEN) + "String_Node_Str"+ StringUtils.yellowify(text,ChatColor.GREEN)+ "String_Node_Str");
}

Fixed version (ground truth):
private void setText(String[] args,CommandSender sender){
  Player p=(Player)sender;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  String text="String_Node_Str";
  if (args.length >= 2) {
    int i=0;
    for (    String s : args) {
      if (i == 1 && !s.isEmpty() && !s.equals("String_Node_Str"))       text+=s;
      if (i > 1 && !s.isEmpty() && !s.equals("String_Node_Str"))       text+="String_Node_Str" + s;
      i+=1;
    }
  }
  ArrayList<String> texts=new ArrayList<String>();
  texts.add(text);
  plugin.handler.setNPCText(n.getUID(),texts);
  sender.sendMessage(ChatColor.GREEN + StringUtils.yellowify(n.getName()) + "String_Node_Str"+ StringUtils.yellowify(text)+ "String_Node_Str");
}
Program: 2070
Project: 2070
Buggy source:
private void buyTrader(HumanNPC npc,Player player){
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(Operation.TRADER_NPC_CREATE,player)) {
    if (EconomyHandler.useEconomy()) {
      int paid=EconomyHandler.pay(Operation.TRADER_NPC_CREATE,player);
      if (paid > 0)       player.sendMessage(MessageUtils.getPaidMessage(Operation.TRADER_NPC_CREATE,paid,npc.getStrippedName(),"String_Node_Str",true));
      toggleTrader(npc,player);
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(Operation.TRADER_NPC_CREATE,player));
    return;
  }
}

Fixed version (ground truth):
private void buyTrader(HumanNPC npc,Player player){
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(Operation.TRADER_NPC_CREATE,player)) {
    if (EconomyHandler.useEconomy()) {
      int paid=EconomyHandler.pay(Operation.TRADER_NPC_CREATE,player);
      if (paid > 0)       player.sendMessage(MessageUtils.getPaidMessage(Operation.TRADER_NPC_CREATE,paid,npc.getStrippedName(),"String_Node_Str",true));
      toggleTrader(npc,player);
      TraderPropertyPool.saveTrader(npc.getUID(),true);
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(Operation.TRADER_NPC_CREATE,player));
    return;
  }
}
Program: 2071
Project: 2071
Buggy source:
private void toggleTrader(HumanNPC npc,Player player){
  npc.setTrader(!npc.isTrader());
  if (npc.isTrader())   player.sendMessage(StringUtils.yellowify(npc.getStrippedName(),ChatColor.GREEN) + "String_Node_Str");
 else   player.sendMessage(StringUtils.yellowify(npc.getStrippedName(),ChatColor.GREEN) + "String_Node_Str");
}

Fixed version (ground truth):
private void toggleTrader(HumanNPC npc,Player player){
  npc.setTrader(!npc.isTrader());
  if (npc.isTrader())   player.sendMessage(StringUtils.yellowify(npc.getStrippedName()) + "String_Node_Str");
 else   player.sendMessage(StringUtils.yellowify(npc.getStrippedName()) + "String_Node_Str");
}
Program: 2076
Project: 2076
Buggy source:
public static String getPaidMessage(Operation op,int paid,String npcName,String type,boolean useType){
  String message="String_Node_Str";
  message=ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(EconomyHandler.getPaymentType(Operation.TRADER_NPC_CREATE,"String_Node_Str" + paid),ChatColor.GREEN)+ "String_Node_Str"+ "String_Node_Str";
  if (useType)   message+=StringUtils.yellowify(npcName,ChatColor.GREEN) + "String_Node_Str" + StringUtils.yellowify(type,ChatColor.GREEN)+ "String_Node_Str";
 else   message+=StringUtils.yellowify(npcName,ChatColor.GREEN) + "String_Node_Str";
  return message;
}

Fixed version (ground truth):
public static String getPaidMessage(Operation op,int paid,String npcName,String type,boolean useType){
  String message="String_Node_Str";
  message=ChatColor.GREEN + "String_Node_Str" + StringUtils.yellowify(EconomyHandler.getPaymentType(Operation.TRADER_NPC_CREATE,"String_Node_Str" + paid),ChatColor.GREEN)+ "String_Node_Str";
  if (useType)   message+=StringUtils.yellowify(npcName,ChatColor.GREEN) + "String_Node_Str" + StringUtils.yellowify(type,ChatColor.GREEN)+ "String_Node_Str";
 else   message+=StringUtils.yellowify(npcName,ChatColor.GREEN) + "String_Node_Str";
  return message;
}
Program: 2077
Project: 2077
Buggy source:
public TraderTask(HumanNPC NPC,Player player,Citizens plugin,Mode mode){
  this.npc=NPC;
  this.player=(CraftPlayer)player;
  this.plugin=plugin;
  previousNPCInv=new CraftInventoryPlayer(new InventoryPlayer(null));
  previousPlayerInv=new CraftInventoryPlayer(new InventoryPlayer(null));
  clonePlayerInventory(npc.getBukkitEntity().getInventory(),this.previousNPCInv);
  clonePlayerInventory(player.getInventory(),this.previousPlayerInv);
  this.mode=mode;
  sendJoinMessage();
}

Fixed version (ground truth):
public TraderTask(HumanNPC NPC,Player player,Citizens plugin,Mode mode){
  this.npc=NPC;
  this.player=(CraftPlayer)player;
  this.plugin=plugin;
  this.previousNPCInv=new CraftInventoryPlayer(new InventoryPlayer(null));
  this.previousPlayerInv=new CraftInventoryPlayer(new InventoryPlayer(null));
  clonePlayerInventory(npc.getBukkitEntity().getInventory(),this.previousNPCInv);
  clonePlayerInventory(player.getInventory(),this.previousPlayerInv);
  this.mode=mode;
  sendJoinMessage();
}
Program: 2078
Project: 2078
Buggy source:
@Override public void run(){
  if (npc == null || player == null || player.getHandle().activeContainer == player.getHandle().defaultContainer) {
    kill();
    return;
  }
  if (player.getHandle().inventory.j() == null)   return;
  if (mode == Mode.STOCK)   return;
  int count=0;
  boolean found=false;
  for (  ItemStack i : npc.getBukkitEntity().getInventory().getContents()) {
    if (!(previousNPCInv.getItem(count).equals(i))) {
      found=true;
      handleNPCItemClicked(count);
      break;
    }
    count+=1;
  }
  count=0;
  if (!found) {
    for (    ItemStack i : player.getInventory().getContents()) {
      if (!(previousPlayerInv.getItem(count).equals(i))) {
        handlePlayerItemClicked(count);
        break;
      }
      count+=1;
    }
  }
  clonePlayerInventory(npc.getBukkitEntity().getInventory(),this.previousNPCInv);
  clonePlayerInventory(player.getInventory(),this.previousPlayerInv);
  player.getHandle().inventory.b((net.minecraft.server.ItemStack)null);
}

Fixed version (ground truth):
@Override public void run(){
  if (npc == null || player == null || player.getHandle().activeContainer == player.getHandle().defaultContainer) {
    kill();
    return;
  }
  if (player.getHandle().inventory.j() == null)   return;
  if (mode == Mode.STOCK)   return;
  int count=0;
  boolean found=false;
  for (  ItemStack i : npc.getBukkitEntity().getInventory().getContents()) {
    if (!previousNPCInv.getItem(count).equals(i)) {
      found=true;
      handleNPCItemClicked(count);
      break;
    }
    count+=1;
  }
  count=0;
  if (!found) {
    for (    ItemStack i : player.getInventory().getContents()) {
      if (!previousPlayerInv.getItem(count).equals(i)) {
        handlePlayerItemClicked(count);
        break;
      }
      count+=1;
    }
  }
  clonePlayerInventory(npc.getBukkitEntity().getInventory(),this.previousNPCInv);
  clonePlayerInventory(player.getInventory(),this.previousPlayerInv);
  player.getHandle().inventory.b((net.minecraft.server.ItemStack)null);
}
Program: 2079
Project: 2079
Buggy source:
private void clonePlayerInventory(PlayerInventory source,PlayerInventory target){
  log("String_Node_Str");
  StopWatch stopwatch=new StopWatch();
  stopwatch.start();
  ItemStack[] contents=new ItemStack[source.getContents().length];
  System.arraycopy(source.getContents(),0,contents,0,contents.length);
  target.setContents(contents);
  target.setHelmet(cloneItemStack(source.getHelmet()));
  target.setChestplate(cloneItemStack(source.getChestplate()));
  target.setLeggings(cloneItemStack(source.getLeggings()));
  target.setBoots(cloneItemStack(source.getBoots()));
  target.setItemInHand(cloneItemStack(source.getItemInHand()));
  stopwatch.stop();
  log("String_Node_Str" + stopwatch.getElapsedTime());
}

Fixed version (ground truth):
private void clonePlayerInventory(PlayerInventory source,PlayerInventory target){
  ItemStack[] contents=new ItemStack[source.getContents().length];
  System.arraycopy(source.getContents(),0,contents,0,contents.length);
  target.setContents(contents);
}
Program: 2084
Project: 2084
Buggy source:
@Override public void onDisable(){
  PluginDescriptionFile pdfFile=this.getDescription();
  handler.despawnAllNPCs();
  PropertyPool.saveFiles();
  log.info("String_Node_Str" + pdfFile.getName() + "String_Node_Str"+ pdfFile.getVersion()+ "String_Node_Str"+ buildNumber+ "String_Node_Str"+ codename+ "String_Node_Str");
}

Fixed version (ground truth):
@Override public void onDisable(){
  PluginDescriptionFile pdfFile=this.getDescription();
  handler.despawnAllNPCs();
  PropertyPool.saveAll();
  TraderPropertyPool.saveAll();
  log.info("String_Node_Str" + pdfFile.getName() + "String_Node_Str"+ pdfFile.getVersion()+ "String_Node_Str"+ codename+ "String_Node_Str");
}
Program: 2085
Project: 2085
Buggy source:
public void onChunkLoaded(ChunkLoadEvent e){
  for (  Entry<NPCLocation,String> i : toRespawn.entrySet()) {
    if (e.getChunk().getWorld().getChunkAt(i.getKey().getX(),i.getKey().getZ()).equals(e.getChunk())) {
      plugin.handler.spawnNPC(i.getValue(),i.getKey().getLocation());
    }
  }
}

Fixed version (ground truth):
public void onChunkLoaded(ChunkLoadEvent e){
  for (  Entry<NPCLocation,String> i : toRespawn.entrySet()) {
    if (e.getChunk().getWorld().getChunkAt(i.getKey().getX(),i.getKey().getZ()).equals(e.getChunk())) {
      plugin.handler.spawnNPC(i.getValue(),i.getKey().getLocation());
      toRespawn.remove(i.getKey());
    }
  }
}
Program: 2086
Project: 2086
Buggy source:
@Override public void run(){
  if (npc == null || player == null || player.getHandle().activeContainer == player.getHandle().defaultContainer) {
    kill();
    return;
  }
  if (player.getHandle().inventory.j() == null)   return;
  if (mode == Mode.STOCK)   return;
  int count=0;
  boolean found=false;
  for (  ItemStack i : npc.getBukkitEntity().getInventory().getContents()) {
    if (!previousNPCInv.getItem(count).equals(i)) {
      found=true;
      handleNPCItemClicked(count);
      break;
    }
    count+=1;
  }
  count=0;
  if (!found) {
    for (    ItemStack i : player.getInventory().getContents()) {
      if (!previousPlayerInv.getItem(count).equals(i)) {
        handlePlayerItemClicked(count);
        break;
      }
      count+=1;
    }
  }
  clonePlayerInventory(npc.getBukkitEntity().getInventory(),this.previousNPCInv);
  clonePlayerInventory(player.getInventory(),this.previousPlayerInv);
  player.getHandle().inventory.b((net.minecraft.server.ItemStack)null);
}

Fixed version (ground truth):
@Override public void run(){
  if (stop)   return;
  if (npc == null || player == null || player.getHandle().activeContainer == player.getHandle().defaultContainer) {
    kill();
    return;
  }
  if (player.getHandle().inventory.j() == null)   return;
  if (mode == Mode.STOCK)   return;
  int count=0;
  boolean found=false;
  for (  ItemStack i : npc.getBukkitEntity().getInventory().getContents()) {
    if (!previousNPCInv.getItem(count).equals(i) && previousNPCInv.getItem(count).getTypeId() == player.getHandle().inventory.j().id) {
      found=true;
      handleNPCItemClicked(count);
      break;
    }
    count+=1;
  }
  count=0;
  if (!found) {
    for (    ItemStack i : player.getInventory().getContents()) {
      if (!previousPlayerInv.getItem(count).equals(i) && previousPlayerInv.getItem(count).getTypeId() == player.getHandle().inventory.j().id) {
        handlePlayerItemClicked(count);
        break;
      }
      count+=1;
    }
  }
  clonePlayerInventory(npc.getBukkitEntity().getInventory(),this.previousNPCInv);
  clonePlayerInventory(player.getInventory(),this.previousPlayerInv);
  player.getHandle().inventory.b((net.minecraft.server.ItemStack)null);
}
Program: 2087
Project: 2087
Buggy source:
public void kill(){
  npc.setFree(true);
  plugin.getServer().getScheduler().cancelTask(taskID);
  sendLeaveMessage();
  int index=TraderInterface.tasks.indexOf(taskID);
  if (index != -1)   TraderInterface.tasks.remove(TraderInterface.tasks.indexOf(taskID));
}

Fixed version (ground truth):
public void kill(){
  stop=true;
  npc.setFree(true);
  plugin.getServer().getScheduler().cancelTask(taskID);
  sendLeaveMessage();
  int index=TraderInterface.tasks.indexOf(taskID);
  if (index != -1)   TraderInterface.tasks.remove(TraderInterface.tasks.indexOf(taskID));
}
Program: 2090
Project: 2090
Buggy source:
public void setColour(int UID,String colourChange){
  HumanNPC n=super.getNPC(UID);
  PropertyPool.saveColour(UID,colourChange.replace("String_Node_Str","String_Node_Str"));
  super.removeNPCForRespawn(UID);
  super.registerBasicNPC(n.getName(),NPCType.BASIC,UID);
}

Fixed version (ground truth):
public void setColour(int UID,String colourChange){
  HumanNPC n=super.getNPC(UID);
  PropertyPool.saveColour(UID,colourChange.replace("String_Node_Str","String_Node_Str"));
  super.removeNPCForRespawn(UID);
  Citizens.log.info("String_Node_Str" + n.getName());
  super.registerBasicNPC(n.getName(),NPCType.BASIC,UID);
}
Program: 2091
Project: 2091
Buggy source:
public void addNPCText(int UID,String text){
  ArrayList<String> texts=super.getBasicNPCText(UID);
  texts.add(text);
  texts=StringUtils.colourise(texts);
  super.setBasicNPCText(UID,texts);
  PropertyPool.saveText(UID,texts);
}

Fixed version (ground truth):
public void addNPCText(int UID,String text){
  ArrayList<String> texts=super.getBasicNPCText(UID);
  if (texts == null)   texts=new ArrayList<String>();
  texts.add(text);
  texts=StringUtils.colourise(texts);
  super.setBasicNPCText(UID,texts);
  PropertyPool.saveText(UID,texts);
}
Program: 2092
Project: 2092
Buggy source:
private void copyNPC(HumanNPC NPC,Player p){
  ArrayList<String> texts=PropertyPool.getText(NPC.getUID());
  String colour=PropertyPool.getColour(NPC.getUID());
  ArrayList<Integer> items=PropertyPool.getItemsFromFile(NPC.getUID());
  int newUID=plugin.handler.spawnNPC(NPC.getName(),p.getLocation());
  HumanNPC newNPC=NPCManager.getNPC(newUID);
  PropertyPool.saveColour(newUID,colour);
  PropertyPool.saveText(newUID,texts);
  PropertyPool.saveItems(newUID,items);
  NPCDataManager.addItems(newNPC,items);
}

Fixed version (ground truth):
private void copyNPC(HumanNPC NPC,Player p){
  ArrayList<String> texts=PropertyPool.getText(NPC.getUID());
  String colour=PropertyPool.getColour(NPC.getUID());
  ArrayList<Integer> items=PropertyPool.getItemsFromFile(NPC.getUID());
  boolean lookatplayers=PropertyPool.getNPCLookWhenClose(NPC.getUID());
  boolean talkwhenclose=PropertyPool.getNPCTalkWhenClose(NPC.getUID());
  int newUID=plugin.handler.spawnNPC(NPC.getName(),p.getLocation());
  HumanNPC newNPC=NPCManager.getNPC(newUID);
  PropertyPool.saveColour(newUID,colour);
  PropertyPool.saveText(newUID,texts);
  PropertyPool.saveItems(newUID,items);
  PropertyPool.saveLookWhenClose(newUID,lookatplayers);
  PropertyPool.saveTalkWhenClose(newUID,talkwhenclose);
  NPCDataManager.addItems(newNPC,items);
}
Program: 2093
Project: 2093
Buggy source:
public void moveNPC(int UID,Location loc){
  HumanNPC npc=list.get(UID);
  npc.moveTo(loc.getX(),loc.getY(),loc.getZ(),loc.getYaw(),0.0F);
}

Fixed version (ground truth):
public void moveNPC(int UID,Location loc){
  HumanNPC npc=list.get(UID);
  String location=loc.getWorld().getName() + "String_Node_Str" + loc.getX()+ "String_Node_Str"+ loc.getY()+ "String_Node_Str"+ loc.getZ()+ "String_Node_Str"+ loc.getYaw()+ "String_Node_Str"+ loc.getPitch();
  PropertyPool.locations.setString(UID,location);
  npc.moveTo(loc.getX(),loc.getY(),loc.getZ(),loc.getYaw(),0.0F);
}
Program: 2094
Project: 2094
Buggy source:
public String getName(){
  if (Citizens.convertUnderscores == true) {
    String returnName="String_Node_Str";
    String[] brokenName=this.name.split("String_Node_Str");
    for (int i=0; i < brokenName.length; i++) {
      if (i == 0)       returnName=brokenName[i];
 else       returnName+="String_Node_Str" + brokenName[i];
    }
    return returnName;
  }
  return this.name;
}

Fixed version (ground truth):
public String getName(){
  if (Citizens.convertUnderscores == true) {
    String returnName="String_Node_Str";
    String[] brokenName=this.name.split("String_Node_Str");
    for (int i=0; i < brokenName.length; i++) {
      if (i == 0)       returnName=brokenName[i];
 else       returnName+="String_Node_Str" + brokenName[i];
    }
    return ChatColor.stripColor(returnName);
  }
  return ChatColor.stripColor(this.name);
}
Program: 2095
Project: 2095
Buggy source:
public String getSpacedName(){
  return this.name;
}

Fixed version (ground truth):
public String getSpacedName(){
  return ChatColor.stripColor(this.name);
}
Program: 2096
Project: 2096
Buggy source:
private void copyNPC(HumanNPC NPC,Player p){
  ArrayList<String> texts=PropertyPool.getText(NPC.getUID());
  String colour=PropertyPool.getColour(NPC.getUID());
  ArrayList<Integer> items=PropertyPool.getItemsFromFile(NPC.getUID());
  boolean lookatplayers=PropertyPool.getNPCLookWhenClose(NPC.getUID());
  boolean talkwhenclose=PropertyPool.getNPCTalkWhenClose(NPC.getUID());
  int newUID=plugin.handler.spawnNPC(NPC.getName(),p.getLocation());
  HumanNPC newNPC=NPCManager.getNPC(newUID);
  PropertyPool.saveColour(newUID,colour);
  PropertyPool.saveText(newUID,texts);
  PropertyPool.saveItems(newUID,items);
  PropertyPool.saveLookWhenClose(newUID,lookatplayers);
  PropertyPool.saveTalkWhenClose(newUID,talkwhenclose);
  NPCDataManager.addItems(newNPC,items);
}

Fixed version (ground truth):
private void copyNPC(HumanNPC NPC,Player p){
  ArrayList<String> texts=PropertyPool.getText(NPC.getUID());
  String colour=PropertyPool.getColour(NPC.getUID());
  String owner=PropertyPool.getNPCOwner(NPC.getUID());
  ArrayList<Integer> items=PropertyPool.getItemsFromFile(NPC.getUID());
  boolean lookatplayers=PropertyPool.getNPCLookWhenClose(NPC.getUID());
  boolean talkwhenclose=PropertyPool.getNPCTalkWhenClose(NPC.getUID());
  int newUID=plugin.handler.spawnNPC(NPC.getName(),p.getLocation());
  HumanNPC newNPC=NPCManager.getNPC(newUID);
  PropertyPool.saveColour(newUID,colour);
  PropertyPool.saveText(newUID,texts);
  PropertyPool.saveItems(newUID,items);
  PropertyPool.saveLookWhenClose(newUID,lookatplayers);
  PropertyPool.saveTalkWhenClose(newUID,talkwhenclose);
  PropertyPool.setNPCOwner(newUID,owner);
  NPCDataManager.addItems(newNPC,items);
}
Program: 2097
Project: 2097
Buggy source:
public void setItemInHand(int UID,String material){
  Material mat=StringUtils.parseMaterial(material);
  if (mat == null)   mat=StringUtils.parseMaterial(PropertyPool.itemlookups.getString(material));
  HumanNPC NPC=super.getNPC(UID);
  ArrayList<Integer> items=PropertyPool.getItemsFromFile(UID);
  int olditem=items.get(0);
  items.set(0,mat.getId());
  NPCDataManager.addItems(NPC,items);
  if ((olditem != 0 && items.get(0) == 0)) {
    super.removeNPCForRespawn(NPC.getUID());
    super.registerBasicNPC(NPC.getName(),NPC.getType(),NPC.getUID());
  }
}

Fixed version (ground truth):
public void setItemInHand(Player p,int UID,String material){
  Material mat=StringUtils.parseMaterial(material);
  if (mat == null && !PropertyPool.itemlookups.getString(material).isEmpty())   mat=StringUtils.parseMaterial(PropertyPool.itemlookups.getString(material));
  if (mat == null) {
    p.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  HumanNPC NPC=super.getNPC(UID);
  ArrayList<Integer> items=PropertyPool.getItemsFromFile(UID);
  int olditem=items.get(0);
  items.set(0,mat.getId());
  NPCDataManager.addItems(NPC,items);
  if ((olditem != 0 && items.get(0) == 0)) {
    super.removeNPCForRespawn(NPC.getUID());
    super.registerBasicNPC(NPC.getName(),NPC.getType(),NPC.getUID());
  }
}
Program: 2098
Project: 2098
Buggy source:
public void setItemInSlot(Player p,String[] args){
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  Material mat=StringUtils.parseMaterial(args[1]);
  if (mat == null)   mat=StringUtils.parseMaterial(PropertyPool.itemlookups.getString(args[1]));
  if (mat == null) {
    p.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  ArrayList<Integer> items=PropertyPool.getItemsFromFile(n.getUID());
  int oldhelmet=items.get(1);
  if (args[0].equalsIgnoreCase("String_Node_Str")) {
    items.set(1,mat.getId());
  }
 else   if (args[0].equalsIgnoreCase("String_Node_Str")) {
    items.set(2,mat.getId());
  }
 else   if (args[0].equalsIgnoreCase("String_Node_Str")) {
    items.set(3,mat.getId());
  }
 else   if (args[0].equalsIgnoreCase("String_Node_Str")) {
    items.set(4,mat.getId());
  }
  PropertyPool.saveItems(n.getUID(),items);
  NPCDataManager.addItems(n,items);
  if ((oldhelmet != 0 && items.get(1) == 0)) {
    super.removeNPCForRespawn(n.getUID());
    super.registerBasicNPC(n.getName(),n.getType(),n.getUID());
  }
}

Fixed version (ground truth):
public void setItemInSlot(Player p,String[] args){
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  Material mat=StringUtils.parseMaterial(args[1]);
  if (mat == null && !PropertyPool.itemlookups.getString(args[1]).isEmpty())   mat=StringUtils.parseMaterial(PropertyPool.itemlookups.getString(args[1]));
  if (mat == null) {
    p.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  ArrayList<Integer> items=PropertyPool.getItemsFromFile(n.getUID());
  int oldhelmet=items.get(1);
  if (args[0].equalsIgnoreCase("String_Node_Str")) {
    items.set(1,mat.getId());
  }
 else   if (args[0].equalsIgnoreCase("String_Node_Str")) {
    items.set(2,mat.getId());
  }
 else   if (args[0].equalsIgnoreCase("String_Node_Str")) {
    items.set(3,mat.getId());
  }
 else   if (args[0].equalsIgnoreCase("String_Node_Str")) {
    items.set(4,mat.getId());
  }
  PropertyPool.saveItems(n.getUID(),items);
  NPCDataManager.addItems(n,items);
  if ((oldhelmet != 0 && items.get(1) == 0)) {
    super.removeNPCForRespawn(n.getUID());
    super.registerBasicNPC(n.getName(),n.getType(),n.getUID());
  }
}
Program: 2100
Project: 2100
Buggy source:
private void setItemInHand(CommandSender sender,String[] args){
  Player p=(Player)sender;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  plugin.handler.setItemInHand(n.getUID(),args[1]);
}

Fixed version (ground truth):
private void setItemInHand(CommandSender sender,String[] args){
  Player p=(Player)sender;
  HumanNPC n=NPCManager.getNPC(NPCManager.NPCSelected.get(p.getName()));
  plugin.handler.setItemInHand(p,n.getUID(),args[1]);
}
Program: 2101
Project: 2101
Buggy source:
@Override public void onDisable(){
  PluginDescriptionFile pdfFile=this.getDescription();
  handler.despawnAllNPCs();
  PropertyPool.locations.save();
  PropertyPool.texts.save();
  PropertyPool.items.save();
  PropertyPool.colours.save();
  PropertyPool.settings.save();
  log.info("String_Node_Str" + pdfFile.getName() + "String_Node_Str"+ pdfFile.getVersion()+ "String_Node_Str"+ buildNumber+ "String_Node_Str"+ codename+ "String_Node_Str");
}

Fixed version (ground truth):
@Override public void onDisable(){
  PluginDescriptionFile pdfFile=this.getDescription();
  handler.despawnAllNPCs();
  PropertyPool.saveFiles();
  log.info("String_Node_Str" + pdfFile.getName() + "String_Node_Str"+ pdfFile.getVersion()+ "String_Node_Str"+ buildNumber+ "String_Node_Str"+ codename+ "String_Node_Str");
}
Program: 2102
Project: 2102
Buggy source:
@Override public boolean checkout(AbstractBuild<?,?> build,Launcher launcher,FilePath workspace,BuildListener listener,File changelogFile) throws IOException, InterruptedException {
  MultiSCMRevisionState revisionState=new MultiSCMRevisionState();
  build.addAction(revisionState);
  HashSet<Object> scmActions=new HashSet<Object>();
  FileOutputStream logStream=new FileOutputStream(changelogFile);
  OutputStreamWriter logWriter=new OutputStreamWriter(logStream);
  logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.ROOT_XML_TAG));
  boolean checkoutOK=true;
  for (  SCM scm : scms) {
    String changeLogPath=changelogFile.getPath() + "String_Node_Str";
    File subChangeLog=new File(changeLogPath);
    checkoutOK=scm.checkout(build,launcher,workspace,listener,subChangeLog) && checkoutOK;
    List<Action> actions=build.getActions();
    for (    Action a : actions) {
      if (!scmActions.contains(a) && a instanceof SCMRevisionState) {
        scmActions.add(a);
        revisionState.add(scm.getClass().getName(),(SCMRevisionState)a);
      }
    }
    String subLogText=FileUtils.readFileToString(subChangeLog);
    logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.SUB_LOG_TAG,scm.getType(),subLogText,MultiSCMChangeLogParser.SUB_LOG_TAG));
    subChangeLog.delete();
  }
  logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.ROOT_XML_TAG));
  logWriter.close();
  return checkoutOK;
}

Fixed version (ground truth):
@Override public boolean checkout(AbstractBuild<?,?> build,Launcher launcher,FilePath workspace,BuildListener listener,File changelogFile) throws IOException, InterruptedException {
  MultiSCMRevisionState revisionState=new MultiSCMRevisionState();
  build.addAction(revisionState);
  HashSet<Object> scmActions=new HashSet<Object>();
  FileOutputStream logStream=new FileOutputStream(changelogFile);
  OutputStreamWriter logWriter=new OutputStreamWriter(logStream);
  logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.ROOT_XML_TAG));
  boolean checkoutOK=true;
  for (  SCM scm : scms) {
    String changeLogPath=changelogFile.getPath() + "String_Node_Str";
    File subChangeLog=new File(changeLogPath);
    checkoutOK=scm.checkout(build,launcher,workspace,listener,subChangeLog) && checkoutOK;
    List<Action> actions=build.getActions();
    for (    Action a : actions) {
      if (!scmActions.contains(a) && a instanceof SCMRevisionState) {
        scmActions.add(a);
        revisionState.add(scm,workspace,build,(SCMRevisionState)a);
      }
    }
    String subLogText=FileUtils.readFileToString(subChangeLog);
    logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.SUB_LOG_TAG,scm.getType(),subLogText,MultiSCMChangeLogParser.SUB_LOG_TAG));
    subChangeLog.delete();
  }
  logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.ROOT_XML_TAG));
  logWriter.close();
  return checkoutOK;
}
Program: 2103
Project: 2103
Buggy source:
@Override public boolean checkout(AbstractBuild<?,?> build,Launcher launcher,FilePath workspace,BuildListener listener,File changelogFile) throws IOException, InterruptedException {
  MultiSCMRevisionState revisionState=new MultiSCMRevisionState();
  build.addAction(revisionState);
  HashSet<Object> scmActions=new HashSet<Object>();
  FileOutputStream logStream=new FileOutputStream(changelogFile);
  OutputStreamWriter logWriter=new OutputStreamWriter(logStream);
  logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.ROOT_XML_TAG));
  boolean checkoutOK=true;
  for (  SCM scm : scms) {
    String changeLogPath=changelogFile.getPath() + "String_Node_Str";
    File subChangeLog=new File(changeLogPath);
    checkoutOK=scm.checkout(build,launcher,workspace,listener,subChangeLog) && checkoutOK;
    List<Action> actions=build.getActions();
    for (    Action a : actions) {
      if (!scmActions.contains(a) && a instanceof SCMRevisionState) {
        scmActions.add(a);
        revisionState.add(scm,workspace,build,(SCMRevisionState)a);
      }
    }
    if (subChangeLog.exists()) {
      String subLogText=FileUtils.readFileToString(subChangeLog);
      logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.SUB_LOG_TAG,scm.getType(),subLogText,MultiSCMChangeLogParser.SUB_LOG_TAG));
      subChangeLog.delete();
    }
  }
  logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.ROOT_XML_TAG));
  logWriter.close();
  return checkoutOK;
}

Fixed version (ground truth):
@Override public boolean checkout(AbstractBuild<?,?> build,Launcher launcher,FilePath workspace,BuildListener listener,File changelogFile) throws IOException, InterruptedException {
  MultiSCMRevisionState revisionState=new MultiSCMRevisionState();
  build.addAction(revisionState);
  HashSet<Object> scmActions=new HashSet<Object>();
  FileOutputStream logStream=new FileOutputStream(changelogFile);
  OutputStreamWriter logWriter=new OutputStreamWriter(logStream);
  logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.ROOT_XML_TAG));
  boolean checkoutOK=true;
  for (  SCM scm : scms) {
    String changeLogPath=changelogFile.getPath() + "String_Node_Str";
    File subChangeLog=new File(changeLogPath);
    checkoutOK=scm.checkout(build,launcher,workspace,listener,subChangeLog) && checkoutOK;
    List<Action> actions=build.getActions();
    for (    Action a : actions) {
      if (!scmActions.contains(a) && a instanceof SCMRevisionState) {
        scmActions.add(a);
        revisionState.add(scm,workspace,build,(SCMRevisionState)a);
      }
    }
    if (subChangeLog.exists()) {
      String subLogText=FileUtils.readFileToString(subChangeLog);
      logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.SUB_LOG_TAG,scm.getType(),StringEscapeUtils.escapeXml(subLogText),MultiSCMChangeLogParser.SUB_LOG_TAG));
      subChangeLog.delete();
    }
  }
  logWriter.write(String.format("String_Node_Str",MultiSCMChangeLogParser.ROOT_XML_TAG));
  logWriter.close();
  return checkoutOK;
}
Program: 2104
Project: 2104
Buggy source:
@Override public void characters(char[] data,int startIndex,int length) throws SAXException {
  try {
    if (outputStream != null) {
      if (newStream) {
        while (length > 0 && Character.isWhitespace(data[startIndex])) {
          startIndex+=1;
          length-=1;
        }
      }
      outputStream.write(data,startIndex,length);
      newStream=false;
    }
  }
 catch (  IOException e) {
    throw new SAXException("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void characters(char[] data,int startIndex,int length) throws SAXException {
  if (buffer != null) {
    while (length > 0 && Character.isWhitespace(data[startIndex])) {
      startIndex+=1;
      length-=1;
    }
    for (int i=0; i < length; i++) {
      buffer.append(data[startIndex + i]);
    }
  }
}