nus-yam/ex-repair huggingface dataset:
Program: 178106
Project: 178106
Buggy source:
@EventHandler(priority=EventPriority.LOW) public static void onPreSellTransaction(PreTransactionEvent event){
  if (event.isCancelled() || event.getTransactionType() != SELL) {
    return;
  }
  String player=event.getClient().getName();
  String ownerName=event.getOwner().getName();
  ItemStack[] stock=event.getStock();
  double price=event.getPrice();
  double pricePerItem=event.getPrice() / InventoryUtil.countItems(stock);
  double walletMoney=Economy.getBalance(ownerName);
  if (Economy.isOwnerEconomicallyActive(event.getOwnerInventory()) && !Economy.hasEnough(ownerName,price)) {
    int amountAffordable=getAmountOfAffordableItems(walletMoney,pricePerItem);
    if (amountAffordable < 1) {
      event.setCancelled(SHOP_DOES_NOT_HAVE_ENOUGH_MONEY);
      return;
    }
    event.setPrice(amountAffordable * pricePerItem);
    event.setStock(getCountedItemStack(stock,amountAffordable));
  }
  stock=event.getStock();
  if (Economy.add(player,price)) {
    Economy.subtract(player,price);
  }
 else {
    event.setCancelled(CLIENT_DEPOSIT_FAILED);
    return;
  }
  if (!InventoryUtil.hasItems(stock,event.getClientInventory())) {
    ItemStack[] itemsHad=getItems(stock,event.getClientInventory());
    int posessedItemCount=InventoryUtil.countItems(itemsHad);
    if (posessedItemCount <= 0) {
      event.setCancelled(NOT_ENOUGH_STOCK_IN_INVENTORY);
      return;
    }
    event.setPrice(pricePerItem * posessedItemCount);
    event.setStock(itemsHad);
  }
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOW) public static void onPreSellTransaction(PreTransactionEvent event){
  if (event.isCancelled() || event.getTransactionType() != SELL) {
    return;
  }
  String player=event.getClient().getName();
  String ownerName=event.getOwner().getName();
  ItemStack[] stock=event.getStock();
  double price=event.getPrice();
  double pricePerItem=event.getPrice() / InventoryUtil.countItems(stock);
  double walletMoney=Economy.getBalance(ownerName);
  if (Economy.isOwnerEconomicallyActive(event.getOwnerInventory()) && !Economy.hasEnough(ownerName,price)) {
    int amountAffordable=getAmountOfAffordableItems(walletMoney,pricePerItem);
    if (amountAffordable < 1) {
      event.setCancelled(SHOP_DOES_NOT_HAVE_ENOUGH_MONEY);
      return;
    }
    event.setPrice(amountAffordable * pricePerItem);
    event.setStock(getCountedItemStack(stock,amountAffordable));
  }
  stock=event.getStock();
  if (!Economy.canHold(player,price)) {
    event.setCancelled(CLIENT_DEPOSIT_FAILED);
    return;
  }
  if (!InventoryUtil.hasItems(stock,event.getClientInventory())) {
    ItemStack[] itemsHad=getItems(stock,event.getClientInventory());
    int posessedItemCount=InventoryUtil.countItems(itemsHad);
    if (posessedItemCount <= 0) {
      event.setCancelled(NOT_ENOUGH_STOCK_IN_INVENTORY);
      return;
    }
    event.setPrice(pricePerItem * posessedItemCount);
    event.setStock(itemsHad);
  }
}
Program: 178107
Project: 178107
Buggy source:
public void onEnable(){
  plugin=this;
  logger=getLogger();
  dataFolder=getDataFolder();
  description=getDescription();
  server=getServer();
  itemDatabase=new ItemDatabase();
  Configuration.pairFileAndClass(loadFile("String_Node_Str"),Properties.class);
  Configuration.pairFileAndClass(loadFile("String_Node_Str"),Messages.class);
  uName.file=loadFile("String_Node_Str");
  uName.load();
  Methods.setPreferred(Properties.PREFERRED_ECONOMY_PLUGIN);
  Dependencies.load();
  registerEvents();
  if (Properties.LOG_TO_DATABASE || Properties.GENERATE_STATISTICS_PAGE) {
    setupDB();
  }
  if (Properties.GENERATE_STATISTICS_PAGE) {
    File htmlFolder=new File(Properties.STATISTICS_PAGE_PATH);
    scheduleTask(new Generator(htmlFolder),300L,Properties.STATISTICS_PAGE_GENERATION_INTERVAL * 20L);
  }
  if (Properties.LOG_TO_FILE) {
    File log=loadFile("String_Node_Str");
    FileHandler handler=loadHandler(log.getAbsolutePath());
    handler.setFormatter(new FileFormatter());
    this.handler=handler;
    logger.addHandler(handler);
  }
  if (!Properties.LOG_TO_CONSOLE) {
    logger.setUseParentHandlers(false);
  }
  getCommand("String_Node_Str").setExecutor(new ItemInfo());
  getCommand("String_Node_Str").setExecutor(new Version());
  startStatistics();
}

