nus-yam/ex-repair huggingface dataset:
Program: 51589
Project: 51589
Buggy source:
@Command(name="String_Node_Str",syntax="String_Node_Str",desc="String_Node_Str",usage="String_Node_Str",perm="String_Node_Str") public void traderWalletDeposit(CitizensTrader plugin,CommandSender sender,Trader npc,Map<String,String> args){
  Wallet wallet=npc.getWallet();
  double amount=Double.parseDouble(args.get("String_Node_Str"));
  if (CitizensTrader.getEconomy().depositPlayer(sender.getName(),amount).transactionSuccess()) {
    wallet.deposit(null,amount);
    locale.sendMessage(sender,"String_Node_Str","String_Node_Str",format.format(amount));
    locale.sendMessage(sender,"String_Node_Str","String_Node_Str",format.format(wallet.getMoney()));
  }
 else   locale.sendMessage(sender,"String_Node_Str");
}

Fixed version (ground truth):
@Command(name="String_Node_Str",syntax="String_Node_Str",desc="String_Node_Str",usage="String_Node_Str",perm="String_Node_Str") public void traderWalletDeposit(CitizensTrader plugin,CommandSender sender,Trader npc,Map<String,String> args){
  Wallet wallet=npc.getWallet();
  double amount=Double.parseDouble(args.get("String_Node_Str"));
  if (CitizensTrader.getEconomy().withdrawPlayer(sender.getName(),amount).transactionSuccess()) {
    wallet.deposit(null,amount);
    locale.sendMessage(sender,"String_Node_Str","String_Node_Str",format.format(amount));
    locale.sendMessage(sender,"String_Node_Str","String_Node_Str",format.format(wallet.getMoney()));
  }
 else   locale.sendMessage(sender,"String_Node_Str");
}
Program: 51590
Project: 51590
Buggy source:
public boolean withdraw(String p,double m){
switch (type) {
case OWNER:
    return economy.withdrawPlayer(p,m).transactionSuccess();
case BANK:
  return economy.bankWithdraw(bank,m).transactionSuccess();
case NPC:
if (money >= m) money-=m;
return money >= m;
default :
return true;
}
}

Fixed version (ground truth):
public boolean withdraw(String p,double m){
switch (type) {
case OWNER:
    return economy.withdrawPlayer(p,m).transactionSuccess();
case BANK:
  return economy.bankWithdraw(bank,m).transactionSuccess();
case NPC:
if (money >= m) {
  money-=m;
  return true;
}
return false;
default :
return true;
}
}
Program: 51591
Project: 51591
Buggy source:
public static void removeDescriptions(Inventory inventory){
  int s=0;
  for (  ItemStack item : inventory.getContents()) {
    if (item != null) {
      NBTTagEditor.removeDescription(item);
      inventory.setItem(s,new ItemStack(cleanItem(item)));
    }
    ++s;
  }
}

Fixed version (ground truth):
public static void removeDescriptions(Inventory inventory){
  int s=0;
  for (  ItemStack item : inventory.getContents()) {
    if (item != null) {
      NBTTagEditor.removeDescription(item,"String_Node_Str");
      inventory.setItem(s,new ItemStack(cleanItem(item)));
    }
    ++s;
  }
}
Program: 51592
Project: 51592
Buggy source:
public static void removeDescription(ItemStack item){
  if (!item.hasItemMeta())   return;
  ItemMeta meta=item.getItemMeta();
  if (!meta.hasLore())   return;
  List<String> list=meta.getLore();
  List<String> lore=CitizensTrader.getLocaleManager().lore("String_Node_Str");
  if (list.size() >= lore.size()) {
    Iterator<String> it=list.iterator();
    while (it.hasNext()) {
      String line=it.next();
      for (int j=0; j < lore.size(); ++j) {
        String m=lore.get(j);
        m=m.replace("String_Node_Str","String_Node_Str");
        m=m.replace("String_Node_Str","String_Node_Str");
        m=m.replace("String_Node_Str","String_Node_Str");
        if (Pattern.matches(m,line)) {
          it.remove();
          j=lore.size();
        }
      }
    }
  }
  if (list.isEmpty())   meta.setLore(null);
 else   meta.setLore(list);
  item.setItemMeta(meta);
}

Fixed version (ground truth):
public static void removeDescription(ItemStack item,String toRem){
  if (!item.hasItemMeta())   return;
  ItemMeta meta=item.getItemMeta();
  if (!meta.hasLore())   return;
  List<String> list=meta.getLore();
  List<String> lore=CitizensTrader.getLocaleManager().lore(toRem);
  if (list.size() >= lore.size()) {
    Iterator<String> it=list.iterator();
    while (it.hasNext()) {
      String line=it.next();
      for (int j=0; j < lore.size(); ++j) {
        String m=lore.get(j);
        m=m.replace("String_Node_Str","String_Node_Str");
        m=m.replace("String_Node_Str","String_Node_Str");
        m=m.replace("String_Node_Str","String_Node_Str");
        if (Pattern.matches(m,line)) {
          it.remove();
          j=lore.size();
        }
      }
    }
  }
  if (list.isEmpty())   meta.setLore(null);
 else   meta.setLore(list);
  item.setItemMeta(meta);
}
Program: 51595
Project: 51595
Buggy source:
public void setItemPriceLore(ItemStack is){
  NBTTagEditor.removeDescription(is);
  StockItem it=this.getStock().getItem(is,TraderStatus.BUY,true,false);
  if (it != null) {
    int scale=is.getAmount() / it.getAmount();
    DecimalFormat f=new DecimalFormat("String_Node_Str");
    List<String> lore=new ArrayList<String>();
    ;
    for (    String l : CitizensTrader.getLocaleManager().lore("String_Node_Str"))     lore.add(l.replace("String_Node_Str",f.format(getPrice(player,"String_Node_Str")) + "String_Node_Str").replace("String_Node_Str",f.format(getPrice(player,"String_Node_Str") * scale) + "String_Node_Str"));
    if (scale > 0)     NBTTagEditor.addDescription(is,lore);
  }
}

