nus-yam/ex-repair huggingface dataset:
Program: 1979
Project: 1979
Buggy source:
public static String addToStockableString(int UID,String s,Stockable st){
  if (s.contains(st.toString() + "String_Node_Str"))   return "String_Node_Str";
  return s+=st.toString() + "String_Node_Str";
}

Fixed version (ground truth):
public static String addToStockableString(String s,Stockable st){
  if (s.contains(st.toString() + "String_Node_Str"))   return "String_Node_Str";
  return st.toString() + "String_Node_Str";
}
Program: 1980
Project: 1980
Buggy source:
public static void saveStockables(int UID,ConcurrentHashMap<Check,Stockable> stockables){
  String string="String_Node_Str";
  setStockables(UID,string);
  for (  Entry<Check,Stockable> entry : stockables.entrySet()) {
    string+=addToStockableString(UID,string,entry.getValue());
  }
  setStockables(UID,string);
}

Fixed version (ground truth):
public static void saveStockables(int UID,ConcurrentHashMap<Check,Stockable> stockables){
  String string="String_Node_Str";
  setStockables(UID,string);
  int count=0;
  for (  Stockable entry : stockables.values()) {
    string+=addToStockableString(string,entry);
    count+=1;
  }
  Citizens.log.info("String_Node_Str" + count);
  setStockables(UID,string);
}
Program: 1981
Project: 1981
Buggy source:
/** 
 * Buy an armor repair
 * @param player
 * @param npc
 * @param armor
 * @param armorName
 * @param plural
 */
private void buyArmorRepair(Player player,HumanNPC npc,ItemStack armor,String armorName,boolean plural){
  String msg="String_Node_Str";
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(Operation.BLACKSMITH_ARMOR_REPAIR,player)) {
    if (EconomyHandler.useEconomy()) {
      double paid=EconomyHandler.pay(Operation.BLACKSMITH_ARMOR_REPAIR,player);
      if (paid > 0) {
        if (armor.getDurability() > 0) {
          armor.setDurability((short)0);
          msg=ChatColor.GREEN + ("String_Node_Str") + StringUtils.yellowify(armorName);
          if (plural) {
            msg+="String_Node_Str";
          }
 else {
            msg+="String_Node_Str";
          }
          msg+=StringUtils.yellowify(npc.getStrippedName()) + "String_Node_Str" + StringUtils.yellowify(EconomyHandler.getPaymentType(Operation.BLACKSMITH_ARMOR_REPAIR,"String_Node_Str" + paid,ChatColor.YELLOW))+ "String_Node_Str";
          player.sendMessage(msg);
        }
 else {
          player.sendMessage(ChatColor.RED + "String_Node_Str");
        }
      }
    }
 else {
      player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(Operation.BLACKSMITH_ARMOR_REPAIR,player));
    return;
  }
}

Fixed version (ground truth):
/** 
 * Buy an armor repair
 * @param player
 * @param npc
 * @param armor
 * @param armorName
 * @param plural
 */
private void buyArmorRepair(Player player,HumanNPC npc,ItemStack armor,String armorName,boolean plural){
  String msg="String_Node_Str";
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(Operation.BLACKSMITH_ARMOR_REPAIR,player)) {
    if (EconomyHandler.useEconomy()) {
      if (validateArmorToRepair(armor)) {
        if (armor.getDurability() > 0) {
          double paid=EconomyHandler.pay(Operation.BLACKSMITH_ARMOR_REPAIR,player);
          if (paid > 0) {
            armor.setDurability((short)0);
            msg=ChatColor.GREEN + ("String_Node_Str") + StringUtils.yellowify(armorName);
            if (plural) {
              msg+="String_Node_Str";
            }
 else {
              msg+="String_Node_Str";
            }
            msg+=StringUtils.yellowify(npc.getStrippedName()) + "String_Node_Str" + StringUtils.yellowify(EconomyHandler.getPaymentType(Operation.BLACKSMITH_ARMOR_REPAIR,"String_Node_Str" + paid,ChatColor.YELLOW))+ "String_Node_Str";
            player.sendMessage(msg);
          }
        }
 else {
          player.sendMessage(ChatColor.RED + "String_Node_Str");
        }
      }
 else {
        player.sendMessage(ChatColor.RED + "String_Node_Str");
      }
    }
 else {
      player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(Operation.BLACKSMITH_ARMOR_REPAIR,player));
    return;
  }
}
Program: 1982
Project: 1982
Buggy source:
/** 
 * Validate that a tool has a durability and can be repaired
 * @param item
 * @return
 */