Fixed version (ground truth):
public void onEnable(){
  plugin=this;
  logger=getLogger();
  dataFolder=getDataFolder();
  description=getDescription();
  server=getServer();
  Configuration.pairFileAndClass(loadFile("String_Node_Str"),Properties.class);
  Configuration.pairFileAndClass(loadFile("String_Node_Str"),Messages.class);
  itemDatabase=new ItemDatabase();
  uName.file=loadFile("String_Node_Str");
  uName.load();
  Methods.setPreferred(Properties.PREFERRED_ECONOMY_PLUGIN);
  Dependencies.load();
  registerEvents();
  if (Properties.LOG_TO_DATABASE || Properties.GENERATE_STATISTICS_PAGE) {
    setupDB();
  }
  if (Properties.GENERATE_STATISTICS_PAGE) {
    File htmlFolder=new File(Properties.STATISTICS_PAGE_PATH);
    scheduleTask(new Generator(htmlFolder),300L,Properties.STATISTICS_PAGE_GENERATION_INTERVAL * 20L);
  }
  if (Properties.LOG_TO_FILE) {
    File log=loadFile("String_Node_Str");
    FileHandler handler=loadHandler(log.getAbsolutePath());
    handler.setFormatter(new FileFormatter());
    this.handler=handler;
    logger.addHandler(handler);
  }
  if (!Properties.LOG_TO_CONSOLE) {
    logger.setUseParentHandlers(false);
  }
  getCommand("String_Node_Str").setExecutor(new ItemInfo());
  getCommand("String_Node_Str").setExecutor(new Version());
  startStatistics();
}
Program: 178108
Project: 178108
Buggy source:
public ItemDatabase(){
  try {
    Class.forName("String_Node_Str");
  }
 catch (  ClassNotFoundException e) {
    e.printStackTrace();
    ChestShop.getBukkitLogger().severe("String_Node_Str");
  }
  Database database=new Database("String_Node_Str" + new File(ChestShop.getFolder(),"String_Node_Str").getAbsolutePath());
  yaml=new Yaml(new YamlConstructor(),new YamlRepresenter(),new DumperOptions());
  try {
    Statement statement=database.getConnection().createStatement();
    statement.executeUpdate("String_Node_Str");
    statement.close();
  }
 catch (  SQLException e) {
    e.printStackTrace();
  }
  try {
    table=database.getTable("String_Node_Str");
    table.create("String_Node_Str");
  }
 catch (  SQLException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public ItemDatabase(){
  try {
    Class.forName("String_Node_Str");
  }
 catch (  ClassNotFoundException e) {
    e.printStackTrace();
    ChestShop.getBukkitLogger().severe("String_Node_Str");
  }
  Database database=new Database("String_Node_Str" + ChestShop.loadFile("String_Node_Str").getAbsolutePath());
  yaml=new Yaml(new YamlConstructor(),new YamlRepresenter(),new DumperOptions());
  try {
    Statement statement=database.getConnection().createStatement();
    statement.executeUpdate("String_Node_Str");
    statement.close();
  }
 catch (  SQLException e) {
    e.printStackTrace();
  }
  try {
    table=database.getTable("String_Node_Str");
    table.create("String_Node_Str");
  }
 catch (  SQLException e) {
    e.printStackTrace();
  }
}
Program: 178109
Project: 178109
Buggy source:
private void registerEvents(){
  registerEvent(new com.Acrobot.ChestShop.Plugins.ChestShop());
  registerPreShopCreationEvents();
  registerPreTransactionEvents();
  registerPostShopCreationEvents();
  registerPostTransactionEvents();
  registerEvent(new SignBreak());
  registerEvent(new SignCreate());
  registerEvent(new ChestBreak());
  registerEvent(new BlockPlace());
  registerEvent(new PlayerConnect());
  registerEvent(new PlayerInteract());
  registerEvent(new PlayerInventory());
  registerEvent(new ItemInfoListener());
  registerEvent(new RestrictedSign());
  registerEvent(new ShopRefundListener());
  registerEvent(new ShortNameSaver());
  registerEvent(new TeleportFixListener());
}

Fixed version (ground truth):
private void registerEvents(){
  registerEvent(new com.Acrobot.ChestShop.Plugins.ChestShop());
  registerPreShopCreationEvents();
  registerPreTransactionEvents();
  registerPostShopCreationEvents();
  registerPostTransactionEvents();
  registerEvent(new SignBreak());
  registerEvent(new SignCreate());
  registerEvent(new ChestBreak());
  registerEvent(new BlockPlace());
  registerEvent(new PlayerConnect());
  registerEvent(new PlayerInteract());
  registerEvent(new PlayerInventory());
  registerEvent(new ItemInfoListener());
  registerEvent(new RestrictedSign());
  registerEvent(new ShopRefundListener());
  registerEvent(new ShortNameSaver());
  if (!Properties.TURN_OFF_CRAFTBUKKIT_TELEPORTATION_BUGFIX) {
    registerEvent(new TeleportFixListener());
  }
}
Program: 178110
Project: 178110
Buggy source:
private void registerEvents(){
  registerEvent(new com.Acrobot.ChestShop.Plugins.ChestShop());
  registerPreShopCreationEvents();
  registerPreTransactionEvents();
  registerPostShopCreationEvents();
  registerPostTransactionEvents();
  registerEvent(new SignBreak());
  registerEvent(new SignCreate());
  registerEvent(new ChestBreak());
  registerEvent(new BlockPlace());
  registerEvent(new PlayerConnect());
  registerEvent(new PlayerInteract());
  registerEvent(new PlayerInventory());
  registerEvent(new ItemInfoListener());
  registerEvent(new RestrictedSign());
  registerEvent(new ShopRefundListener());
  registerEvent(new ShortNameSaver());
  if (!Properties.TURN_OFF_CRAFTBUKKIT_TELEPORTATION_BUGFIX) {
    registerEvent(new TeleportFixListener());
  }
}

Fixed version (ground truth):
private void registerEvents(){
  registerEvent(new com.Acrobot.ChestShop.Plugins.ChestShop());
  registerPreShopCreationEvents();
  registerPreTransactionEvents();
  registerPostShopCreationEvents();
  registerPostTransactionEvents();
  registerEvent(new SignBreak());
  registerEvent(new SignCreate());
  registerEvent(new ChestBreak());
  registerEvent(new BlockPlace());
  registerEvent(new PlayerConnect());
  registerEvent(new PlayerInteract());
  registerEvent(new PlayerInventory());
  registerEvent(new ItemInfoListener());
  registerEvent(new RestrictedSign());
  registerEvent(new ShopRefundListener());
  registerEvent(new ShortNameSaver());
}
Program: 178111
Project: 178111
Buggy source:
@EventHandler(priority=EventPriority.LOWEST) public static void onPreShopCreation(PreShopCreationEvent event){
  String line=event.getSignLine(PRICE_LINE).toUpperCase();
  String[] part=line.split("String_Node_Str");
  if (isPrice(part[0])) {
    line="String_Node_Str" + line;
  }
  if (part.length > 1 && isPrice(part[1])) {
    line+="String_Node_Str";
  }
  line=line.replace('b','B').replace('s','S');
  if (line.length() > 15) {
    line=line.replace("String_Node_Str","String_Node_Str");
  }
  if (line.length() > 15) {
    event.setOutcome(INVALID_PRICE);
    return;
  }
  event.setSignLine(PRICE_LINE,line);
  double buyPrice=PriceUtil.getBuyPrice(line);
  double sellPrice=PriceUtil.getSellPrice(line);
  if (buyPrice == 0 && sellPrice == 0) {
    event.setOutcome(INVALID_PRICE);
  }
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOWEST) public static void onPreShopCreation(PreShopCreationEvent event){
  String line=event.getSignLine(PRICE_LINE).toUpperCase();
  String[] part=line.split("String_Node_Str");
  if (isPrice(part[0])) {
    line="String_Node_Str" + line;
  }
  if (part.length > 1 && isPrice(part[1])) {
    line+="String_Node_Str";
  }
  line=line.replace('b','B').replace('s','S');
  if (line.length() > 15) {
    line=line.replace("String_Node_Str","String_Node_Str");
  }
  if (line.length() > 15) {
    event.setOutcome(INVALID_PRICE);
    return;
  }
  event.setSignLine(PRICE_LINE,line);
  if (!PriceUtil.hasBuyPrice(line) && !PriceUtil.hasSellPrice(line)) {
    event.setOutcome(INVALID_PRICE);
  }
}
Program: 178112
Project: 178112
Buggy source:
@EventHandler(priority=EventPriority.LOWEST) public static void onPreShopCreation(PreShopCreationEvent event){
  String itemCode=event.getSignLine(ITEM_LINE);
  ItemStack item=MaterialUtil.getItem(itemCode);
  if (item == null) {
    event.setOutcome(INVALID_ITEM);
    return;
  }
  if (Odd.getFromString(itemCode) != null) {
    return;
  }
  String metadata=getMetadata(itemCode);
  String longName=MaterialUtil.getName(item,LONG_NAME);
  if (longName.length() <= (MAXIMUM_SIGN_LETTERS - metadata.length())) {
    if (isStillValidItem(longName + metadata,item)) {
      String itemName=StringUtil.capitalizeFirstLetter(longName + metadata);
      event.setSignLine(ITEM_LINE,itemName);
      return;
    }
  }
  String code=MaterialUtil.getName(item,SHORT_NAME);
  String[] parts=itemCode.split("String_Node_Str",2);
  String data=(parts.length > 1 ? parts[1] : "String_Node_Str");
  if (!data.isEmpty() && code.length() >= (MAXIMUM_SIGN_LETTERS - 1 - data.length())) {
    code=code.substring(0,MAXIMUM_SIGN_LETTERS - 1 - data.length()) + data;
  }
  if (!isStillValidItem(code,item)) {
    code=String.valueOf(item.getTypeId()) + data;
  }
  code=StringUtil.capitalizeFirstLetter(code);
  event.setSignLine(ITEM_LINE,code);
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOWEST) public static void onPreShopCreation(PreShopCreationEvent event){
  String itemCode=event.getSignLine(ITEM_LINE);
  ItemStack item=MaterialUtil.getItem(itemCode);
  if (item == null) {
    event.setOutcome(INVALID_ITEM);
    return;
  }
  if (Odd.getFromString(itemCode) != null) {
    return;
  }
  String metadata=getMetadata(itemCode);
  String longName=MaterialUtil.getName(item);
  if (longName.length() <= (MAXIMUM_SIGN_LETTERS - metadata.length())) {
    if (isSameItem(longName + metadata,item)) {
      String itemName=StringUtil.capitalizeFirstLetter(longName + metadata);
      event.setSignLine(ITEM_LINE,itemName);
      return;
    }
  }
  String code=MaterialUtil.getName(item,SHORT_NAME);
  String[] parts=itemCode.split("String_Node_Str",2);
  String data=(parts.length > 1 ? parts[1] : "String_Node_Str");
  if (!data.isEmpty() && code.length() > (MAXIMUM_SIGN_LETTERS - data.length())) {
    code=code.substring(0,MAXIMUM_SIGN_LETTERS - data.length());
  }
  code+=data;
  if (!isSameItem(code,item)) {
    code=String.valueOf(item.getTypeId()) + data;
  }
  code=StringUtil.capitalizeFirstLetter(code);
  event.setSignLine(ITEM_LINE,code);
}
Program: 178113
Project: 178113
Buggy source:
/** 
 * Adds an item to the inventory (it currently uses a custom method of adding items, because Bukkit hasn't fixed it for 6 months now)
 * @param item      Item to add
 * @param inventory Inventory
 * @return Number of leftover items
 */
public static int add(ItemStack item,Inventory inventory){
  if (item.getAmount() < 1) {
    return 0;
  }
  int amountLeft=item.getAmount();
  int maxStackSize=item.getMaxStackSize();
  for (int currentSlot=0; currentSlot < inventory.getSize() && amountLeft > 0; currentSlot++) {
    ItemStack currentItem=inventory.getItem(currentSlot);
    ItemStack duplicate=item.clone();
    if (MaterialUtil.isEmpty(currentItem)) {
      duplicate.setAmount(Math.min(amountLeft,maxStackSize));
      duplicate.addEnchantments(item.getEnchantments());
      amountLeft-=duplicate.getAmount();
      inventory.setItem(currentSlot,duplicate);
    }
 else     if (currentItem.getAmount() < maxStackSize && MaterialUtil.equals(currentItem,item)) {
      int currentAmount=currentItem.getAmount();
      int neededToAdd=Math.min(maxStackSize - currentAmount,amountLeft);
      duplicate.setAmount(currentAmount + neededToAdd);
      duplicate.addEnchantments(item.getEnchantments());
      amountLeft-=duplicate.getAmount();
      inventory.setItem(currentSlot,duplicate);
    }
  }
  return amountLeft;
}

Fixed version (ground truth):
/** 
 * Adds an item to the inventory (it currently uses a custom method of adding items, because Bukkit hasn't fixed it for 6 months now)
 * @param item      Item to add
 * @param inventory Inventory
 * @return Number of leftover items
 */
public static int add(ItemStack item,Inventory inventory){
  if (item.getAmount() < 1) {
    return 0;
  }
  int amountLeft=item.getAmount();
  int maxStackSize=item.getMaxStackSize();
  for (int currentSlot=0; currentSlot < inventory.getSize() && amountLeft > 0; currentSlot++) {
    ItemStack currentItem=inventory.getItem(currentSlot);
    ItemStack duplicate=item.clone();
    if (MaterialUtil.isEmpty(currentItem)) {
      duplicate.setAmount(Math.min(amountLeft,maxStackSize));
      duplicate.addEnchantments(item.getEnchantments());
      amountLeft-=duplicate.getAmount();
      inventory.setItem(currentSlot,duplicate);
    }
 else     if (currentItem.getAmount() < maxStackSize && MaterialUtil.equals(currentItem,item)) {
      int currentAmount=currentItem.getAmount();
      int neededToAdd=Math.min(maxStackSize - currentAmount,amountLeft);
      duplicate.setAmount(currentAmount + neededToAdd);
      duplicate.addEnchantments(item.getEnchantments());
      amountLeft-=neededToAdd;
      inventory.setItem(currentSlot,duplicate);
    }
  }
  return amountLeft;
}
Program: 178114
Project: 178114
Buggy source:
private static boolean canDestroyShop(Player player,String name){
  return player == null || hasShopBreakingPermission(player) || canUseName(player,name);
}

Fixed version (ground truth):
private static boolean canDestroyShop(Player player,String name){
  return player != null && (hasShopBreakingPermission(player) || canUseName(player,name));
}
Program: 178115
Project: 178115
Buggy source:
/** 
 * Adds an item to the inventory (it currently uses a custom method of adding items, because Bukkit hasn't fixed it for 6 months now)
 * @param item      Item to add
 * @param inventory Inventory
 * @return Number of leftover items
 */
public static int add(ItemStack item,Inventory inventory){
  if (item.getAmount() < 1) {
    return 0;
  }
  int amountLeft=item.getAmount();
  int maxStackSize=item.getMaxStackSize();
  for (int currentSlot=0; currentSlot < inventory.getSize() && amountLeft > 0; currentSlot++) {
    ItemStack currentItem=inventory.getItem(currentSlot);
    ItemStack duplicate=item.clone();
    if (MaterialUtil.isEmpty(currentItem)) {
      duplicate.setAmount(Math.min(duplicate.getAmount(),maxStackSize));
      duplicate.addEnchantments(item.getEnchantments());
      amountLeft-=duplicate.getAmount();
      inventory.setItem(currentSlot,duplicate);
    }
 else     if (currentItem.getAmount() < maxStackSize && MaterialUtil.equals(currentItem,item)) {
      int currentAmount=currentItem.getAmount();
      int neededToAdd=Math.min(maxStackSize - currentAmount,amountLeft);
      duplicate.setAmount(currentAmount + neededToAdd);
      duplicate.addEnchantments(item.getEnchantments());
      amountLeft-=duplicate.getAmount();
      inventory.setItem(currentSlot,duplicate);
    }
  }
  return amountLeft;
}

Fixed version (ground truth):
/** 
 * Adds an item to the inventory (it currently uses a custom method of adding items, because Bukkit hasn't fixed it for 6 months now)
 * @param item      Item to add
 * @param inventory Inventory
 * @return Number of leftover items
 */
public static int add(ItemStack item,Inventory inventory){
  if (item.getAmount() < 1) {
    return 0;
  }
  int amountLeft=item.getAmount();
  int maxStackSize=item.getMaxStackSize();
  for (int currentSlot=0; currentSlot < inventory.getSize() && amountLeft > 0; currentSlot++) {
    ItemStack currentItem=inventory.getItem(currentSlot);
    ItemStack duplicate=item.clone();
    if (MaterialUtil.isEmpty(currentItem)) {
      duplicate.setAmount(Math.min(amountLeft,maxStackSize));
      duplicate.addEnchantments(item.getEnchantments());
      amountLeft-=duplicate.getAmount();
      inventory.setItem(currentSlot,duplicate);
    }
 else     if (currentItem.getAmount() < maxStackSize && MaterialUtil.equals(currentItem,item)) {
      int currentAmount=currentItem.getAmount();
      int neededToAdd=Math.min(maxStackSize - currentAmount,amountLeft);
      duplicate.setAmount(currentAmount + neededToAdd);
      duplicate.addEnchantments(item.getEnchantments());
      amountLeft-=duplicate.getAmount();
      inventory.setItem(currentSlot,duplicate);
    }
  }
  return amountLeft;
}
Program: 178116
Project: 178116
Buggy source:
@EventHandler public static void onInventoryOpen(InventoryOpenEvent event){
  if (event.getInventory().getType() != InventoryType.CHEST) {
    return;
  }
  if (!Config.getBoolean(TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY)) {
    return;
  }
  HumanEntity entity=event.getPlayer();
  if (!(entity instanceof Player) || (!(event.getInventory().getHolder() instanceof Chest) && !(event.getInventory().getHolder() instanceof DoubleChest))) {
    return;
  }
  Player player=(Player)entity;
  Block chest=((BlockState)event.getInventory().getHolder()).getBlock();
  if (!PlayerInteract.canOpenOtherShops(player) && !ChestShop.canAccess(player,chest)) {
    player.sendMessage(Config.getLocal(ACCESS_DENIED));
    event.setCancelled(true);
  }
}

Fixed version (ground truth):
@EventHandler public static void onInventoryOpen(InventoryOpenEvent event){
  if (event.getInventory().getType() != InventoryType.CHEST) {
    return;
  }
  if (!Properties.TURN_OFF_DEFAULT_PROTECTION_WHEN_PROTECTED_EXTERNALLY) {
    return;
  }
  HumanEntity entity=event.getPlayer();
  if (!(entity instanceof Player) || (!(event.getInventory().getHolder() instanceof Chest) && !(event.getInventory().getHolder() instanceof DoubleChest))) {
    return;
  }
  Player player=(Player)entity;
  Block chest;
  if (event.getInventory().getHolder() instanceof Chest) {
    chest=((BlockState)event.getInventory().getHolder()).getBlock();
  }
 else {
    chest=((DoubleChest)event.getInventory().getHolder()).getLocation().getBlock();
  }
  if (!PlayerInteract.canOpenOtherShops(player) && !ChestShop.canAccess(player,chest)) {
    player.sendMessage(Messages.prefix(Messages.ACCESS_DENIED));
    event.setCancelled(true);
  }
}
Program: 178117
Project: 178117
Buggy source:
/** 
 * Returns enchantments this itemName contains
 * @param base32 The encoded enchantment
 * @return Enchantments found
 */
public static Map<org.bukkit.enchantments.Enchantment,Integer> getEnchantments(String base32){
  if (base32 == null || base32.isEmpty()) {
    return new HashMap<org.bukkit.enchantments.Enchantment,Integer>();
  }
  Map<org.bukkit.enchantments.Enchantment,Integer> map=new HashMap<org.bukkit.enchantments.Enchantment,Integer>();
  StringBuilder number=new StringBuilder(Long.toString(Long.parseLong(base32,32)));
  while (number.length() % 3 != 0) {
    number.insert(0,'0');
  }
  for (int i=0; i < number.length() / 3; i++) {
    String item=number.substring(i * 3,i * 3 + 3);
    org.bukkit.enchantments.Enchantment enchantment=org.bukkit.enchantments.Enchantment.getById(Integer.parseInt(item.substring(0,2)));
    if (enchantment == null) {
      continue;
    }
    int level=Integer.parseInt(item.substring(2));
    if (level > enchantment.getMaxLevel() || level < enchantment.getStartLevel()) {
      continue;
    }
    map.put(enchantment,level);
  }
  return map;
}

Fixed version (ground truth):
/** 
 * Returns enchantments this itemName contains
 * @param base32 The encoded enchantment
 * @return Enchantments found
 */
public static Map<org.bukkit.enchantments.Enchantment,Integer> getEnchantments(String base32){
  if (base32 == null || base32.isEmpty() || !NumberUtil.isLong(base32)) {
    return new HashMap<org.bukkit.enchantments.Enchantment,Integer>();
  }
  Map<org.bukkit.enchantments.Enchantment,Integer> map=new HashMap<org.bukkit.enchantments.Enchantment,Integer>();
  StringBuilder number=new StringBuilder(Long.toString(Long.parseLong(base32,32)));
  while (number.length() % 3 != 0) {
    number.insert(0,'0');
  }
  for (int i=0; i < number.length() / 3; i++) {
    String item=number.substring(i * 3,i * 3 + 3);
    org.bukkit.enchantments.Enchantment enchantment=org.bukkit.enchantments.Enchantment.getById(Integer.parseInt(item.substring(0,2)));
    if (enchantment == null) {
      continue;
    }
    int level=Integer.parseInt(item.substring(2));
    if (level > enchantment.getMaxLevel() || level < enchantment.getStartLevel()) {
      continue;
    }
    map.put(enchantment,level);
  }
  return map;
}
Program: 178118
Project: 178118
Buggy source:
@EventHandler public static void onSellItemCheck(PreTransactionEvent event){
  if (event.isCancelled() || event.getTransactionType() != SELL) {
    return;
  }
  ItemStack[] stock=event.getStock();
  Inventory clientInventory=event.getClientInventory();
  if (!Economy.hasEnough(event.getOwner().getName(),event.getPrice())) {
    event.setCancelled(SHOP_DOES_NOT_HAVE_ENOUGH_MONEY);
    return;
  }
  if (!hasItems(clientInventory,stock)) {
    event.setCancelled(NOT_ENOUGH_STOCK_IN_INVENTORY);
  }
}

Fixed version (ground truth):
@EventHandler public static void onSellItemCheck(PreTransactionEvent event){
  if (event.isCancelled() || event.getTransactionType() != SELL) {
    return;
  }
  ItemStack[] stock=event.getStock();
  Inventory clientInventory=event.getClientInventory();
  if (isOwnerEconomicalyActive(event) && !Economy.hasEnough(event.getOwner().getName(),event.getPrice())) {
    event.setCancelled(SHOP_DOES_NOT_HAVE_ENOUGH_MONEY);
    return;
  }
  if (!hasItems(clientInventory,stock)) {
    event.setCancelled(NOT_ENOUGH_STOCK_IN_INVENTORY);
  }
}
Program: 178120
Project: 178120
Buggy source:
private Language sell(Player player){
  double price=getSellPrice(sign.getLine(PRICE_LINE));
  if (container == null) {
    return NO_CHEST_DETECTED;
  }
  if (price == PriceUtil.NO_PRICE) {
    return NO_SELLING_HERE;
  }
  if (!hasPermission(player,stock.getType(),false)) {
    return NO_PERMISSION;
  }
  String ownerAccount=getOwnerAccount();
  if (!Economy.hasEnough(ownerAccount,price)) {
    int possiblePartialItemCount=calculateItemAmount(Economy.balance(ownerAccount),price);
    if (!partialTransactionAllowed(possiblePartialItemCount)) {
      return NOT_ENOUGH_MONEY_SHOP;
    }
 else {
      price=(price / stock.getAmount()) * possiblePartialItemCount;
      stock.setAmount(possiblePartialItemCount);
    }
  }
  if (!playerHasEnoughItems(player)) {
    int possiblePartialItemCount=InventoryUtil.getAmount(stock,player.getInventory());
    if (!partialTransactionAllowed(possiblePartialItemCount)) {
      return NOT_ENOUGH_ITEMS_TO_SELL;
    }
 else {
      price=(price / stock.getAmount()) * possiblePartialItemCount;
      stock.setAmount(possiblePartialItemCount);
    }
  }
  if (!stockFitsChest()) {
    return NOT_ENOUGH_SPACE_IN_CHEST;
  }
  Economy.subtract(ownerAccount,price);
  Economy.add(player.getName(),price);
  container.addItem(stock);
  InventoryUtil.remove(stock,player.getInventory());
  player.updateInventory();
  TransactionEvent event=new TransactionEvent(SELL,container,sign,player,this.owner,stock,price);
  ChestShop.callEvent(event);
  return null;
}

Fixed version (ground truth):
private Language sell(Player player){
  double price=getSellPrice(sign.getLine(PRICE_LINE));
  if (container == null) {
    return NO_CHEST_DETECTED;
  }
  if (price == PriceUtil.NO_PRICE) {
    return NO_SELLING_HERE;
  }
  if (!hasPermission(player,stock.getType(),false)) {
    return NO_PERMISSION;
  }
  String ownerAccount=getOwnerAccount();
  if (!Economy.hasEnough(ownerAccount,price)) {
    int possiblePartialItemCount=calculateItemAmount(Economy.balance(ownerAccount),price);
    if (!partialTransactionAllowed(possiblePartialItemCount)) {
      return NOT_ENOUGH_MONEY_SHOP;
    }
 else {
      price=(price / stock.getAmount()) * possiblePartialItemCount;
      stock.setAmount(possiblePartialItemCount);
    }
  }
  if (!playerHasEnoughItems(player)) {
    int possiblePartialItemCount=InventoryUtil.getAmount(stock,player.getInventory());
    if (!partialTransactionAllowed(possiblePartialItemCount)) {
      return NOT_ENOUGH_ITEMS_TO_SELL;
    }
 else {
      price=(price / stock.getAmount()) * possiblePartialItemCount;
      stock.setAmount(possiblePartialItemCount);
    }
  }
  if (!stockFitsChest()) {
    return NOT_ENOUGH_SPACE_IN_CHEST;
  }
  Economy.subtract(ownerAccount,price);
  Economy.add(player.getName(),price);
  container.addItem(stock.clone());
  InventoryUtil.remove(stock.clone(),player.getInventory());
  player.updateInventory();
  TransactionEvent event=new TransactionEvent(SELL,container,sign,player,this.owner,stock,price);
  ChestShop.callEvent(event);
  return null;
}
Program: 178121
Project: 178121
Buggy source:
public Shop(Container container,ItemStack stock,Sign sign){
  this.container=container;
  this.owner=sign.getLine(NAME_LINE);
  this.stock=stock;
  this.sign=sign;
}

Fixed version (ground truth):
public Shop(Container container,ItemStack stock,Sign sign){
  this.container=container;
  this.sign=sign;
  this.owner=sign.getLine(NAME_LINE);
  this.stock=stock;
}
Program: 178122
Project: 178122
Buggy source:
public static void add(String name,double amount){
  if (!hasAccount(name)) {
    return;
  }
  String serverAccount=Config.getString(Property.SERVER_ECONOMY_ACCOUNT);
  Property taxAmount=name.equals(serverAccount) ? Property.SERVER_TAX_AMOUNT : Property.TAX_AMOUNT;
  if (Config.getFloat(taxAmount) != 0) {
    double tax=getTax(taxAmount,amount);
    if (!serverAccount.isEmpty()) {
      economy.add(serverAccount,tax);
    }
    amount-=tax;
  }
  economy.add(uName.getName(name),roundUp(amount));
}

Fixed version (ground truth):
public static void add(String name,double amount){
  Property taxAmount=isServerAccount(name) ? Property.SERVER_TAX_AMOUNT : Property.TAX_AMOUNT;
  double tax=getTax(taxAmount,amount);
  if (tax != 0) {
    if (!serverAccount().isEmpty()) {
      economy.add(serverAccount(),tax);
    }
    amount-=tax;
  }
  if (name.isEmpty())   return;
  economy.add(uName.getName(name),amount);
}
Program: 178123
Project: 178123
Buggy source:
public static boolean hasEnough(String name,double amount){
  if (!hasAccount(name)) {
    return true;
  }
  return economy.hasEnough(uName.getName(name),roundUp(amount));
}

Fixed version (ground truth):
public static boolean hasEnough(String name,double amount){
  if (isServerAccount(name)) {
    return true;
  }
  return economy.hasEnough(uName.getName(name),roundUp(amount));
}
Program: 178124
Project: 178124
Buggy source:
public static void subtract(String name,double amount){
  if (!hasAccount(name)) {
    return;
  }
  economy.subtract(uName.getName(name),roundUp(amount));
}

Fixed version (ground truth):
public static void subtract(String name,double amount){
  if (name.isEmpty())   return;
  economy.subtract(uName.getName(name),roundUp(amount));
}
Program: 178125
Project: 178125
Buggy source:
public static double getTax(Property tax,double price){
  return (Config.getFloat(tax) / 100F) * price;
}

Fixed version (ground truth):
public static double getTax(Property tax,double price){
  return roundDown((Config.getFloat(tax) / 100F) * price);
}
Program: 178126
Project: 178126
Buggy source:
/** 
 * Has the server owner denied plugin metrics?
 * @return
 */
public boolean isOptOut(){
synchronized (optOutLock) {
    try {
      configuration.load(CONFIG_FILE);
    }
 catch (    IOException ex) {
      Bukkit.getLogger().log(Level.INFO,"String_Node_Str",ex.getMessage());
      return true;
    }
catch (    InvalidConfigurationException ex) {
      Bukkit.getLogger().log(Level.INFO,"String_Node_Str",ex.getMessage());
      return true;
    }
    return configuration.getBoolean("String_Node_Str",false);
  }
}

Fixed version (ground truth):
/** 
 * Has the server owner denied plugin metrics?
 * @return
 */
public boolean isOptOut(){
synchronized (optOutLock) {
    try {
      configuration.load(CONFIG_FILE);
    }
 catch (    IOException ex) {
      Bukkit.getLogger().log(Level.INFO,"String_Node_Str" + ex.getMessage());
      return true;
    }
catch (    InvalidConfigurationException ex) {
      Bukkit.getLogger().log(Level.INFO,"String_Node_Str" + ex.getMessage());
      return true;
    }
    return configuration.getBoolean("String_Node_Str",false);
  }
}
Program: 178127
Project: 178127
Buggy source:
public static boolean cancellingBlockBreak(Block block,Player player){
  if (block == null)   return false;
  if (player != null && (Permission.has(player,Permission.ADMIN) || Permission.has(player,Permission.MOD)))   return false;
  if (uSign.isSign(block))   block.getState().update();
  if (restrictedSign(block))   return !restrictedSign.canDestroy(player,uBlock.findRestrictedSign(block));
  Sign sign=uBlock.findSign(block,(player != null ? uLongName.stripName(player.getName()) : null));
  if (!isCorrectSign(sign,block))   return false;
  if (playerIsNotOwner(player,sign))   return true;
  if (weShouldReturnMoney() && !Permission.has(player,Permission.NOFEE)) {
    float refundPrice=Config.getFloat(Property.SHOP_REFUND_PRICE);
    Economy.add(uLongName.getName(sign.getLine(0)),refundPrice);
    player.sendMessage(Config.getLocal(Language.SHOP_REFUNDED).replace("String_Node_Str",Economy.formatBalance(refundPrice)));
  }
  return false;
}

Fixed version (ground truth):
public static boolean cancellingBlockBreak(Block block,Player player){
  if (block == null)   return false;
  if (uSign.isSign(block))   block.getState().update();
  if (restrictedSign(block))   return !restrictedSign.canDestroy(player,uBlock.findRestrictedSign(block));
  Sign sign=uBlock.findSign(block,(player != null ? uLongName.stripName(player.getName()) : null));
  if (!isCorrectSign(sign,block))   return false;
  if (playerIsNotOwner(player,sign))   return !isAdmin(player);
  if (weShouldReturnMoney() && !Permission.has(player,Permission.NOFEE)) {
    float refundPrice=Config.getFloat(Property.SHOP_REFUND_PRICE);
    Economy.add(uLongName.getName(sign.getLine(0)),refundPrice);
    player.sendMessage(Config.getLocal(Language.SHOP_REFUNDED).replace("String_Node_Str",Economy.formatBalance(refundPrice)));
  }
  return false;
}
Program: 178128
Project: 178128
Buggy source:
public boolean protect(String name,Block block){
  if (lwc.findProtection(block) != null)   return false;
  Player player=ChestShop.getBukkitServer().getPlayer(name);
  if (player != null && limitsModule.hasReachedLimit(player,block))   return false;
  lwc.getPhysicalDatabase().registerProtection(block.getTypeId(),com.griefcraft.model.Protection.Type.PUBLIC,block.getWorld().getName(),name,"String_Node_Str",block.getX(),block.getY(),block.getZ());
  return true;
}

Fixed version (ground truth):
public boolean protect(String name,Block block){
  if (lwc.findProtection(block) != null)   return false;
  Player player=ChestShop.getBukkitServer().getPlayer(name);
  if (player != null && limitsModule.hasReachedLimit(player,block))   return false;
  lwc.getPhysicalDatabase().registerProtection(block.getTypeId(),com.griefcraft.model.Protection.Type.PRIVATE,block.getWorld().getName(),name,"String_Node_Str",block.getX(),block.getY(),block.getZ());
  return true;
}
Program: 178130
Project: 178130
Buggy source:
public boolean setMethod(Plugin method){
  PluginManager manager=method.getServer().getPluginManager();
  if (method != null && method.isEnabled()) {
    Method plugin=MethodFactory.createMethod(method);
    if (plugin != null)     Method=plugin;
  }
 else {
    for (    String name : MethodFactory.getDependencies()) {
      if (hasMethod())       break;
      method=manager.getPlugin(name);
      if (method == null)       continue;
      if (!method.isEnabled())       manager.enablePlugin(method);
      if (!method.isEnabled())       continue;
      Method plugin=MethodFactory.createMethod(method);
      if (plugin != null)       Method=plugin;
    }
  }
  return hasMethod();
}

Fixed version (ground truth):
public boolean setMethod(Plugin method){
  if (hasMethod())   return true;
  PluginManager manager=method.getServer().getPluginManager();
  Plugin plugin=null;
  for (  String name : this.getDependencies()) {
    if (hasMethod())     break;
    if (method.getDescription().getName().equals(name))     plugin=method;
 else     plugin=manager.getPlugin(name);
    if (plugin == null)     continue;
    if (!plugin.isEnabled())     continue;
    Method current=this.createMethod(plugin);
    if (current != null)     this.Method=current;
  }
  return hasMethod();
}
Program: 178131
Project: 178131
Buggy source:
public boolean hasMethod(){
  return (Method != null);
}

Fixed version (ground truth):
public boolean hasMethod(){
  return (this.Method != null);
}
Program: 178132
Project: 178132
Buggy source:
public double balance(){
  return (double)this.BOSEconomy.getBankMoney(name);
}

Fixed version (ground truth):
public double balance(){
  return Double.valueOf(this.BOSEconomy.getBankMoney(name));
}
Program: 178133
Project: 178133
Buggy source:
public boolean isCompatible(Plugin plugin){
  return plugin.getDescription().getName().equalsIgnoreCase("String_Node_Str") && plugin instanceof Essentials;
}

Fixed version (ground truth):
public boolean isCompatible(Plugin plugin){
  try {
    Class.forName("String_Node_Str");
  }
 catch (  Exception e) {
    return false;
  }
  return plugin.getDescription().getName().equalsIgnoreCase("String_Node_Str") && plugin instanceof Essentials;
}
Program: 178134
Project: 178134
Buggy source:
public boolean isCompatible(Plugin plugin){
  return plugin.getDescription().getName().equalsIgnoreCase("String_Node_Str") && plugin instanceof iConomy;
}

Fixed version (ground truth):
public boolean isCompatible(Plugin plugin){
  return plugin.getDescription().getName().equalsIgnoreCase("String_Node_Str") && !plugin.getClass().getName().equals("String_Node_Str") && plugin instanceof iConomy;
}
Program: 178135
Project: 178135
Buggy source:
public boolean isCompatible(Plugin plugin){
  return plugin.getDescription().getName().equalsIgnoreCase("String_Node_Str") && plugin instanceof iConomy;
}

Fixed version (ground truth):
public boolean isCompatible(Plugin plugin){
  return plugin.getDescription().getName().equalsIgnoreCase("String_Node_Str") && plugin.getClass().getName().equals("String_Node_Str") && plugin instanceof iConomy;
}
Program: 178136
Project: 178136
Buggy source:
public boolean hasBank(String bank){
  return (hasBanks()) && this.iConomy.Banks.exists(bank);
}

Fixed version (ground truth):
public boolean hasBank(String bank){
  return (!hasBanks()) ? false : this.iConomy.Banks.exists(bank);
}
Program: 178137
Project: 178137
Buggy source:
public boolean hasBankAccount(String bank,String name){
  return (!hasBank(bank)) && this.iConomy.getBank(name).hasAccount(name);
}

Fixed version (ground truth):
public boolean hasBankAccount(String bank,String name){
  return (hasBank(bank)) ? false : this.iConomy.getBank(name).hasAccount(name);
}
Program: 178138
Project: 178138
Buggy source:
private static boolean isCorrectSign(Sign sign,Block block){
  return sign != null && sign.getBlock() == block || getAttachedFace(sign) == block;
}

Fixed version (ground truth):
private static boolean isCorrectSign(Sign sign,Block block){
  return sign != null && (sign.getBlock() == block || getAttachedFace(sign) == block);
}
Program: 178139
Project: 178139
Buggy source:
public void onBlockPistonRetract(BlockPistonRetractEvent event){
  if (!uSign.isSign(event.getRetractLocation().getBlock()) && cancellingBlockBreak(event.getRetractLocation().getBlock(),null))   event.setCancelled(true);
}

Fixed version (ground truth):
public void onBlockPistonRetract(BlockPistonRetractEvent event){
  try {
    if (!uSign.isSign(event.getRetractLocation().getBlock()) && cancellingBlockBreak(event.getRetractLocation().getBlock(),null))     event.setCancelled(true);
  }
 catch (  Exception ignored) {
  }
}
Program: 178140
Project: 178140
Buggy source:
private static boolean isCorrectSign(Sign sign,Block block){
  return sign.getBlock() == block || getAttachedFace(sign) == block;
}

Fixed version (ground truth):
private static boolean isCorrectSign(Sign sign,Block block){
  return sign != null && sign.getBlock() == block || getAttachedFace(sign) == block;
}
Program: 178141
Project: 178141
Buggy source:
public static boolean cancellingBlockBreak(Block block,Player player){
  if (player != null && (Permission.has(player,Permission.ADMIN) || Permission.has(player,Permission.MOD)))   return false;
  if (uSign.isSign(block))   block.getState().update();
  Sign sign=uBlock.findRestrictedSign(block);
  if (sign != null && isCorrectSign(sign,block))   return true;
  sign=uBlock.findSign(block);
  return sign != null && (isCorrectSign(sign,block) && playerIsNotOwner(player,sign));
}

Fixed version (ground truth):
public static boolean cancellingBlockBreak(Block block,Player player){
  if (player != null && (Permission.has(player,Permission.ADMIN) || Permission.has(player,Permission.MOD)))   return false;
  if (uSign.isSign(block))   block.getState().update();
  Sign sign=uBlock.findRestrictedSign(block);
  if (isCorrectSign(sign,block))   return true;
  sign=uBlock.findSign(block);
  return isCorrectSign(sign,block) && playerIsNotOwner(player,sign);
}
Program: 178142
Project: 178142
Buggy source:
public void onPluginEnable(PluginEnableEvent event){
  LinkedList<String> toRemove=new LinkedList();
  if (!methods.hasMethod()) {
    if (methods.setMethod(event.getPlugin())) {
      Economy.economy=methods.getMethod();
      System.out.println("String_Node_Str" + Economy.economy.getName() + ' '+ Economy.economy.getVersion()+ "String_Node_Str");
    }
  }
  for (  String pluginName : pluginsToLoad) {
    Plugin plugin=ChestShop.getBukkitServer().getPluginManager().getPlugin(pluginName);
    if (plugin == null)     continue;
    initializePlugin(pluginName,plugin);
    toRemove.add(pluginName);
  }
  for (  String pluginName : toRemove)   pluginsToLoad.remove(pluginName);
}

Fixed version (ground truth):
public void onPluginEnable(PluginEnableEvent event){
  LinkedList<String> toRemove=new LinkedList();
  if (!methods.hasMethod()) {
    if (methods.setMethod(event.getPlugin())) {
      Economy.economy=methods.getMethod();
      System.out.println(lineStart + Economy.economy.getName() + ' '+ Economy.economy.getVersion()+ "String_Node_Str");
    }
  }
  for (  String pluginName : pluginsToLoad) {
    Plugin plugin=ChestShop.getBukkitServer().getPluginManager().getPlugin(pluginName);
    if (plugin == null)     continue;
    initializePlugin(pluginName,plugin);
    toRemove.add(pluginName);
  }
  for (  String pluginName : toRemove)   pluginsToLoad.remove(pluginName);
}
Program: 178144
Project: 178144
Buggy source:
/** 
 * Constructs a Huffman encoder based on the specified bit output stream.
 * @param in the bit output stream to write to
 * @throws NullPointerException if the output stream is {@code null}
 */
public HuffmanEncoder(BitOutputStream out){
  if (out == null)   throw new NullPointerException();
  output=out;
}

Fixed version (ground truth):
/** 
 * Constructs a Huffman encoder based on the specified bit output stream.
 * @param out the bit output stream to write to
 * @throws NullPointerException if the output stream is {@code null}
 */
public HuffmanEncoder(BitOutputStream out){
  if (out == null)   throw new NullPointerException();
  output=out;
}
Program: 178146
Project: 178146
Buggy source:
protected boolean hasTexture(String texture){
  return mc.o.k.e().a(texture) != null;
}

Fixed version (ground truth):
protected boolean hasTexture(String texture){
  ayj texturePacksManager=(ayj)getThroughReflection(avf.class,"String_Node_Str",mc.o);
  return texturePacksManager != null && texturePacksManager.e().a(texture) != null;
}
Program: 178148
Project: 178148
Buggy source:
public static void init() throws Exception {
  if (instance == null) {
    instance=getMinecraftInstance();
    obf=new InvTweaksObfuscation(instance);
    instance.t=new EntityRendererProxy_InvTweaks(instance);
    mod=new mod_InvTweaks();
    mod.load();
  }
}

Fixed version (ground truth):
public static void init() throws Exception {
  if (instance == null) {
    instance=getMinecraftInstance();
    obf=new InvTweaksObfuscation(instance);
    instance.t=new EntityRendererProxy_InvTweaks(instance);
    mod=new NoModLoader_InvTweaks();
    mod.load();
  }
}
Program: 178150
Project: 178150
Buggy source:
public void a(Minecraft minecraft,int i,int j){
  super.a(minecraft,i,j);
  if (!isEnabled2()) {
    return;
  }
  GL11.glBindTexture(3553,getTexture(minecraft,"String_Node_Str"));
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  int k=getHoverState(isMouseOverButton(i,j));
  drawTexturedModalRect(getXPosition(),getYPosition(),1,46 + k * 20 + 1,getWidth() / 2,getHeight() / 2);
  drawTexturedModalRect(getXPosition(),getYPosition() + getHeight() / 2,1,46 + k * 20 + 20 - getHeight() / 2 - 1,getWidth() / 2,getHeight() / 2);
  drawTexturedModalRect(getXPosition() + getWidth() / 2,getYPosition(),200 - getWidth() / 2 - 1,46 + k * 20 + 1,getWidth() / 2,getHeight() / 2);
  drawTexturedModalRect(getXPosition() + getWidth() / 2,getYPosition() + getHeight() / 2,200 - getWidth() / 2 - 1,46 + k * 20 + 19 - getHeight() / 2,getWidth() / 2,getHeight() / 2);
}

Fixed version (ground truth):
public void a(Minecraft minecraft,int i,int j){
  super.a(minecraft,i,j);
  if (!isEnabled2()) {
    return;
  }
  GL11.glColor4f(1.0F,1.0F,1.0F,1.0F);
  GL11.glBindTexture(3553,getTexture(minecraft,"String_Node_Str"));
  int k=getHoverState(isMouseOverButton(i,j));
  drawTexturedModalRect(getXPosition(),getYPosition(),1,46 + k * 20 + 1,getWidth() / 2,getHeight() / 2);
  drawTexturedModalRect(getXPosition(),getYPosition() + getHeight() / 2,1,46 + k * 20 + 20 - getHeight() / 2 - 1,getWidth() / 2,getHeight() / 2);
  drawTexturedModalRect(getXPosition() + getWidth() / 2,getYPosition(),200 - getWidth() / 2 - 1,46 + k * 20 + 1,getWidth() / 2,getHeight() / 2);
  drawTexturedModalRect(getXPosition() + getWidth() / 2,getYPosition() + getHeight() / 2,200 - getWidth() / 2 - 1,46 + k * 20 + 19 - getHeight() / 2,getWidth() / 2,getHeight() / 2);
}
Program: 178153
Project: 178153
Buggy source:
private void moveAll(InvTweaksContainerSection fromSection,InvTweaksContainerSection toSection,boolean separateStacks,boolean drop,aan stackToMatch) throws TimeoutException {
  int toIndex=getNextIndex(separateStacks,drop), newIndex;
  for (  yu slot : container.getSlots(fromSection)) {
    if (hasStack(slot) && (stackToMatch == null || areSameItemType(stackToMatch,getStack(slot)))) {
      int fromIndex=container.getSlotIndex(getSlotNumber(slot));
      while (hasStack(slot) && toIndex != -1 && !(fromSection == toSection && fromIndex == toIndex)) {
        container.move(fromSection,fromIndex,toSection,toIndex);
        newIndex=getNextIndex(separateStacks,drop);
        toIndex=(newIndex != toIndex) ? newIndex : -1;
      }
    }
    if (toIndex == -1) {
      break;
    }
  }
}

Fixed version (ground truth):
private void moveAll(InvTweaksContainerSection fromSection,InvTweaksContainerSection toSection,boolean separateStacks,boolean drop,aan stackToMatch) throws TimeoutException {
  int toIndex=getNextIndex(separateStacks,drop), newIndex;
  boolean success;
  for (  yu slot : container.getSlots(fromSection)) {
    if (hasStack(slot) && (stackToMatch == null || areSameItemType(stackToMatch,getStack(slot)))) {
      int fromIndex=container.getSlotIndex(getSlotNumber(slot));
      while (hasStack(slot) && toIndex != -1 && !(fromSection == toSection && fromIndex == toIndex)) {
        success=container.move(fromSection,fromIndex,toSection,toIndex);
        newIndex=getNextIndex(separateStacks,drop);
        toIndex=(success || newIndex != toIndex) ? newIndex : -1;
      }
    }
    if (toIndex == -1) {
      break;
    }
  }
}
Program: 178154
Project: 178154
Buggy source:
private int getFirstEmptyUsableSlotNumber(){
  for (  InvTweaksContainerSection section : slotRefs.keySet()) {
    for (    yp slot : slotRefs.get(section)) {
      if (isSlot(slot) && !hasStack(slot)) {
        return getSlotNumber(slot);
      }
    }
  }
  return -1;
}

Fixed version (ground truth):
private int getFirstEmptyUsableSlotNumber(){
  for (  InvTweaksContainerSection section : slotRefs.keySet()) {
    for (    yp slot : slotRefs.get(section)) {
      if (isBasicSlot(slot) && !hasStack(slot)) {
        return getSlotNumber(slot);
      }
    }
  }
  return -1;
}