Fixed version (ground truth):
public void setItemPriceLore(ItemStack is){
  NBTTagEditor.removeDescription(is,"String_Node_Str");
  StockItem it=this.getStock().getItem(is,TraderStatus.BUY,true,false);
  if (it != null) {
    int scale=is.getAmount() / it.getAmount();
    DecimalFormat f=new DecimalFormat("String_Node_Str");
    List<String> lore=new ArrayList<String>();
    ;
    for (    String l : CitizensTrader.getLocaleManager().lore("String_Node_Str"))     lore.add(l.replace("String_Node_Str",f.format(getPrice(player,"String_Node_Str")) + "String_Node_Str").replace("String_Node_Str",f.format(getPrice(player,"String_Node_Str") * scale) + "String_Node_Str"));
    if (scale > 0)     NBTTagEditor.addDescription(is,lore);
  }
}
Program: 51597
Project: 51597
Buggy source:
public void loadDescriptions(Player player,Inventory inventory){
  DecimalFormat f=new DecimalFormat("String_Node_Str");
  for (int i=0; i < inventory.getSize(); ++i) {
    ItemStack item=inventory.getItem(i);
    if (item != null) {
      StockItem stockItem=this.getStock().getItem(item,TraderStatus.BUY,true,false);
      if (stockItem != null) {
        int scale=item.getAmount() / stockItem.getAmount();
        List<String> lore=new ArrayList<String>();
        ;
        for (        String l : itemsConfig.getPriceLore("String_Node_Str"))         lore.add(l.replace("String_Node_Str",f.format(getPrice(player,"String_Node_Str",0)) + "String_Node_Str").replace("String_Node_Str",f.format(getPrice(player,"String_Node_Str",0) * scale) + "String_Node_Str"));
        if (scale > 0)         NBTTagEditor.addDescription(item,lore);
      }
    }
  }
}

Fixed version (ground truth):
public void loadDescriptions(Player player,Inventory inventory){
  DecimalFormat f=new DecimalFormat("String_Node_Str");
  for (int i=0; i < inventory.getSize(); ++i) {
    ItemStack item=inventory.getItem(i);
    if (item != null) {
      StockItem stockItem=this.getStock().getItem(item,TraderStatus.BUY,true,false);
      if (stockItem != null) {
        int scale=item.getAmount() / stockItem.getAmount();
        List<String> lore=new ArrayList<String>();
        ;
        for (        String l : itemsConfig.getPriceLore("String_Node_Str"))         lore.add(l.replace("String_Node_Str",f.format(getPrice(player,"String_Node_Str",stockItem,0)) + "String_Node_Str").replace("String_Node_Str",f.format(getPrice(player,"String_Node_Str",stockItem,0) * scale) + "String_Node_Str"));
        if (scale > 0)         NBTTagEditor.addDescription(item,lore);
      }
    }
  }
}
Program: 51598
Project: 51598
Buggy source:
public double getPrice(Player player,String transaction,int slot){
  if (getStock().getPattern() != null)   return getStock().getPattern().getItemPrice(player,getSelectedItem(),transaction,slot,0.0);
  return getSelectedItem().getPrice(slot);
}

Fixed version (ground truth):
public double getPrice(Player player,String transaction,StockItem item,int slot){
  if (getStock().getPattern() != null)   return getStock().getPattern().getItemPrice(player,item,transaction,slot,0.0);
  return item.getPrice(slot);
}
Program: 51602
Project: 51602
Buggy source:
public final Trader selectItem(ItemStack item,TraderStatus status,boolean dura,boolean amount){
  selectedItem=traderStock.getItem(item,status,dura,amount);
  return this;
}

Fixed version (ground truth):
public final Trader selectItem(ItemStack item,TraderStatus status,boolean amount){
  selectedItem=traderStock.getItem(item,status,StockItem.hasDurability(item),amount);
  return this;
}
Program: 51603
Project: 51603
Buggy source:
@Override public void run(){
  if (playerInteraction.get(player.getName()) == null)   NBTTagEditor.removeDescriptions(event.getPlayer().getInventory());
}

Fixed version (ground truth):
@Override public void run(){
  tempOpening.remove(player.getName());
}
Program: 51607
Project: 51607
Buggy source:
public void setInventoryWith(Inventory inventory,StockItem item,Player player){
  int i=0;
  for (  Integer amount : item.getAmounts()) {
    ItemStack chk=setLore(item.getItemStack(),getPriceLore(item,i,"String_Node_Str",pattern,player));
    chk.addEnchantments(item.getItemStack().getEnchantments());
    chk.setAmount(amount);
    if (item.getLimitSystem().checkLimit("String_Node_Str",i))     inventory.setItem(i++,chk);
  }
  inventory.setItem(stockSize - 1,itemsConfig.getItemManagement(7));
}

Fixed version (ground truth):
public void setInventoryWith(Inventory inventory,StockItem item,Player player){
  int i=0;
  for (  Integer amount : item.getAmounts()) {
    ItemStack chk=setLore(item.getItemStack(),getPriceLore(item,i,"String_Node_Str",pattern,player));
    chk.setAmount(amount);
    if (item.getLimitSystem().checkLimit("String_Node_Str",i))     inventory.setItem(i++,chk);
  }
  inventory.setItem(stockSize - 1,itemsConfig.getItemManagement(7));
}
Program: 51608
Project: 51608
Buggy source:
public static ItemStack setLore(ItemStack cis,List<String> lore){
  ItemMeta meta=Bukkit.getItemFactory().getItemMeta(cis.getType());
  List<String> list=new ArrayList<String>();
  for (  String s : lore)   list.add(s.replace('^','�'));
  meta.setLore(list);
  meta.setDisplayName(NBTTagEditor.getName(cis));
  Map<String,Object> map=cis.serialize();
  map.put("String_Node_Str",meta);
  cis.setItemMeta(ItemStack.deserialize(map).getItemMeta());
  return ItemStack.deserialize(map);
}