private boolean validateToolToRepair(ItemStack item){
  int id=item.getTypeId();
  if (id == 256 || id == 257 || id == 258 || id == 259 || id == 267 || id == 268 || id == 269 || id == 270 || id == 271 || id == 272 || id == 273 || id == 274 || id == 275 || id == 276 || id == 277 || id == 278 || id == 279 || id == 283 || id == 284 || id == 285 || id == 286 || id == 290 || id == 291 || id == 292 || id == 293 || id == 294 || id == 346) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Validate that a tool has a durability and can be repaired
 * @param item
 * @return
 */
private boolean validateToolToRepair(ItemStack tool){
  int id=tool.getTypeId();
  if (id == 256 || id == 257 || id == 258 || id == 259 || id == 267 || id == 268 || id == 269 || id == 270 || id == 271 || id == 272 || id == 273 || id == 274 || id == 275 || id == 276 || id == 277 || id == 278 || id == 279 || id == 283 || id == 284 || id == 285 || id == 286 || id == 290 || id == 291 || id == 292 || id == 293 || id == 294 || id == 346) {
    return true;
  }
 else {
    return false;
  }
}
Program: 1985
Project: 1985
Buggy source:
private void displayMoney(Player player,HumanNPC npc){
  player.sendMessage(StringUtils.yellowify(npc.getName()) + "String_Node_Str" + StringUtils.yellowify(IconomyInterface.getCurrency(npc.getBalance()))+ "String_Node_Str");
}

Fixed version (ground truth):
private void displayMoney(Player player,HumanNPC npc){
  player.sendMessage(StringUtils.yellowify(npc.getName()) + "String_Node_Str" + StringUtils.yellowify(IconomyInterface.format(npc.getBalance()))+ "String_Node_Str");
}
Program: 1987
Project: 1987
Buggy source:
/** 
 * Gets the currency of a payment (iConomy currency or item name).
 * @param payment
 * @return
 */
public static String getCurrency(Payment payment,ChatColor colour){
  if (useEconomy) {
    if (payment.isiConomy() && useIconomy())     return IconomyInterface.getCurrency(payment.getPrice());
 else     return ItemInterface.getCurrency(payment,colour);
  }
 else   return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Gets the currency of a payment (iConomy currency or item name).
 * @param payment
 * @return
 */
public static String getCurrency(Payment payment,ChatColor colour){
  if (useEconomy) {
    if (payment.isiConomy() && useIconomy()) {
      return IconomyInterface.format(payment.getPrice());
    }
 else {
      return ItemInterface.getCurrency(payment,colour);
    }
  }
 else   return "String_Node_Str";
}
Program: 1988
Project: 1988
Buggy source:
/** 
 * Gets what item ID or iConomy currency is being used for an operation.
 * @param op
 * @param amount
 * @return
 */
public static String getPaymentType(Operation op,String amount,ChatColor colour){
  if (useEconomy) {
    if (useIconomy())     return IconomyInterface.getCurrency(amount);
 else     return ItemInterface.getCurrency(op,colour);
  }
 else   return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Gets what item ID or iConomy currency is being used for an operation.
 * @param op
 * @param amount
 * @return
 */
public static String getPaymentType(Operation op,String amount,ChatColor colour){
  if (useEconomy) {
    if (useIconomy())     return IconomyInterface.format(amount);
 else     return ItemInterface.getCurrency(op,colour);
  }
 else   return "String_Node_Str";
}
Program: 1989
Project: 1989
Buggy source:
public static String getFormattedBalance(String name){
  return getCurrency(getBalance(name));
}

Fixed version (ground truth):
public static String getFormattedBalance(String name){
  return format(getBalance(name));
}
Program: 1990
Project: 1990
Buggy source:
/** 
 * Checks whether an npc has enough in its balance for a payment.
 * @param payment
 * @param npc
 * @return
 */
public static boolean hasEnough(Payment payment,HumanNPC npc){
  return npc.getBalance() > payment.getPrice();
}

Fixed version (ground truth):
/** 
 * Checks whether an npc has enough in its balance for a payment.
 * @param payment
 * @param npc
 * @return
 */
public static boolean hasEnough(Payment payment,HumanNPC npc){
  return npc.getBalance() >= payment.getPrice();
}
Program: 1991
Project: 1991
Buggy source:
/** 
 * Pays for a payment using the player's money.
 * @param player
 * @param payment
 * @return
 */
public static double pay(Player player,Payment payment){
  iConomy.getAccount(player.getName()).getHoldings().subtract(payment.getPrice());
  return payment.getPrice();
}

Fixed version (ground truth):
/** 
 * Pays for a payment using the player's money.
 * @param player
 * @param payment
 * @return
 */
public static double pay(Player player,Payment payment){
  subtract(player.getName(),payment.getPrice());
  return payment.getPrice();
}
Program: 1994
Project: 1994
Buggy source:
/** 
 * Purchase a tool repair
 * @param player
 * @param npc
 * @param op
 */
private void buyToolRepair(Player player,HumanNPC npc,Operation op){
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(op,player)) {
    if (EconomyHandler.useEconomy()) {
      double paid=EconomyHandler.pay(op,player);
      if (paid > 0) {
        ItemStack item=player.getItemInHand();
        if (validateToolToRepair(item)) {
          if (item.getDurability() > 0) {
            item.setDurability((short)0);
            player.sendMessage(StringUtils.yellowify(npc.getStrippedName()) + "String_Node_Str" + StringUtils.yellowify(EconomyHandler.getPaymentType(op,"String_Node_Str" + paid,ChatColor.YELLOW))+ "String_Node_Str");
          }
 else {
            player.sendMessage(ChatColor.RED + "String_Node_Str");
          }
        }
      }
    }
 else {
      player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(op,player));
    return;
  }
}

Fixed version (ground truth):
/** 
 * Purchase a tool repair
 * @param player
 * @param npc
 * @param op
 */
private void buyToolRepair(Player player,HumanNPC npc){
  if (!EconomyHandler.useEconomy() || EconomyHandler.canBuy(Operation.BLACKSMITH_TOOL_REPAIR,player)) {
    if (EconomyHandler.useEconomy()) {
      ItemStack item=player.getItemInHand();
      if (validateToolToRepair(item)) {
        if (item.getDurability() > 0) {
          double paid=EconomyHandler.pay(Operation.BLACKSMITH_TOOL_REPAIR,player);
          if (paid > 0) {
            item.setDurability((short)0);
            player.sendMessage(StringUtils.yellowify(npc.getStrippedName()) + "String_Node_Str" + StringUtils.yellowify(EconomyHandler.getPaymentType(Operation.BLACKSMITH_TOOL_REPAIR,"String_Node_Str" + paid,ChatColor.YELLOW))+ "String_Node_Str");
          }
        }
 else {
          player.sendMessage(ChatColor.RED + "String_Node_Str");
        }
      }
    }
 else {
      player.sendMessage(ChatColor.GRAY + "String_Node_Str");
    }
  }
 else   if (EconomyHandler.useEconomy()) {
    player.sendMessage(MessageUtils.getNoMoneyMessage(Operation.BLACKSMITH_TOOL_REPAIR,player));
    return;
  }
}
Program: 1996
Project: 1996
Buggy source:
private boolean validateToolToRepair(ItemStack item){
  int id=item.getTypeId();
  if (id == 256 || id == 257 || id == 258 || id == 259 || id == 267 || id == 268 || id == 269 || id == 270 || id == 271 || id == 272 || id == 273 || id == 274 || id == 275 || id == 276 || id == 277 || id == 278 || id == 279 || id == 283 || id == 284 || id == 285 || id == 286 || id == 290 || id == 291 || id == 292 || id == 293 || id == 294 || id == 346) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Validate that a tool has a durability and can be repaired
 * @param item
 * @return
 */
private boolean validateToolToRepair(ItemStack item){
  int id=item.getTypeId();
  if (id == 256 || id == 257 || id == 258 || id == 259 || id == 267 || id == 268 || id == 269 || id == 270 || id == 271 || id == 272 || id == 273 || id == 274 || id == 275 || id == 276 || id == 277 || id == 278 || id == 279 || id == 283 || id == 284 || id == 285 || id == 286 || id == 290 || id == 291 || id == 292 || id == 293 || id == 294 || id == 346) {
    return true;
  }
 else {
    return false;
  }
}
Program: 2003
Project: 2003
Buggy source:
/** 
 * Handles what happens when an npc gets right clicked.
 * @param npc
 * @param player
 */
public static void handleRightClick(HumanNPC npc,Player player){
  if (npc.getTrader().isFree()) {
    if (!BasicExecutor.hasPermission("String_Node_Str",player)) {
      return;
    }
    Mode mode=Mode.NORMAL;
    if (NPCManager.validateOwnership(player,npc.getUID())) {
      mode=Mode.STOCK;
    }
 else     if (npc.getTrader().isUnlimited()) {
      mode=Mode.INFINITE;
    }
    TraderTask task=new TraderTask(npc,player,Citizens.plugin,mode);
    int id=Citizens.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(Citizens.plugin,task,0,1);
    tasks.add(id);
    task.addID(id);
    npc.getTrader().setFree(false);
    showInventory(npc,player);
  }
 else   player.sendMessage(ChatColor.RED + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Handles what happens when an npc gets right clicked.
 * @param npc
 * @param player
 */
public static void handleRightClick(HumanNPC npc,Player player){
  if (npc.getTrader().isFree()) {
    if (!Permission.hasPermission("String_Node_Str",player)) {
      return;
    }
    Mode mode=Mode.NORMAL;
    if (NPCManager.validateOwnership(player,npc.getUID())) {
      mode=Mode.STOCK;
    }
 else     if (npc.getTrader().isUnlimited()) {
      mode=Mode.INFINITE;
    }
    TraderTask task=new TraderTask(npc,player,Citizens.plugin,mode);
    int id=Citizens.plugin.getServer().getScheduler().scheduleSyncRepeatingTask(Citizens.plugin,task,0,1);
    tasks.add(id);
    task.addID(id);
    npc.getTrader().setFree(false);
    showInventory(npc,player);
  }
 else   player.sendMessage(ChatColor.RED + "String_Node_Str");
}
Program: 2006
Project: 2006
Buggy source:
/** 
 * Sets the in-hand item of an npc.
 * @param p
 * @param npc
 * @param material
 */
public void setItemInHand(Player p,HumanNPC npc,String material){
  Material mat=StringUtils.parseMaterial(material);
  if (mat == null) {
    p.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  if (!p.getInventory().contains(mat)) {
    p.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  p.getInventory().remove(mat);
  ArrayList<Integer> items=PropertyPool.getItems(npc.getUID());
  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.registerNPC(npc.getName(),npc.getUID(),npc.getOwner());
  }
}

Fixed version (ground truth):
/** 
 * Sets the in-hand item of an npc.
 * @param p
 * @param npc
 * @param material
 */
public void setItemInHand(Player p,HumanNPC npc,String material){
  Material mat=StringUtils.parseMaterial(material);
  if (mat == null) {
    p.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  if (!p.getInventory().contains(mat)) {
    p.sendMessage(ChatColor.RED + "String_Node_Str");
    return;
  }
  if (npc.isTrader()) {
    p.sendMessage(ChatColor.GRAY + "String_Node_Str");
    return;
  }
  int slot=p.getInventory().first(mat);
  ItemStack item=p.getInventory().getItem(slot);
  int amount=item.getAmount() - 1;
  if (amount == 0)   item=null;
 else   item.setAmount(amount);
  p.getInventory().setItem(slot,item);
  ArrayList<Integer> items=PropertyPool.getItems(npc.getUID());
  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.registerNPC(npc.getName(),npc.getUID(),npc.getOwner());
  }
}
Program: 2007
Project: 2007
Buggy source:
private void handlePlayerItemClicked(int slot,PlayerInventory playerInv){
  playerInv.setItem(slot,previousPlayerInv.getItem(slot));
  ItemStack i=playerInv.getItem(slot);
  Stockable stockable=getStockable(i,"String_Node_Str",true);
  if (stockable == null)   return;
  if (previousPlayerClickedSlot != slot) {
    previousPlayerClickedSlot=slot;
    sendStockableMessage("String_Node_Str",stockable);
    return;
  }
  previousPlayerClickedSlot=slot;
  if (checkMiscellaneous(playerInv,stockable,slot,"String_Node_Str",false))   return;
  ItemStack selling=stockable.getStocking();
  HashMap<Integer,ItemStack> unsold=new HashMap<Integer,ItemStack>();
  if (mode != Mode.INFINITE) {
    unsold=npc.getInventory().addItem(stockable.getPrice().getItemStack());
  }
  if (unsold.size() >= 1) {
    restorePreviousState();
    player.sendMessage(ChatColor.RED + "String_Node_Str" + MessageUtils.getStackToString(selling,ChatColor.RED)+ "String_Node_Str");
    return;
  }
  if (!stockable.isiConomy()) {
    unsold=player.getInventory().addItem(stockable.getStocking());
    if (unsold.size() >= 1) {
      restorePreviousState();
      player.sendMessage(ChatColor.RED + "String_Node_Str" + stockable.getString(ChatColor.RED)+ "String_Node_Str");
      return;
    }
  }
  if (mode != Mode.INFINITE)   EconomyHandler.pay(new Payment(stockable.getStocking(),false),npc,-1);
  EconomyHandler.pay(new Payment(stockable.getPrice()),player,slot);
  player.sendMessage(ChatColor.GREEN + "String_Node_Str");
}

Fixed version (ground truth):
private void handlePlayerItemClicked(int slot,PlayerInventory playerInv){
  playerInv.setItem(slot,previousPlayerInv.getItem(slot));
  ItemStack i=playerInv.getItem(slot);
  Stockable stockable=getStockable(i,"String_Node_Str",true);
  if (stockable == null)   return;
  if (previousPlayerClickedSlot != slot) {
    previousPlayerClickedSlot=slot;
    sendStockableMessage("String_Node_Str",stockable);
    return;
  }
  previousPlayerClickedSlot=slot;
  if (checkMiscellaneous(playerInv,stockable,slot,"String_Node_Str",false))   return;
  ItemStack selling=stockable.getStocking();
  HashMap<Integer,ItemStack> unsold=new HashMap<Integer,ItemStack>();
  if (mode != Mode.INFINITE) {
    unsold=npc.getInventory().addItem(stockable.getStocking());
  }
  if (unsold.size() >= 1) {
    restorePreviousState();
    player.sendMessage(ChatColor.RED + "String_Node_Str" + MessageUtils.getStackToString(selling,ChatColor.RED)+ "String_Node_Str");
    return;
  }
  if (!stockable.isiConomy()) {
    unsold=player.getInventory().addItem(stockable.getPrice().getItemStack());
    if (unsold.size() >= 1) {
      restorePreviousState();
      player.sendMessage(ChatColor.RED + "String_Node_Str" + stockable.getString(ChatColor.RED)+ "String_Node_Str");
      return;
    }
  }
  if (mode != Mode.INFINITE)   EconomyHandler.pay(new Payment(stockable.getPrice()),npc,-1);
  EconomyHandler.pay(new Payment(stockable.getStocking(),false),player,slot);
  player.sendMessage(ChatColor.GREEN + "String_Node_Str");
}
Program: 2008
Project: 2008
Buggy source:
/** 
 * Sends the help page for the trader npc type.
 * @param sender
 * @param page
 */
public static void sendTraderHelp(CommandSender sender){
  header(sender,"String_Node_Str",1,1);
  formatCommand(sender,"String_Node_Str","String_Node_Str","String_Node_Str");
  formatCommand(sender,"String_Node_Str","String_Node_Str","String_Node_Str");
  formatCommand(sender,"String_Node_Str","String_Node_Str","String_Node_Str");
  formatCommand(sender,"String_Node_Str","String_Node_Str","String_Node_Str");
  formatCommand(sender,"String_Node_Str","String_Node_Str","String_Node_Str");
  footer(sender);
}

Fixed version (ground truth):
/** 
 * Sends the help page for the trader npc type.
 * @param sender
 * @param page
 */
public static void sendTraderHelp(CommandSender sender){
  header(sender,"String_Node_Str",1,1);
  formatCommand(sender,"String_Node_Str","String_Node_Str","String_Node_Str");
  formatCommand(sender,"String_Node_Str","String_Node_Str","String_Node_Str");
  formatCommand(sender,"String_Node_Str","String_Node_Str","String_Node_Str");
  formatCommand(sender,"String_Node_Str","String_Node_Str","String_Node_Str");
  formatCommand(sender,"String_Node_Str","String_Node_Str","String_Node_Str");
  formatCommand(sender,"String_Node_Str","String_Node_Str","String_Node_Str");
  footer(sender);
}
Program: 2009
Project: 2009
Buggy source:
@Override public void run(){
  log.info("String_Node_Str");
  PropertyPool.saveAll();
  TraderPropertyPool.saveAll();
  HealerPropertyPool.saveAll();
  QuesterPropertyPool.saveAll();
  log.info("String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  log.info("String_Node_Str");
  PropertyPool.saveAll();
  TraderPropertyPool.saveAll();
  HealerPropertyPool.saveAll();
  WizardPropertyPool.saveAll();
  QuesterPropertyPool.saveAll();
  log.info("String_Node_Str");
}
Program: 2011
Project: 2011
Buggy source:
/** 
 * Schedule a timer to regenerate a healer's health based on their level
 */
private int getHealthRegenRate(){
  int delay=0;
  if (!NPCManager.getNPCList().isEmpty()) {
    for (    Entry<Integer,HumanNPC> entry : NPCManager.getNPCList().entrySet()) {
      int level=HealerPropertyPool.getLevel(entry.getValue().getUID());
      delay=healerHealthRegenIncrement * (11 - level);
      return delay;
    }
  }
 else {
    log.info("String_Node_Str");
    return delay;
  }
  log.info("String_Node_Str");
  return delay;
}

Fixed version (ground truth):
/** 
 * Schedule a timer to regenerate a healer's health based on their level
 */
private int getHealthRegenRate(){
  int delay=0;
  if (!NPCManager.getNPCList().isEmpty()) {
    for (    Entry<Integer,HumanNPC> entry : NPCManager.getNPCList().entrySet()) {
      int level=HealerPropertyPool.getLevel(entry.getValue().getUID());
      delay=healerHealthRegenIncrement * (11 - level);
      return delay;
    }
  }
 else {
    return 12000;
  }
  return delay;
}
Program: 2012
Project: 2012
Buggy source:
@Override public boolean onCommand(CommandSender sender,Command command,String commandLabel,String[] args){
  if (!(sender instanceof Player)) {
    sender.sendMessage(MessageUtils.mustBeIngameMessage);
    return true;
  }
  Player player=(Player)sender;
  HumanNPC npc=null;
  boolean returnval=false;
  if (NPCManager.validateSelected((Player)sender))   npc=NPCManager.getNPC(NPCManager.NPCSelected.get(player.getName()));
 else {
    sender.sendMessage(ChatColor.RED + MessageUtils.mustHaveNPCSelectedMessage);
    return true;
  }
  if (!NPCManager.validateOwnership(player,npc.getUID())) {
    sender.sendMessage(MessageUtils.notOwnerMessage);
    return true;
  }
  if (!npc.isQuester()) {
    sender.sendMessage(ChatColor.RED + "String_Node_Str");
    return true;
  }
 else {
    if (args.length == 1 && args[0].equals("String_Node_Str")) {
      if (BasicExecutor.hasPermission("String_Node_Str",sender)) {
        Quest quest=new Quest(player,npc,QuestType.BUILD,false);
        quest.giveiConomyReward(player,10);
      }
 else {
        sender.sendMessage(MessageUtils.noPermissionsMessage);
      }
      returnval=true;
    }
  }
  return returnval;
}

Fixed version (ground truth):
@Override public boolean onCommand(CommandSender sender,Command command,String commandLabel,String[] args){
  if (!(sender instanceof Player)) {
    sender.sendMessage(MessageUtils.mustBeIngameMessage);
    return true;
  }
  Player player=(Player)sender;
  HumanNPC npc=null;
  boolean returnval=false;
  if (NPCManager.validateSelected((Player)sender))   npc=NPCManager.getNPC(NPCManager.NPCSelected.get(player.getName()));
 else {
    sender.sendMessage(ChatColor.RED + MessageUtils.mustHaveNPCSelectedMessage);
    return true;
  }
  if (!NPCManager.validateOwnership(player,npc.getUID())) {
    sender.sendMessage(MessageUtils.notOwnerMessage);
    return true;
  }
  if (!npc.isQuester()) {
    sender.sendMessage(ChatColor.RED + "String_Node_Str");
    return true;
  }
 else {
    if (args.length == 2 && args[0].equals("String_Node_Str")) {
      if (BasicExecutor.hasPermission("String_Node_Str",sender)) {
        Quest quest=new Quest(player,npc,QuestType.BUILD,false);
        quest.giveiConomyReward(player,10);
      }
 else {
        sender.sendMessage(MessageUtils.noPermissionsMessage);
      }
      returnval=true;
    }
  }
  return returnval;
}
Program: 2013
Project: 2013
Buggy source:
/** 
 * Turns the selected NPC into all types of NPCs
 * @param npc
 * @param player
 */
private void toggleAll(HumanNPC npc,Player player,boolean on){
  if (on) {
    if (!npc.isTrader()) {
      toggleState(player,npc.getTrader());
    }
    if (!npc.isHealer()) {
      toggleState(player,npc.getHealer());
    }
    if (!npc.isWizard()) {
      toggleState(player,npc.getWizard());
    }
  }
 else {
    if (npc.isTrader()) {
      toggleState(player,npc.getTrader());
    }
    if (npc.isHealer()) {
      toggleState(player,npc.getHealer());
    }
    if (npc.isWizard()) {
      toggleState(player,npc.getWizard());
    }
  }
}

Fixed version (ground truth):
/** 
 * Turns the selected NPC into all types of NPCs
 * @param npc
 * @param player
 */
private void toggleAll(HumanNPC npc,Player player,boolean on){
  if (on) {
    if (!npc.isTrader()) {
      toggleState(player,npc.getTrader());
    }
    if (!npc.isHealer()) {
      toggleState(player,npc.getHealer());
    }
    if (!npc.isWizard()) {
      toggleState(player,npc.getWizard());
    }
    if (!npc.isQuester()) {
      toggleState(player,npc.getQuester());
    }
  }
 else {
    if (npc.isTrader()) {
      toggleState(player,npc.getTrader());
    }
    if (npc.isHealer()) {
      toggleState(player,npc.getHealer());
    }
    if (npc.isWizard()) {
      toggleState(player,npc.getWizard());
    }
    if (npc.isQuester()) {
      toggleState(player,npc.getQuester());
    }
  }
}
Program: 2014
Project: 2014
Buggy source:
/** 
 * NPC Wizard Subclass
 * @param npc
 */
public QuesterNPC(HumanNPC npc){
  this.npc=npc;
}

Fixed version (ground truth):
/** 
 * NPC Quester object
 * @param npc
 */
public QuesterNPC(HumanNPC npc){
  this.npc=npc;
}
Program: 2015
Project: 2015
Buggy source:
public static void saveState(HumanNPC npc){
  if (isQuester(npc.getUID())) {
    saveQuester(npc.getUID(),npc.isHealer());
  }
}

Fixed version (ground truth):
public static void saveState(HumanNPC npc){
  if (isQuester(npc.getUID())) {
    saveQuester(npc.getUID(),npc.isQuester());
  }
}
Program: 2016
Project: 2016
Buggy source:
public void setQuester(boolean value){
  this.isQuester=value;
}

Fixed version (ground truth):
public void setQuester(boolean enable){
  this.isQuester=enable;
}
Program: 2018
Project: 2018
Buggy source:
public static void saveLocations(int UID,String locationString){
  locations.setString(UID,locationString);
}

Fixed version (ground truth):
public static void saveLocations(int UID,String locationString){
  locations.setString(UID,locationString.replace("String_Node_Str","String_Node_Str"));
}
Program: 2019
Project: 2019
Buggy source:
public static String getLocations(int UID){
  return locations.getString(UID);
}

Fixed version (ground truth):
public static String getLocations(int UID){
  return locations.getString(UID).replace("String_Node_Str","String_Node_Str");
}
Program: 2020
Project: 2020
Buggy source:
public void addLocation(Location location,String locName){
  String addedLoc="String_Node_Str";
  addedLoc="String_Node_Str" + locName + "String_Node_Str"+ location.getWorld().getName()+ "String_Node_Str"+ location.getX()+ "String_Node_Str"+ location.getY()+ "String_Node_Str"+ location.getZ()+ "String_Node_Str"+ location.getYaw()+ "String_Node_Str"+ location.getPitch()+ "String_Node_Str";
  locations=locations + addedLoc;
  nrOfLocations=locations.split("String_Node_Str").length;
  if (locations.split("String_Node_Str")[0].isEmpty()) {
    nrOfLocations=0;
  }
}

Fixed version (ground truth):
public void addLocation(Location location,String locName){
  String addedLoc="String_Node_Str";
  addedLoc="String_Node_Str" + locName + "String_Node_Str"+ location.getWorld().getName()+ "String_Node_Str"+ location.getX()+ "String_Node_Str"+ location.getY()+ "String_Node_Str"+ location.getZ()+ "String_Node_Str"+ location.getYaw()+ "String_Node_Str"+ location.getPitch()+ "String_Node_Str";
  locations=locations + addedLoc;
  nrOfLocations=locations.split("String_Node_Str").length;
  if (locations.split("String_Node_Str")[0].isEmpty()) {
    nrOfLocations=0;
  }
  WizardPropertyPool.saveLocations(npc.getUID(),locations);
}
Program: 2021
Project: 2021
Buggy source:
public void setLocations(String locationsinc){
  locations=locationsinc;
  nrOfLocations=locations.split("String_Node_Str").length;
  if (locations.split("String_Node_Str")[0].isEmpty()) {
    nrOfLocations=0;
  }
}

Fixed version (ground truth):
public void setLocations(String locationsinc){
  locations=locationsinc;
  nrOfLocations=locations.split("String_Node_Str").length;
  if (locations.split("String_Node_Str")[0].isEmpty()) {
    nrOfLocations=0;
  }
  WizardPropertyPool.saveLocations(npc.getUID(),locations);
}
Program: 2022
Project: 2022
Buggy source:
public HumanEntity getPlayer(){
  return (HumanEntity)this.mcEntity.getBukkitEntity();
}

Fixed version (ground truth):
public Player getPlayer(){
  return (Player)this.mcEntity.getBukkitEntity();
}
Program: 2024
Project: 2024
Buggy source:
@Override public void toggle(){
  npc.setHealer(!npc.isHealer());
}

Fixed version (ground truth):
@Override public void toggle(){
  npc.setHealer(!npc.isHealer());
  if (npc.isHealer()) {
    HealerPropertyPool.saveStrength(npc.getUID(),20);
  }
}
Program: 2027
Project: 2027
Buggy source:
public static void saveAll(){
  healers.save();
  strength.save();
}

Fixed version (ground truth):
public static void saveAll(){
  healers.save();
  strength.save();
  levels.save();
}
Program: 2028
Project: 2028
Buggy source:
public static void saveAll(){
  questers.save();
  questSettings.save();
}

Fixed version (ground truth):
public static void saveAll(){
  questers.save();
}
Program: 2029
Project: 2029
Buggy source:
public static void removeFromFiles(int UID){
  questers.removeKey(UID);
  questSettings.removeKey(UID);
}

Fixed version (ground truth):
public static void removeFromFiles(int UID){
  questers.removeKey(UID);
}
Program: 2031
Project: 2031
Buggy source:
/** 
 * Copies an npc's data and position to another npc.
 * @param npc
 * @param p
 */
private void copyNPC(int UID,String name,Player p){
  ArrayList<String> texts=PropertyPool.getText(UID);
  String colour=PropertyPool.getColour(UID);
  String owner=PropertyPool.getOwner(UID);
  ArrayList<Integer> items=PropertyPool.getItems(UID);
  boolean lookatplayers=PropertyPool.getLookWhenClose(UID);
  boolean talkwhenclose=PropertyPool.getTalkWhenClose(UID);
  int newUID=plugin.handler.spawnNPC(name,p.getLocation(),p.getName());
  HumanNPC newNPC=NPCManager.getNPC(newUID);
  newNPC.setNPCData(new NPCData(newNPC.getName(),newNPC.getUID(),newNPC.getLocation(),colour,items,texts,lookatplayers,talkwhenclose,owner,newNPC.getBalance()));
  PropertyPool.saveBasicNPCState(newUID,newNPC.getNPCData());
  String newName=newNPC.getName();
  NPCManager.removeNPCForRespawn(newUID);
  plugin.handler.spawnExistingNPC(newName,newUID,newNPC.getOwner());
}

Fixed version (ground truth):
/** 
 * Copies an npc's data and position to another npc.
 * @param npc
 * @param p
 */
private void copyNPC(int UID,String name,Player p){
  ArrayList<String> texts=PropertyPool.getText(UID);
  String colour=PropertyPool.getColour(UID);
  String owner=PropertyPool.getOwner(UID);
  ArrayList<Integer> items=PropertyPool.getItems(UID);
  boolean lookatplayers=PropertyPool.getLookWhenClose(UID);
  boolean talkwhenclose=PropertyPool.getTalkWhenClose(UID);
  int newUID=plugin.handler.spawnNPC(name,p.getLocation(),p.getName());
  HumanNPC newNPC=NPCManager.getNPC(newUID);
  newNPC.setNPCData(new NPCData(newNPC.getName(),newNPC.getUID(),newNPC.getLocation(),colour,items,texts,lookatplayers,talkwhenclose,owner,newNPC.getBalance()));
  PropertyPool.saveState(newUID,newNPC.getNPCData());
  String newName=newNPC.getName();
  NPCManager.removeNPCForRespawn(newUID);
  plugin.handler.spawnExistingNPC(newName,newUID,newNPC.getOwner());
}
Program: 2032
Project: 2032
Buggy source:
@Override public boolean onCommand(CommandSender sender,Command command,String commandLabel,String[] args){
  if (!(sender instanceof Player)) {
    sender.sendMessage(MessageUtils.mustBeIngameMessage);
    return true;
  }
  Player player=(Player)sender;
  HumanNPC npc=null;
  boolean returnval=false;
  if (NPCManager.validateSelected((Player)sender))   npc=NPCManager.getNPC(NPCManager.NPCSelected.get(player.getName()));
 else {
    player.sendMessage(ChatColor.RED + MessageUtils.mustHaveNPCSelectedMessage);
    return true;
  }
  if (!NPCManager.validateOwnership(player,npc.getUID())) {
    player.sendMessage(MessageUtils.notOwnerMessage);
    return true;
  }
  if (!npc.isHealer()) {
    player.sendMessage(ChatColor.RED + "String_Node_Str");
    return true;
  }
 else {
    if (args.length == 1 && args[0].equals("String_Node_Str")) {
      if (BasicExecutor.hasPermission("String_Node_Str",sender)) {
        displayHealerStrength(player,npc);
      }
 else {
        player.sendMessage(MessageUtils.noPermissionsMessage);
      }
      returnval=true;
    }
    HealerPropertyPool.saveHealerState(npc);
  }
  return returnval;
}

Fixed version (ground truth):
@Override public boolean onCommand(CommandSender sender,Command command,String commandLabel,String[] args){
  if (!(sender instanceof Player)) {
    sender.sendMessage(MessageUtils.mustBeIngameMessage);
    return true;
  }
  Player player=(Player)sender;
  HumanNPC npc=null;
  boolean returnval=false;
  if (NPCManager.validateSelected((Player)sender))   npc=NPCManager.getNPC(NPCManager.NPCSelected.get(player.getName()));
 else {
    player.sendMessage(ChatColor.RED + MessageUtils.mustHaveNPCSelectedMessage);
    return true;
  }
  if (!NPCManager.validateOwnership(player,npc.getUID())) {
    player.sendMessage(MessageUtils.notOwnerMessage);
    return true;
  }
  if (!npc.isHealer()) {
    player.sendMessage(ChatColor.RED + "String_Node_Str");
    return true;
  }
 else {
    if (args.length == 1 && args[0].equals("String_Node_Str")) {
      if (BasicExecutor.hasPermission("String_Node_Str",sender)) {
        displayHealerStrength(player,npc);
      }
 else {
        player.sendMessage(MessageUtils.noPermissionsMessage);
      }
      returnval=true;
    }
    HealerPropertyPool.saveState(npc);
  }
  return returnval;
}
Program: 2036
Project: 2036
Buggy source:
/** 
 * Gets the currency of a payment (iConomy currency or item name).
 * @param payment
 * @return
 */
public static String getCurrency(Payment payment){
  if (useEconomy) {
    if (payment.isiConomy() && useIconomy())     return IconomyInterface.getCurrency(payment.getPrice());
 else     return ItemInterface.getCurrency(payment);
  }
 else   return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Gets the currency of a payment (iConomy currency or item name).
 * @param payment
 * @return
 */
public static String getCurrency(Payment payment,ChatColor colour){
  if (useEconomy) {
    if (payment.isiConomy() && useIconomy())     return IconomyInterface.getCurrency(payment.getPrice());
 else     return ItemInterface.getCurrency(payment,colour);
  }
 else   return "String_Node_Str";
}
Program: 2037
Project: 2037
Buggy source:
/** 
 * Gets what item ID or iConomy currency is being used for an operation.
 * @param op
 * @param amount
 * @return
 */
public static String getPaymentType(Operation op,String amount){
  if (useEconomy) {
    if (useIconomy())     return IconomyInterface.getCurrency(amount);
 else     return ItemInterface.getCurrency(op);
  }
 else   return "String_Node_Str";
}

Fixed version (ground truth):
/** 
 * Gets what item ID or iConomy currency is being used for an operation.
 * @param op
 * @param amount
 * @return
 */
public static String getPaymentType(Operation op,String amount,ChatColor colour){
  if (useEconomy) {
    if (useIconomy())     return IconomyInterface.getCurrency(amount);
 else     return ItemInterface.getCurrency(op,colour);
  }
 else   return "String_Node_Str";
}
Program: 2039
Project: 2039
Buggy source:
/** 
 * Sends the help page for the basic npc type.
 * @param sender
 * @param page
 */
private void sendBasicHelpPage(CommandSender sender,String page){
  int pageNum=Integer.valueOf(page);
switch (pageNum) {
case 1:
    sender.sendMessage("String_Node_Str" + Citizens.getVersion() + "String_Node_Str");
  sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
break;
case 2:
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
break;
case 3:
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
break;
case 4:
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
break;
default :
sender.sendMessage("String_Node_Str" + pageNum + "String_Node_Str");
break;
}
}

Fixed version (ground truth):
/** 
 * Sends the help page for the basic npc type.
 * @param sender
 * @param page
 */
private void sendBasicHelpPage(CommandSender sender,int page){
switch (page) {
case 1:
    sender.sendMessage(ChatColor.GOLD + "String_Node_Str" + Citizens.getVersion()+ "String_Node_Str");
  sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
break;
case 2:
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
break;
case 3:
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
break;
case 4:
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage(ChatColor.GRAY + "String_Node_Str");
break;
default :
sender.sendMessage(ChatColor.GRAY + "String_Node_Str" + page+ "String_Node_Str");
break;
}
}
Program: 2041
Project: 2041
Buggy source:
/** 
 * Sends the help page for the trader npc type.
 * @param sender
 * @param page
 */
private void sendTraderHelpPage(CommandSender sender,String page){
  int pageNum=Integer.valueOf(page);
switch (pageNum) {
case 1:
    sender.sendMessage("String_Node_Str" + Citizens.getVersion() + "String_Node_Str");
  sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
break;
case 2:
sender.sendMessage("String_Node_Str" + Citizens.getVersion() + "String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
break;
default :
sender.sendMessage("String_Node_Str" + pageNum + "String_Node_Str");
break;
}
}

Fixed version (ground truth):
/** 
 * Sends the help page for the trader npc type.
 * @param sender
 * @param page
 */
private void sendTraderHelpPage(CommandSender sender,int page){
switch (page) {
case 1:
    sender.sendMessage(ChatColor.GOLD + "String_Node_Str" + Citizens.getVersion()+ "String_Node_Str");
  sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
break;
case 2:
sender.sendMessage(ChatColor.GOLD + "String_Node_Str" + Citizens.getVersion()+ "String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage("String_Node_Str");
sender.sendMessage(ChatColor.GRAY + "String_Node_Str");
break;
default :
sender.sendMessage(ChatColor.GRAY + "String_Node_Str" + page+ "String_Node_Str");
break;
}
}
Program: 2042
Project: 2042
Buggy source:
private boolean checkData(MaterialData first,MaterialData second){
  int data=0;
  int data2=0;
  if (first != null)   data=first.getData();
  if (second != null)   data2=second.getData();
  if (data == data2 || data == Citizens.MAGIC_DATA_VALUE)   return true;
  return false;
}

Fixed version (ground truth):
private boolean checkData(MaterialData first,MaterialData second){
  int data=0;
  int data2=0;
  if (first != null)   data=first.getData();
  if (second != null)   data2=second.getData();
  Citizens.log.info(data + "String_Node_Str" + data2);
  if (data == data2 || data == Citizens.MAGIC_DATA_VALUE)   return true;
  return false;
}
Program: 2043
Project: 2043
Buggy source:
/** 
 * Formats the paid message for an operation.
 * @param op
 * @param paid
 * @param npcName
 * @param type
 * @param useType
 * @return
 */
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))+ "String_Node_Str";
  if (useType)   message+=StringUtils.yellowify(npcName) + "String_Node_Str" + StringUtils.yellowify(type)+ "String_Node_Str";
 else   message+=StringUtils.yellowify(npcName) + "String_Node_Str";
  return message;
}

Fixed version (ground truth):
/** 
 * Formats the paid message for an operation.
 * @param op
 * @param paid
 * @param npcName
 * @param type
 * @param useType
 * @return
 */
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(op,"String_Node_Str" + paid))+ "String_Node_Str";
  if (useType)   message+=StringUtils.yellowify(npcName) + "String_Node_Str" + StringUtils.yellowify(type)+ "String_Node_Str";
 else   message+=StringUtils.yellowify(npcName) + "String_Node_Str";
  return message;
}
Program: 2044
Project: 2044
Buggy source:
public static Location getActualLocationFromName(int UID){
  String[] values=PropertyPool.locations.getString(UID).split("String_Node_Str");
  if (values.length != 6) {
    log.info("String_Node_Str" + values.length);
    return null;
  }
 else {
    Location loc=new Location(Citizens.plugin.getServer().getWorld(values[0]),NPCManager.getNPC(UID).getX(),NPCManager.getNPC(UID).getY(),NPCManager.getNPC(UID).getZ(),Float.parseFloat(values[4]),Float.parseFloat(values[5]));
    return loc;
  }
}

Fixed version (ground truth):
public static Location getActualLocationFromName(int UID){
  String[] values=PropertyPool.locations.getString(UID).split("String_Node_Str");
  if (values.length != 6) {
    log.info("String_Node_Str" + values.length);
    return null;
  }
 else {
    Location loc=new Location(Bukkit.getServer().getWorld(values[0]),NPCManager.getNPC(UID).getX(),NPCManager.getNPC(UID).getY(),NPCManager.getNPC(UID).getZ(),Float.parseFloat(values[4]),Float.parseFloat(values[5]));
    return loc;
  }
}
Program: 2045
Project: 2045
Buggy source:
public static Location getLocationFromID(int UID){
  String[] values=PropertyPool.locations.getString(UID).split("String_Node_Str");
  if (values.length != 6) {
    log.info("String_Node_Str" + values.length);
    return null;
  }
 else {
    Location loc=new Location(Citizens.plugin.getServer().getWorld(values[0]),Double.parseDouble(values[1]),Double.parseDouble(values[2]),Double.parseDouble(values[3]),Float.parseFloat(values[4]),Float.parseFloat(values[5]));
    return loc;
  }
}

Fixed version (ground truth):
public static Location getLocationFromID(int UID){
  String[] values=PropertyPool.locations.getString(UID).split("String_Node_Str");
  if (values.length != 6) {
    log.info("String_Node_Str" + values.length);
    return null;
  }
 else {
    Location loc=new Location(Bukkit.getServer().getWorld(values[0]),Double.parseDouble(values[1]),Double.parseDouble(values[2]),Double.parseDouble(values[3]),Float.parseFloat(values[4]),Float.parseFloat(values[5]));
    return loc;
  }
}
Program: 2046
Project: 2046
Buggy source:
public static void addStockable(int UID,Stockable s){
  String write="String_Node_Str";
  write+=s.toString() + "String_Node_Str";
  stocking.setString(UID,write);
}

Fixed version (ground truth):
public static void addStockable(int UID,Stockable s){
  String write="String_Node_Str";
  write+=s.toString() + "String_Node_Str";
  String read=stocking.getString(UID);
  stocking.setString(UID,read + write);
}
Program: 2047
Project: 2047
Buggy source:
public static ConcurrentHashMap<Check,Stockable> getStockables(int UID){
  ConcurrentHashMap<Check,Stockable> stockables=new ConcurrentHashMap<Check,Stockable>();
  int i=0;
  for (  String s : stocking.getString(UID).split("String_Node_Str")) {
    i=0;
    ItemStack stack=new ItemStack(37);
    ItemPrice price=new ItemPrice(0);
    boolean selling=false;
    for (    String main : s.split("String_Node_Str")) {
switch (i) {
case 0:
        String[] split=main.split("String_Node_Str");
      MaterialData data=new MaterialData(Integer.parseInt(split[2]));
    stack=new ItemStack(Integer.parseInt(split[0]),Integer.parseInt(split[1]));
  if (data != null)   stack.setData(data);
break;
case 1:
String[] parts=main.split("String_Node_Str");
if (parts.length == 2) {
price=new ItemPrice(Integer.parseInt(parts[0]));
price.setiConomy(Boolean.parseBoolean(parts[1]));
}
 else {
price=new ItemPrice(Integer.parseInt(parts[0]),Integer.parseInt(parts[1]),Integer.parseInt(parts[2]));
price.setiConomy(Boolean.parseBoolean(parts[3]));
}
break;
case 2:
selling=Boolean.parseBoolean(main);
break;
}
i+=1;
}
Stockable stock=new Stockable(stack,price,selling);
stockables.put(stock.createCheck(),stock);
}
return stockables;
}

Fixed version (ground truth):
public static ConcurrentHashMap<Check,Stockable> getStockables(int UID){
  ConcurrentHashMap<Check,Stockable> stockables=new ConcurrentHashMap<Check,Stockable>();
  int i=0;
  for (  String s : stocking.getString(UID).split("String_Node_Str")) {
    if (s.isEmpty())     continue;
    i=0;
    ItemStack stack=new ItemStack(37);
    ItemPrice price=new ItemPrice(0);
    boolean selling=false;
    for (    String main : s.split("String_Node_Str")) {
switch (i) {
case 0:
        String[] split=main.split("String_Node_Str");
      MaterialData data=new MaterialData(Integer.parseInt(split[2]));
    stack=new ItemStack(Integer.parseInt(split[0]),Integer.parseInt(split[1]));
  if (data != null)   stack.setData(data);
break;
case 1:
String[] parts=main.split("String_Node_Str");
if (parts.length == 2) {
price=new ItemPrice(Integer.parseInt(parts[0]));
price.setiConomy(Boolean.parseBoolean(parts[1]));
}
 else {
price=new ItemPrice(Integer.parseInt(parts[0]),Integer.parseInt(parts[1]),Integer.parseInt(parts[2]));
price.setiConomy(Boolean.parseBoolean(parts[3]));
}
break;
case 2:
selling=Boolean.parseBoolean(main);
break;
}
i+=1;
}
Stockable stock=new Stockable(stack,price,selling);
stockables.put(stock.createCheck(),stock);
}
return stockables;
}