Fixed version (ground truth):
public static ItemStack setLore(ItemStack cis,List<String> lore){
  ItemMeta meta=Bukkit.getItemFactory().getItemMeta(cis.getType());
  List<String> list=cis.getItemMeta().getLore();
  if (list == null)   list=new ArrayList<String>();
  for (  String s : lore)   list.add(s.replace('^','�'));
  meta.setLore(list);
  meta.setDisplayName(NBTTagEditor.getName(cis));
  for (  Map.Entry<Enchantment,Integer> e : cis.getEnchantments().entrySet())   meta.addEnchant(e.getKey(),e.getValue(),true);
  if (cis.getType().equals(Material.ENCHANTED_BOOK)) {
    for (    Map.Entry<Enchantment,Integer> e : ((EnchantmentStorageMeta)cis.getItemMeta()).getStoredEnchants().entrySet())     ((EnchantmentStorageMeta)meta).addStoredEnchant(e.getKey(),e.getValue(),true);
  }
  Map<String,Object> map=cis.serialize();
  map.put("String_Node_Str",meta);
  return ItemStack.deserialize(map);
}
Program: 51609
Project: 51609
Buggy source:
public Inventory inventoryView(Inventory inventory,TraderStatus s,Player player,String type){
  if (!s.isManaging()) {
    for (    StockItem item : stock.get(s.toString())) {
      ItemStack chk=setLore(item.getItemStack(),getPriceLore(item,0,s.toString(),pattern,player));
      chk.addEnchantments(item.getItemStack().getEnchantments());
      if (item.getSlot() < 0)       item.setSlot(inventory.firstEmpty());
      inventory.setItem(item.getSlot(),chk);
    }
    if (!stock.get(opositeStock(s.toString())).isEmpty())     inventory.setItem(stockSize - 1,itemsConfig.getItemManagement(opositeStock(s.toString())));
  }
 else {
    for (    StockItem item : stock.get(s.toString())) {
      ItemStack chk=setLore(item.getItemStack(),getLore(type,item,s.toString(),pattern,player));
      chk.addEnchantments(item.getItemStack().getEnchantments());
      if (item.getSlot() < 0)       item.setSlot(inventory.firstEmpty());
      inventory.setItem(item.getSlot(),chk);
    }
    inventory.setItem(stockSize - 3,itemsConfig.getItemManagement(4));
    inventory.setItem(stockSize - 2,itemsConfig.getItemManagement(2));
    inventory.setItem(stockSize - 1,itemsConfig.getItemManagement(opositeStock(s.toString())));
  }
  return inventory;
}

Fixed version (ground truth):
public Inventory inventoryView(Inventory inventory,TraderStatus s,Player player,String type){
  if (!s.isManaging()) {
    for (    StockItem item : stock.get(s.toString())) {
      ItemStack chk=setLore(item.getItemStack(),getPriceLore(item,0,s.toString(),pattern,player));
      if (item.getSlot() < 0)       item.setSlot(inventory.firstEmpty());
      inventory.setItem(item.getSlot(),chk);
    }
    if (!stock.get(opositeStock(s.toString())).isEmpty())     inventory.setItem(stockSize - 1,itemsConfig.getItemManagement(opositeStock(s.toString())));
  }
 else {
    for (    StockItem item : stock.get(s.toString())) {
      ItemStack chk=setLore(item.getItemStack(),getLore(type,item,s.toString(),pattern,player));
      if (item.getSlot() < 0)       item.setSlot(inventory.firstEmpty());
      inventory.setItem(item.getSlot(),chk);
    }
    inventory.setItem(stockSize - 3,itemsConfig.getItemManagement(4));
    inventory.setItem(stockSize - 2,itemsConfig.getItemManagement(2));
    inventory.setItem(stockSize - 1,itemsConfig.getItemManagement(opositeStock(s.toString())));
  }
  return inventory;
}
Program: 51610
Project: 51610
Buggy source:
@Override public Inventory getInventory(){
  Inventory inventory=Bukkit.createInventory(this,stockSize,name);
  for (  StockItem item : stock.get("String_Node_Str")) {
    ItemStack chk=setLore(item.getItemStack(),getPriceLore(item,0,"String_Node_Str",pattern,null));
    chk.addEnchantments(item.getItemStack().getEnchantments());
    if (item.getSlot() < 0)     item.setSlot(inventory.firstEmpty());
    inventory.setItem(item.getSlot(),chk);
  }
  if (!stock.get("String_Node_Str").isEmpty())   inventory.setItem(stockSize - 1,itemsConfig.getItemManagement("String_Node_Str"));
  return inventory;
}

Fixed version (ground truth):
@Override public Inventory getInventory(){
  Inventory inventory=Bukkit.createInventory(this,stockSize,name);
  for (  StockItem item : stock.get("String_Node_Str")) {
    ItemStack chk=setLore(item.getItemStack(),getPriceLore(item,0,"String_Node_Str",pattern,null));
    if (item.getSlot() < 0)     item.setSlot(inventory.firstEmpty());
    inventory.setItem(item.getSlot(),chk);
  }
  if (!stock.get("String_Node_Str").isEmpty())   inventory.setItem(stockSize - 1,itemsConfig.getItemManagement("String_Node_Str"));
  return inventory;
}
Program: 51611
Project: 51611
Buggy source:
public static StockItem toStockItem(ItemStack is){
  String itemInfo=is.getTypeId() + "String_Node_Str" + is.getData().getData()+ "String_Node_Str"+ is.getAmount()+ "String_Node_Str"+ is.getDurability();
  if (!is.getEnchantments().isEmpty()) {
    itemInfo+="String_Node_Str";
    for (    Enchantment ench : is.getEnchantments().keySet())     itemInfo+=ench.getId() + "String_Node_Str" + is.getEnchantmentLevel(ench)+ "String_Node_Str";
  }
  String name=NBTTagEditor.getName(is).replace("String_Node_Str","String_Node_Str");
  if (!name.isEmpty())   itemInfo+="String_Node_Str" + NBTTagEditor.getName(is).replace("String_Node_Str","String_Node_Str");
  return new StockItem(itemInfo);
}

Fixed version (ground truth):
public static StockItem toStockItem(ItemStack is){
  String itemInfo=is.getTypeId() + "String_Node_Str" + is.getData().getData()+ "String_Node_Str"+ is.getAmount()+ "String_Node_Str"+ is.getDurability();
  if (!is.getEnchantments().isEmpty()) {
    itemInfo+="String_Node_Str";
    for (    Enchantment ench : is.getEnchantments().keySet())     itemInfo+=ench.getId() + "String_Node_Str" + is.getEnchantmentLevel(ench)+ "String_Node_Str";
  }
  if (is.getType().equals(Material.ENCHANTED_BOOK)) {
    EnchantmentStorageMeta meta=(EnchantmentStorageMeta)is.getItemMeta();
    if (!meta.getStoredEnchants().isEmpty()) {
      itemInfo+="String_Node_Str";
      for (      Map.Entry<Enchantment,Integer> e : meta.getStoredEnchants().entrySet())       itemInfo+=e.getKey().getId() + "String_Node_Str" + e.getValue()+ "String_Node_Str";
    }
  }
  String name=NBTTagEditor.getName(is).replace("String_Node_Str","String_Node_Str");
  if (!name.isEmpty())   itemInfo+="String_Node_Str" + NBTTagEditor.getName(is).replace("String_Node_Str","String_Node_Str");
  return new StockItem(itemInfo);
}
Program: 51612
Project: 51612
Buggy source:
public static void setName(ItemStack item,String name){
  ItemMeta meta=Bukkit.getItemFactory().getItemMeta(item.getType());
  meta.setDisplayName(name);
  Map<String,Object> map=item.serialize();
  map.put("String_Node_Str",meta);
  item.setItemMeta(ItemStack.deserialize(map).getItemMeta());
}

Fixed version (ground truth):
public static void setName(ItemStack item,String name){
  ItemMeta oldMeta=item.getItemMeta();
  ItemMeta meta=Bukkit.getItemFactory().getItemMeta(item.getType());
  meta.setDisplayName(name);
  if (oldMeta != null) {
    meta.setLore(oldMeta.getLore());
    for (    Map.Entry<Enchantment,Integer> e : oldMeta.getEnchants().entrySet())     meta.addEnchant(e.getKey(),e.getValue(),true);
  }
  Map<String,Object> map=item.serialize();
  map.put("String_Node_Str",meta);
  item.setItemMeta(ItemStack.deserialize(map).getItemMeta());
}
Program: 51613
Project: 51613
Buggy source:
public static void removeDescriptions(Inventory inventory){
  for (  ItemStack item : inventory.getContents()) {
    if (item != null) {
      int size=0;
      List<String> lore=CitizensTrader.getInstance().getItemConfig().getPriceLore("String_Node_Str");
      if (lore != null) {
        size=lore.size();
        Map<String,Object> map=item.serialize();
        ItemMeta meta=(ItemMeta)map.get("String_Node_Str");
        if (meta != null) {
          List<String> list=null;
          if (meta.getLore() != null && meta.getLore().size() >= size) {
            list=new ArrayList<String>(meta.getLore());
            int s=list.size();
            for (int i=0; i + (s - size) < s; ++i) {
              String m=lore.get((size - 1) - i);
              m=m.replace("String_Node_Str","String_Node_Str");
              m=m.replace("String_Node_Str","String_Node_Str");
              m=m.replace("String_Node_Str","String_Node_Str");
              if (Pattern.matches(m,list.get((s - 1) - i)))               list.remove((s - 1) - i);
            }
          }
          meta.setLore(list);
        }
        map.remove("String_Node_Str");
        if (meta != null)         map.put("String_Node_Str",meta);
        item.setItemMeta(ItemStack.deserialize(map).getItemMeta());
      }
    }
  }
}

Fixed version (ground truth):
public static void removeDescriptions(Inventory inventory){
  int s=0;
  for (  ItemStack item : inventory.getContents()) {
    if (item != null) {
      int size=0;
      List<String> lore=CitizensTrader.getInstance().getItemConfig().getPriceLore("String_Node_Str");
      if (lore != null) {
        size=lore.size();
        Map<String,Object> map=item.serialize();
        ItemMeta meta=(ItemMeta)map.get("String_Node_Str");
        if (meta != null) {
          List<String> list=null;
          if (meta.getLore() != null && meta.getLore().size() > size) {
            list=new ArrayList<String>(meta.getLore());
            int listSize=list.size();
            int removed=0;
            for (int i=0; i < listSize; ++i) {
              for (int j=0; j < size; ++j) {
                String m=lore.get(j);
                m=m.replace("String_Node_Str","String_Node_Str");
                m=m.replace("String_Node_Str","String_Node_Str");
                m=m.replace("String_Node_Str","String_Node_Str");
                if (Pattern.matches(m,list.get(i - removed))) {
                  list.remove(i - removed);
                  ++removed;
                }
              }
            }
          }
          if (list != null && list.isEmpty())           meta.setLore(null);
 else           meta.setLore(list);
        }
        map.remove("String_Node_Str");
        if (meta != null)         map.put("String_Node_Str",meta);
 else         map.put("String_Node_Str",Bukkit.getItemFactory().getItemMeta(item.getType()));
        item.setItemMeta(ItemStack.deserialize(map).getItemMeta());
        inventory.setItem(s,new ItemStack(item));
      }
    }
    ++s;
  }
}
Program: 51615
Project: 51615
Buggy source:
public double getItemPrice(Player player,StockItem item,String transation,int slot,double nprice){
  double price=nprice;
  if (item.isPatternListening()) {
    if (patternPrices.containsKey(transation))     if (patternPrices.get(transation).containsKey(item.getIdAndData()))     price=patternPrices.get(transation).get(item.getIdAndData());
 else     for (    Map.Entry<String,Double> entry : patternPrices.get(transation).entrySet())     if (item.getIdAndData().split("String_Node_Str")[0].equals(entry.getKey()))     price=entry.getValue();
    for (    Map.Entry<String,TransactionPattern> tier : patternTiers.entrySet())     if (CitizensTrader.getPermissionsManager().has(player,"String_Node_Str" + tier.getKey())) {
      price=tier.getValue().getItemPrice(player,item,transation,slot,price);
    }
  }
 else   price=item.getRawPrice();
  if (!item.hasStackPrice() && nprice == 0.0)   price*=item.getAmount(slot);
  price*=multiplier.get(transation);
  return price;
}

Fixed version (ground truth):
public double getItemPrice(Player player,StockItem item,String transation,int slot,double nprice){
  double price=nprice;
  double m=multiplier.get(transation);
  if (item.isPatternListening()) {
    if (patternPrices.containsKey(transation))     if (patternPrices.get(transation).containsKey(item.getIdAndData()))     price=patternPrices.get(transation).get(item.getIdAndData());
 else     for (    Map.Entry<String,Double> entry : patternPrices.get(transation).entrySet())     if (item.getIdAndData().split("String_Node_Str")[0].equals(entry.getKey()))     price=entry.getValue();
    for (    Map.Entry<String,TransactionPattern> tier : patternTiers.entrySet())     if (CitizensTrader.getPermissionsManager().has(player,"String_Node_Str" + tier.getKey())) {
      price=tier.getValue().getItemPrice(player,item,transation,slot,price);
      m=tier.getValue().getMultiplier(transation);
    }
    if (!tier)     price*=m;
  }
 else   price=item.getRawPrice();
  if (!item.hasStackPrice() && nprice == 0.0 && !tier)   price*=item.getAmount(slot);
  return price;
}
Program: 51616
Project: 51616
Buggy source:
public TransactionPattern(String name){
  this.name=name;
  patternItems=new HashMap<String,List<StockItem>>();
  patternPrices=new HashMap<String,HashMap<String,Double>>();
  patternTiers=new TreeMap<String,TransactionPattern>();
  multiplier=new HashMap<String,Double>();
  multiplier.put("String_Node_Str",1.00);
  multiplier.put("String_Node_Str",1.00);
}

Fixed version (ground truth):
public TransactionPattern(String name,boolean tier){
  this.tier=tier;
  this.name=name;
  patternItems=new HashMap<String,List<StockItem>>();
  patternPrices=new HashMap<String,HashMap<String,Double>>();
  patternTiers=new TreeMap<String,TransactionPattern>();
  multiplier=new HashMap<String,Double>();
  multiplier.put("String_Node_Str",1.00);
  multiplier.put("String_Node_Str",1.00);
}
Program: 51617
Project: 51617
Buggy source:
public static StockItem toStockItem(ItemStack is){
  String itemInfo=is.getTypeId() + "String_Node_Str" + is.getData().getData()+ "String_Node_Str"+ is.getAmount()+ "String_Node_Str"+ is.getDurability();
  if (!is.getEnchantments().isEmpty()) {
    itemInfo+="String_Node_Str";
    for (    Enchantment ench : is.getEnchantments().keySet())     itemInfo+=ench.getId() + "String_Node_Str" + is.getEnchantmentLevel(ench)+ "String_Node_Str";
  }
  if (is.getType().equals(Material.ENCHANTED_BOOK)) {
    EnchantmentStorageMeta meta=(EnchantmentStorageMeta)is.getItemMeta();
    if (!meta.getStoredEnchants().isEmpty()) {
      itemInfo+="String_Node_Str";
      for (      Map.Entry<Enchantment,Integer> e : meta.getStoredEnchants().entrySet())       itemInfo+=e.getKey().getId() + "String_Node_Str" + e.getValue()+ "String_Node_Str";
    }
  }
  String name=NBTTagEditor.getName(is).replace("String_Node_Str","String_Node_Str");
  if (!name.isEmpty())   itemInfo+="String_Node_Str" + NBTTagEditor.getName(is).replace("String_Node_Str","String_Node_Str");
  return new StockItem(itemInfo);
}

Fixed version (ground truth):
public static StockItem toStockItem(ItemStack is){
  String itemInfo=is.getTypeId() + "String_Node_Str" + is.getData().getData()+ "String_Node_Str"+ is.getAmount()+ "String_Node_Str"+ is.getDurability();
  if (!is.getEnchantments().isEmpty()) {
    itemInfo+="String_Node_Str";
    for (    Map.Entry<Enchantment,Integer> ench : is.getItemMeta().getEnchants().entrySet())     itemInfo+=ench.getKey().getId() + "String_Node_Str" + ench.getValue()+ "String_Node_Str";
  }
  if (is.getType().equals(Material.ENCHANTED_BOOK)) {
    EnchantmentStorageMeta meta=(EnchantmentStorageMeta)is.getItemMeta();
    if (!meta.getStoredEnchants().isEmpty()) {
      itemInfo+="String_Node_Str";
      for (      Map.Entry<Enchantment,Integer> e : meta.getStoredEnchants().entrySet())       itemInfo+=e.getKey().getId() + "String_Node_Str" + e.getValue()+ "String_Node_Str";
    }
  }
  String name=NBTTagEditor.getName(is).replace("String_Node_Str","String_Node_Str");
  if (!name.isEmpty())   itemInfo+="String_Node_Str" + name;
  return new StockItem(itemInfo);
}
Program: 51619
Project: 51619
Buggy source:
public static void removeDescriptions(Inventory inventory){
  for (  ItemStack item : inventory.getContents()) {
    if (item != null) {
      net.minecraft.server.ItemStack c=((CraftItemStack)item).getHandle();
      NBTTagCompound tc=c.getTag();
      if (tc != null) {
        if (tc.hasKey("String_Node_Str")) {
          NBTTagCompound d=tc.getCompound("String_Node_Str");
          if (d != null) {
            if (d.hasKey("String_Node_Str")) {
              NBTTagList oldList=d.getList("String_Node_Str");
              NBTTagList newList=new NBTTagList();
              for (int j=0; j < oldList.size(); ++j)               if (!oldList.get(j).getName().equals("String_Node_Str") && !oldList.get(j).getName().isEmpty())               newList.add(oldList.get(j));
              d.set("String_Node_Str",newList);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
public static void removeDescriptions(Inventory inventory){
  for (  ItemStack item : inventory.getContents()) {
    if (item != null) {
      net.minecraft.server.ItemStack c=((CraftItemStack)item).getHandle();
      NBTTagCompound tc=c.getTag();
      if (tc != null) {
        if (tc.hasKey("String_Node_Str")) {
          NBTTagCompound d=tc.getCompound("String_Node_Str");
          if (d != null) {
            if (d.hasKey("String_Node_Str")) {
              NBTTagList oldList=d.getList("String_Node_Str");
              NBTTagList newList=new NBTTagList();
              for (int j=0; j < oldList.size(); ++j)               if (!oldList.get(j).getName().equals("String_Node_Str") && !oldList.get(j).getName().isEmpty())               newList.add(oldList.get(j));
              if (newList.size() == 0)               c.setTag(null);
              d.set("String_Node_Str",newList);
            }
          }
        }
      }
    }
  }
}
Program: 51620
Project: 51620
Buggy source:
public double getItemPrice(Player player,StockItem item,String transation,int slot,double nprice){
  double price=nprice;
  if (item.isPatternListening()) {
    if (patternPrices.containsKey(transation))     if (patternPrices.get(transation).containsKey(item.getIdAndData()))     price=patternPrices.get(transation).get(item.getIdAndData());
 else     for (    Map.Entry<String,Double> entry : patternPrices.get(transation).entrySet())     if (item.getIdAndData().split("String_Node_Str")[0].equals(entry.getKey()))     price=entry.getValue();
    for (    Map.Entry<String,TransactionPattern> tier : patternTiers.entrySet())     if (CitizensTrader.getPermissionsManager().has(player,"String_Node_Str" + tier.getKey())) {
      price=tier.getValue().getItemPrice(player,item,transation,slot,price);
    }
  }
 else   price=item.getRawPrice();
  if (!item.hasStackPrice() && nprice == 0.0)   price*=item.getAmount(slot);
  price*=multiplier.get(transation);
  return price;
}

Fixed version (ground truth):
public double getItemPrice(Player player,StockItem item,String transation,int slot,double nprice){
  double price=nprice;
  System.out.print(price);
  if (item.isPatternListening()) {
    System.out.print(price);
    if (patternPrices.containsKey(transation))     if (patternPrices.get(transation).containsKey(item.getIdAndData()))     price=patternPrices.get(transation).get(item.getIdAndData());
 else     for (    Map.Entry<String,Double> entry : patternPrices.get(transation).entrySet())     if (item.getIdAndData().split("String_Node_Str")[0].equals(entry.getKey()))     price=entry.getValue();
    System.out.print(price);
    for (    Map.Entry<String,TransactionPattern> tier : patternTiers.entrySet())     if (CitizensTrader.getPermissionsManager().has(player,"String_Node_Str" + tier.getKey())) {
      price=tier.getValue().getItemPrice(player,item,transation,slot,price);
    }
  }
 else   price=item.getRawPrice();
  System.out.print(price);
  if (!item.hasStackPrice() && nprice == 0.0)   price*=item.getAmount(slot);
  System.out.print(price);
  price*=multiplier.get(transation);
  System.out.print(price);
  return price;
}
Program: 51621
Project: 51621
Buggy source:
@Override public boolean onRightClick(Player player,TraderCharacterTrait trait,NPC npc){
  if (player.getGameMode().equals(GameMode.CREATIVE) && !permissionsManager.has(player,"String_Node_Str")) {
    player.sendMessage(localeManager.getLocaleString("String_Node_Str"));
    return false;
  }
  if (player.getItemInHand().getTypeId() == itemsConfig.getManageWand().getTypeId()) {
    if (!permissionsManager.has(player,"String_Node_Str") && !player.isOp()) {
      if (!permissionsManager.has(player,"String_Node_Str")) {
        player.sendMessage(localeManager.getLocaleString("String_Node_Str","String_Node_Str","String_Node_Str"));
        return false;
      }
      if (!trait.getConfig().getOwner().equals(player.getName())) {
        player.sendMessage(localeManager.getLocaleString("String_Node_Str","String_Node_Str","String_Node_Str"));
        return false;
      }
    }
    if (getTraderStatus().isManaging()) {
      switchInventory(getStartStatus(player));
      player.sendMessage(ChatColor.AQUA + npc.getFullName() + ChatColor.RED+ "String_Node_Str");
      return true;
    }
    player.sendMessage(ChatColor.AQUA + npc.getFullName() + ChatColor.RED+ "String_Node_Str");
    switchInventory(getManageStartStatus(player));
    return true;
  }
  player.openInventory(getInventory());
  return true;
}

Fixed version (ground truth):
@Override public boolean onRightClick(Player player,TraderCharacterTrait trait,NPC npc){
  if (player.getGameMode().equals(GameMode.CREATIVE) && !permissionsManager.has(player,"String_Node_Str")) {
    player.sendMessage(localeManager.getLocaleString("String_Node_Str"));
    return false;
  }
  if (player.getItemInHand().getTypeId() == itemsConfig.getManageWand().getTypeId()) {
    if (!permissionsManager.has(player,"String_Node_Str") && !player.isOp()) {
      if (!permissionsManager.has(player,"String_Node_Str")) {
        player.sendMessage(localeManager.getLocaleString("String_Node_Str","String_Node_Str","String_Node_Str"));
        return false;
      }
      if (!trait.getConfig().getOwner().equals(player.getName())) {
        player.sendMessage(localeManager.getLocaleString("String_Node_Str","String_Node_Str","String_Node_Str"));
        return false;
      }
    }
    if (getTraderStatus().isManaging()) {
      switchInventory(getStartStatus(player));
      player.sendMessage(ChatColor.AQUA + npc.getFullName() + ChatColor.RED+ "String_Node_Str");
      return true;
    }
    player.sendMessage(ChatColor.AQUA + npc.getFullName() + ChatColor.RED+ "String_Node_Str");
    switchInventory(getManageStartStatus(player));
    return true;
  }
  NBTTagEditor.removeDescriptions(player.getInventory());
  if (!getTraderStatus().isManaging())   loadDescriptions(player.getInventory());
  player.openInventory(getInventory());
  return true;
}
Program: 51625
Project: 51625
Buggy source:
public boolean sellTransaction(double price,ItemStack item){
  return traderConfig.sellTransaction(player.getName(),price * ((int)item.getAmount() / selectedItem.getAmount()));
}

Fixed version (ground truth):
public boolean sellTransaction(double price,ItemStack item){
  return traderConfig.sellTransaction(player.getName(),price);
}
Program: 51626
Project: 51626
Buggy source:
@Override public void load(DataKey data) throws NPCLoadException {
  String type=data.getString("String_Node_Str","String_Node_Str");
  if (type.equals("String_Node_Str")) {
    this.type=EcoNpcType.getTypeByName(data.getString("String_Node_Str"));
    if (config == null) {
      config=new TraderConfigPart();
      stock=new TraderStockPart(getNPC().getFullName() + "String_Node_Str");
    }
    config.load(data);
    stock.load(data);
    if (this.type.equals(EcoNpcType.MARKET_TRADER))     stock.linkItems();
  }
 else   if (type.equals("String_Node_Str")) {
    this.type=EcoNpcType.getTypeByName(data.getString("String_Node_Str"));
    if (banker == null)     banker=new BankerPart();
    banker.load(data);
  }
 else {
    this.type=EcoNpcType.getTypeByName(data.getString("String_Node_Str",data.getString("String_Node_Str")));
    if (config == null) {
      config=new TraderConfigPart();
      stock=new TraderStockPart(getNPC().getFullName() + "String_Node_Str");
    }
    config.load(data);
    stock.load(data);
    if (this.type.equals(EcoNpcType.MARKET_TRADER))     stock.linkItems();
  }
}

Fixed version (ground truth):
@Override public void load(DataKey data) throws NPCLoadException {
  String type=data.getString("String_Node_Str","String_Node_Str");
  if (type.equals("String_Node_Str")) {
    this.type=EcoNpcType.getTypeByName(data.getString("String_Node_Str"));
    if (config == null) {
      config=new TraderConfigPart();
      stock=new TraderStockPart(getNPC().getFullName() + "String_Node_Str");
    }
    config.load(data);
    stock.load(data);
    if (CitizensTrader.dtlWalletsEnabled())     config.loadDtlWallet(npc);
    if (this.type.equals(EcoNpcType.MARKET_TRADER))     stock.linkItems();
  }
 else   if (type.equals("String_Node_Str")) {
    this.type=EcoNpcType.getTypeByName(data.getString("String_Node_Str"));
    if (banker == null)     banker=new BankerPart();
    if (CitizensTrader.dtlWalletsEnabled())     banker.loadDtlWallet(npc);
    banker.load(data);
  }
 else {
    this.type=EcoNpcType.getTypeByName(data.getString("String_Node_Str",data.getString("String_Node_Str")));
    if (config == null) {
      config=new TraderConfigPart();
      stock=new TraderStockPart(getNPC().getFullName() + "String_Node_Str");
    }
    config.load(data);
    stock.load(data);
    if (this.type.equals(EcoNpcType.MARKET_TRADER))     stock.linkItems();
  }
}
Program: 51627
Project: 51627
Buggy source:
public boolean buyTransaction(String player,double price){
  boolean success=CitizensTrader.getEconomy().withdrawPlayer(player,price).transactionSuccess();
  if (success)   wallet.deposit(owner,price);
  return success;
}

Fixed version (ground truth):
public boolean buyTransaction(String player,double price){
  boolean success=CitizensTrader.getEconomy().withdrawPlayer(player,price).transactionSuccess();
  if (success)   deposit(owner,price);
  return success;
}
Program: 51629
Project: 51629
Buggy source:
public boolean sellTransaction(String player,double price){
  boolean success=wallet.withdraw(owner,price);
  if (success)   CitizensTrader.getEconomy().depositPlayer(player,price);
  return success;
}

Fixed version (ground truth):
public boolean sellTransaction(String player,double price){
  boolean success=withdraw(owner,price);
  if (success)   CitizensTrader.getEconomy().depositPlayer(player,price);
  return success;
}
Program: 51630
Project: 51630
Buggy source:
public void save(DataKey data){
  if (!CitizensTrader.dtlWalletsEnabled()) {
    data.setString("String_Node_Str",wallet.getType().toString());
    if (!wallet.getTown().isEmpty())     data.setString("String_Node_Str",wallet.getTown());
    if (!wallet.getClan().isEmpty())     data.setString("String_Node_Str",wallet.getClan());
    if (!wallet.getFaction().isEmpty())     data.setString("String_Node_Str",wallet.getFaction());
    if (!wallet.getBank().isEmpty())     data.setString("String_Node_Str",wallet.getBank());
    if (wallet.getMoney() != 0.0)     data.setDouble("String_Node_Str",wallet.getMoney());
  }
  data.setString("String_Node_Str",owner);
  data.setBoolean("String_Node_Str",enabled);
}

Fixed version (ground truth):
public void save(DataKey data){
  data.setString("String_Node_Str",wallet.getType().toString());
  if (!wallet.getTown().isEmpty())   data.setString("String_Node_Str",wallet.getTown());
  if (!wallet.getClan().isEmpty())   data.setString("String_Node_Str",wallet.getClan());
  if (!wallet.getFaction().isEmpty())   data.setString("String_Node_Str",wallet.getFaction());
  if (!wallet.getBank().isEmpty())   data.setString("String_Node_Str",wallet.getBank());
  if (wallet.getMoney() != 0.0)   data.setDouble("String_Node_Str",wallet.getMoney());
  data.setString("String_Node_Str",owner);
  data.setBoolean("String_Node_Str",enabled);
}
Program: 51633
Project: 51633
Buggy source:
public double getItemPrice(Player player,StockItem item,String transation,int slot,double nprice){
  double price=nprice;
  if (item.isPatternListening()) {
    if (patternPrices.containsKey(transation))     if (patternPrices.get(transation).containsKey(item.getIdAndData()))     price=patternPrices.get(transation).get(item.getIdAndData());
 else     for (    Map.Entry<String,Double> entry : patternPrices.get(transation).entrySet())     if (item.getIdAndData().split("String_Node_Str")[0].equals(entry.getKey()))     price=entry.getValue();
    for (    Map.Entry<String,TransactionPattern> tier : patternTiers.entrySet())     if (CitizensTrader.getPermissionsManager().has(player,"String_Node_Str" + tier.getKey())) {
      price=tier.getValue().getItemPrice(player,item,transation,slot,price);
    }
  }
 else   price=item.getRawPrice();
  System.out.print(slot + "String_Node_Str" + nprice);
  if (!item.hasStackPrice() && nprice == 0.0)   price*=item.getAmount(slot);
  price*=multiplier.get(transation);
  return price;
}

Fixed version (ground truth):
public double getItemPrice(Player player,StockItem item,String transation,int slot,double nprice){
  double price=nprice;
  if (item.isPatternListening()) {
    if (patternPrices.containsKey(transation))     if (patternPrices.get(transation).containsKey(item.getIdAndData()))     price=patternPrices.get(transation).get(item.getIdAndData());
 else     for (    Map.Entry<String,Double> entry : patternPrices.get(transation).entrySet())     if (item.getIdAndData().split("String_Node_Str")[0].equals(entry.getKey()))     price=entry.getValue();
    for (    Map.Entry<String,TransactionPattern> tier : patternTiers.entrySet())     if (CitizensTrader.getPermissionsManager().has(player,"String_Node_Str" + tier.getKey())) {
      price=tier.getValue().getItemPrice(player,item,transation,slot,price);
    }
  }
 else   price=item.getRawPrice();
  if (!item.hasStackPrice() && nprice == 0.0)   price*=item.getAmount(slot);
  price*=multiplier.get(transation);
  return price;
}
Program: 51634
Project: 51634
Buggy source:
public void save(DataKey data){
  if (!pattern.getName().isEmpty())   data.setString("String_Node_Str",pattern.getName());
  List<String> sellList=new ArrayList<String>();
  for (  StockItem item : stock.get("String_Node_Str"))   if (!item.isPatternItem())   sellList.add(item.toString());
  List<String> buyList=new ArrayList<String>();
  for (  StockItem item : stock.get("String_Node_Str")) {
    if (!item.isPatternItem())     buyList.add(item.toString());
  }
  data.setRaw("String_Node_Str",sellList);
  data.setRaw("String_Node_Str",buyList);
}

Fixed version (ground truth):
public void save(DataKey data){
  if (pattern != null)   if (!pattern.getName().isEmpty())   data.setString("String_Node_Str",pattern.getName());
  List<String> sellList=new ArrayList<String>();
  for (  StockItem item : stock.get("String_Node_Str"))   if (!item.isPatternItem())   sellList.add(item.toString());
  List<String> buyList=new ArrayList<String>();
  for (  StockItem item : stock.get("String_Node_Str")) {
    if (!item.isPatternItem())     buyList.add(item.toString());
  }
  data.setRaw("String_Node_Str",sellList);
  data.setRaw("String_Node_Str",buyList);
}
Program: 51636
Project: 51636
Buggy source:
public static ItemStack addDescription(ItemStack item,List<String> lore){
  ItemMeta meta=Bukkit.getItemFactory().getItemMeta(item.getType());
  List<String> list=new ArrayList<String>();
  for (  String s : lore)   list.add(s.replace('^','�'));
  meta.setLore(list);
  Map<String,Object> map=item.serialize();
  map.put("String_Node_Str",meta);
  item.setItemMeta(ItemStack.deserialize(map).getItemMeta());
  return ItemStack.deserialize(map);
}

Fixed version (ground truth):
public static ItemStack addDescription(ItemStack item,List<String> lore){
  ItemMeta meta=Bukkit.getItemFactory().getItemMeta(item.getType());
  List<String> list=new ArrayList<String>();
  for (  String s : lore)   list.add(s.replace('^','�'));
  meta.setLore(list);
  meta.setDisplayName(item.getItemMeta().getDisplayName());
  Map<String,Object> map=item.serialize();
  map.put("String_Node_Str",meta);
  item.setItemMeta(ItemStack.deserialize(map).getItemMeta());
  return ItemStack.deserialize(map);
}
Program: 51637
Project: 51637
Buggy source:
public static String getName(ItemStack item){
  String name="String_Node_Str";
  if (item.hasItemMeta())   name=item.getItemMeta().getDisplayName();
  return name;
}

Fixed version (ground truth):
public static String getName(ItemStack item){
  String name="String_Node_Str";
  if (item.hasItemMeta())   name=item.getItemMeta().getDisplayName();
  return name == null ? "String_Node_Str" : name;
}
Program: 51638
Project: 51638
Buggy source:
public static void removeDescriptions(Inventory inventory){
  for (  ItemStack item : inventory.getContents()) {
    if (item != null) {
      int size=0;
      List<String> lore=CitizensTrader.getInstance().getItemConfig().getPriceLore("String_Node_Str");
      if (lore != null) {
        size=lore.size();
        Map<String,Object> map=item.serialize();
        ItemMeta meta=(ItemMeta)map.get("String_Node_Str");
        if (meta != null) {
          List<String> list=null;
          if (meta.getLore() != null && meta.getLore().size() >= size) {
            list=new ArrayList<String>(meta.getLore());
            int s=list.size();
            for (int i=0; i + (s - size) < s; ++i) {
              String m=lore.get((size - 1) - i);
              m=m.replace("String_Node_Str","String_Node_Str");
              m=m.replace("String_Node_Str","String_Node_Str");
              m=m.replace("String_Node_Str","String_Node_Str");
              if (Pattern.matches(m,list.get((s - 1) - i)))               list.remove((s - 1) - i);
            }
          }
          meta.setLore(list);
        }
        map.remove("String_Node_Str");
        if (meta != null && meta.hasLore())         map.put("String_Node_Str",meta);
        item.setItemMeta(ItemStack.deserialize(map).getItemMeta());
      }
    }
  }
}

Fixed version (ground truth):
public static void removeDescriptions(Inventory inventory){
  for (  ItemStack item : inventory.getContents()) {
    if (item != null) {
      int size=0;
      List<String> lore=CitizensTrader.getInstance().getItemConfig().getPriceLore("String_Node_Str");
      if (lore != null) {
        size=lore.size();
        Map<String,Object> map=item.serialize();
        ItemMeta meta=(ItemMeta)map.get("String_Node_Str");
        if (meta != null) {
          List<String> list=null;
          if (meta.getLore() != null && meta.getLore().size() >= size) {
            list=new ArrayList<String>(meta.getLore());
            int s=list.size();
            for (int i=0; i + (s - size) < s; ++i) {
              String m=lore.get((size - 1) - i);
              m=m.replace("String_Node_Str","String_Node_Str");
              m=m.replace("String_Node_Str","String_Node_Str");
              m=m.replace("String_Node_Str","String_Node_Str");
              if (Pattern.matches(m,list.get((s - 1) - i)))               list.remove((s - 1) - i);
            }
          }
          meta.setLore(list);
        }
        map.remove("String_Node_Str");
        if (meta != null)         map.put("String_Node_Str",meta);
        item.setItemMeta(ItemStack.deserialize(map).getItemMeta());
      }
    }
  }
}
Program: 51639
Project: 51639
Buggy source:
public static void removeDescription(ItemStack item){
  if (item.hasItemMeta()) {
    ItemMeta meta=item.getItemMeta();
    if (meta.hasLore()) {
      meta.setLore(null);
    }
  }
}

Fixed version (ground truth):
public static void removeDescription(ItemStack item){
  Map<String,Object> map=item.serialize();
  if (map.containsKey("String_Node_Str")) {
    ItemMeta meta=(ItemMeta)map.get("String_Node_Str");
    meta.setLore(null);
    item.setItemMeta(ItemStack.deserialize(map).getItemMeta());
  }
}
Program: 51640
Project: 51640
Buggy source:
@Deprecated public void setEconomy(Economy e){
  economy=e;
}

Fixed version (ground truth):
@Deprecated public void setEconomy(Economy e){
}
Program: 51641
Project: 51641
Buggy source:
public static WalletType getTypeByName(String n){
  if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.OWNER;
  if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.OWNER;
 else   if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.NPC;
 else   if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.NPC;
 else   if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.BANK;
 else   if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.INFINITE;
 else   if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.INFINITE;
 else   if (n.startsWith("String_Node_Str"))   return WalletType.SIMPLE_CLANS;
 else   if (n.startsWith("String_Node_Str"))   return WalletType.TOWNY;
 else   if (n.startsWith("String_Node_Str"))   return WalletType.FACTIONS;
  return null;
}

Fixed version (ground truth):
public static WalletType getTypeByName(String n){
  if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.OWNER;
  if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.OWNER;
 else   if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.NPC;
 else   if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.NPC;
 else   if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.BANK;
 else   if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.INFINITE;
 else   if (n.equalsIgnoreCase("String_Node_Str"))   return WalletType.INFINITE;
 else   if (n.startsWith("String_Node_Str"))   return WalletType.SIMPLE_CLANS;
 else   if (n.startsWith("String_Node_Str"))   return WalletType.SIMPLE_CLANS;
 else   if (n.startsWith("String_Node_Str"))   return WalletType.TOWNY;
 else   if (n.startsWith("String_Node_Str"))   return WalletType.FACTIONS;
 else   if (n.startsWith("String_Node_Str"))   return WalletType.FACTIONS;
  return null;
}