nus-yam/ex-repair huggingface dataset:
Program: 178031
Project: 178031
Buggy source:
/** 
 * @deprecated use the setSRS. <br>This method will be set as protected in the next release
 * @param minx
 * @param maxy
 * @param maxx
 * @param miny
 * @param crs
 */
public void addLatLonBoundingBox(double minx,double maxy,double maxx,double miny,final String crs){
  add(LATLONBBMINX,String.valueOf(minx));
  add(LATLONBBMAXY,String.valueOf(maxy));
  add(LATLONBBMAXX,String.valueOf(maxx));
  add(LATLONBBMINY,String.valueOf(miny));
  add(LATLONBBCRS,crs);
}

Fixed version (ground truth):
/** 
 * @deprecated use the setSRS. <br>This method will be set as protected in the next release
 * @param minx
 * @param maxy
 * @param maxx
 * @param miny
 * @param crs
 */
public void addLatLonBoundingBox(double minx,double miny,double maxx,double maxy,final String crs){
  add(LATLONBBMINX,String.valueOf(minx));
  add(LATLONBBMINY,String.valueOf(miny));
  add(LATLONBBMAXY,String.valueOf(maxy));
  add(LATLONBBMAXX,String.valueOf(maxx));
  add(LATLONBBCRS,crs);
}
Program: 178032
Project: 178032
Buggy source:
public void setNativeBoundingBox(double minx,double maxy,double maxx,double miny,final String crs){
  set(NATIVEBBMINX,String.valueOf(minx));
  set(NATIVEBBMAXY,String.valueOf(maxy));
  set(NATIVEBBMAXX,String.valueOf(maxx));
  set(NATIVEBBMINY,String.valueOf(miny));
  set(NATIVEBBCRS,crs);
}

Fixed version (ground truth):
public void setNativeBoundingBox(double minx,double miny,double maxx,double maxy,final String crs){
  set(NATIVEBBMINX,String.valueOf(minx));
  set(NATIVEBBMAXY,String.valueOf(maxy));
  set(NATIVEBBMAXX,String.valueOf(maxx));
  set(NATIVEBBMINY,String.valueOf(miny));
  set(NATIVEBBCRS,crs);
}
Program: 178033
Project: 178033
Buggy source:
/** 
 * @deprecated use the setSRS. <br>This method will be set as protected in the next release
 * @param minx
 * @param maxy
 * @param maxx
 * @param miny
 * @param crs
 */
public void addNativeBoundingBox(double minx,double maxy,double maxx,double miny,final String crs){
  add(NATIVEBBMINX,String.valueOf(minx));
  add(NATIVEBBMAXY,String.valueOf(maxy));
  add(NATIVEBBMAXX,String.valueOf(maxx));
  add(NATIVEBBMINY,String.valueOf(miny));
  add(NATIVEBBCRS,crs);
}

Fixed version (ground truth):
/** 
 * @deprecated use the setSRS. <br>This method will be set as protected in the next release
 * @param minx
 * @param maxy
 * @param maxx
 * @param miny
 * @param crs
 */
public void addNativeBoundingBox(double minx,double miny,double maxx,double maxy,final String crs){
  add(NATIVEBBMINX,String.valueOf(minx));
  add(NATIVEBBMAXY,String.valueOf(maxy));
  add(NATIVEBBMAXX,String.valueOf(maxx));
  add(NATIVEBBMINY,String.valueOf(miny));
  add(NATIVEBBCRS,crs);
}
Program: 178034
Project: 178034
Buggy source:
/** 
 * @deprecated will be set to protected in the next release
 * @param val
 */
public void addFilter(final String val){
  final Element param=new Element(ENTRY);
  param.addContent(new Element(STRING).setText(filter));
  param.addContent(new Element(STRING).setText(val));
  parameters.add(null,param);
}

Fixed version (ground truth):
/** 
 * @deprecated will be set to protected in the next release
 * @param val
 */
public void addFilter(final String val){
  final List<Element> list=new ArrayList<Element>(2);
  list.add(new Element(STRING).setText(filter));
  list.add(new Element(STRING).setText(val));
  parameters.add(null,list);
}
Program: 178035
Project: 178035
Buggy source:
/** 
 * Publish a Mosaic from a filesystem currently readable by GeoServer. <P> Sample cUrl usage:<BR> <> <TT>curl -u admin:geoserver -XPUT -H 'Content-type: text' -d "file:$ABSPORTDIR" http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$BAREDIR/external.imagemosaic </TT>
 * @param workspace an existing workspace
 * @param storeName the name of the coverageStore to be created
 * @param mosaicDir the directory where the raster images are located
 * @param configure a specify if a coverage should be configured
 * @return true if the operation completed successfully.
 * @throws FileNotFoundException
 */
public RESTCoverageStore createExternaMosaicDatastore(String workspace,String storeName,File mosaicDir,ParameterConfigure configure,ParameterUpdate update) throws FileNotFoundException {
  if (!mosaicDir.isDirectory()) {
    throw new IllegalArgumentException("String_Node_Str" + mosaicDir + "String_Node_Str");
  }
  String sUrl=restURL + "String_Node_Str" + workspace+ "String_Node_Str"+ storeName+ "String_Node_Str"+ configure.toString()+ "String_Node_Str"+ update.toString();
  String sendResult=HTTPUtils.put(sUrl,mosaicDir.toURI().toString(),"String_Node_Str",gsuser,gspass);
  return RESTCoverageStore.build(sendResult);
}

Fixed version (ground truth):
/** 
 * Publish a Mosaic from a filesystem currently readable by GeoServer. <P> Sample cUrl usage:<BR> <> <TT>curl -u admin:geoserver -XPUT -H 'Content-type: text' -d "file:$ABSPORTDIR" http://$GSIP:$GSPORT/$SERVLET/rest/workspaces/$WORKSPACE/coveragestores/$BAREDIR/external.imagemosaic </TT>
 * @param workspace an existing workspace
 * @param storeName the name of the coverageStore to be created
 * @param mosaicDir the directory where the raster images are located
 * @param configure a specify if a coverage should be configured
 * @return true if the operation completed successfully.
 * @throws FileNotFoundException
 */
public RESTCoverageStore createExternaMosaicDatastore(String workspace,String storeName,File mosaicDir,ParameterConfigure configure,ParameterUpdate update) throws FileNotFoundException {
  if (!mosaicDir.isDirectory()) {
    if (LOGGER.isEnabledFor(Level.WARN))     LOGGER.warn("String_Node_Str" + mosaicDir + "String_Node_Str");
  }
  String sUrl=restURL + "String_Node_Str" + workspace+ "String_Node_Str"+ storeName+ "String_Node_Str"+ configure.toString()+ "String_Node_Str"+ update.toString();
  String sendResult=HTTPUtils.put(sUrl,mosaicDir.toURI().toString(),"String_Node_Str",gsuser,gspass);
  return RESTCoverageStore.build(sendResult);
}
Program: 178036
Project: 178036
Buggy source:
/** 
 * Returns item's name, with a maximum length
 * @param itemStack ItemStack to name
 * @param maxLength The max length that the name should have; 0 or below if it should be unlimited
 * @return ItemStack's name
 */
public static String getName(ItemStack itemStack,int maxLength){
  String alias=Odd.getAlias(itemStack);
  String itemName=alias != null ? alias : itemStack.getType().toString();
  String data=DataValue.name(itemStack);
  String durability="String_Node_Str";
  if (data == null) {
    if (itemStack.getDurability() != 0) {
      durability="String_Node_Str" + itemStack.getDurability();
    }
  }
  data=data != null ? data + "String_Node_Str" : "String_Node_Str";
  String metaData="String_Node_Str";
  if (itemStack.hasItemMeta()) {
    metaData="String_Node_Str" + Metadata.getItemCode(itemStack);
  }
  String code=data + itemName + durability+ metaData;
  if (maxLength > 0 && code.length() > maxLength) {
    int exceeding=code.length() - maxLength;
    code=data + getShortenedName(itemName,itemName.length() - exceeding) + durability+ metaData;
  }
  code=StringUtil.capitalizeFirstLetter(code,'_');
  ItemStack codeItem=getItem(code);
  if (!equals(itemStack,codeItem)) {
    throw new IllegalArgumentException("String_Node_Str" + itemStack + "String_Node_Str"+ maxLength+ "String_Node_Str"+ code);
  }
  return code;
}

Fixed version (ground truth):
/** 
 * Returns item's name, with a maximum length
 * @param itemStack ItemStack to name
 * @param maxLength The max length that the name should have; 0 or below if it should be unlimited
 * @return ItemStack's name
 */
public static String getName(ItemStack itemStack,int maxLength){
  String alias=Odd.getAlias(itemStack);
  String itemName=alias != null ? alias : itemStack.getType().toString();
  String data=DataValue.name(itemStack);
  String durability="String_Node_Str";
  if (data == null) {
    if (itemStack.getDurability() != 0) {
      durability="String_Node_Str" + itemStack.getDurability();
    }
  }
  data=data != null ? data + "String_Node_Str" : "String_Node_Str";
  String metaData="String_Node_Str";
  if (itemStack.hasItemMeta()) {
    metaData="String_Node_Str" + Metadata.getItemCode(itemStack);
  }
  int codeLength=(data + itemName + durability+ metaData).length();
  String code=data + itemName;
  if (maxLength > 0 && codeLength > maxLength) {
    int exceeding=codeLength - maxLength;
    code=getShortenedName(code,code.length() - exceeding);
  }
  code=StringUtil.capitalizeFirstLetter(code,'_') + durability + metaData;
  ItemStack codeItem=getItem(code);
  if (!equals(itemStack,codeItem)) {
    throw new IllegalArgumentException("String_Node_Str" + itemStack + "String_Node_Str"+ maxLength+ "String_Node_Str"+ code+ "String_Node_Str"+ codeItem+ "String_Node_Str");
  }
  return code;
}
Program: 178037
Project: 178037
Buggy source:
public boolean onCommand(CommandSender sender,Command cmd,String label,String[] args){
  ItemStack item;
  if (args.length == 0) {
    if (!(sender instanceof HumanEntity)) {
      return false;
    }
    item=((HumanEntity)sender).getItemInHand();
  }
 else {
    item=MaterialUtil.getItem(StringUtil.joinArray(args));
  }
  if (MaterialUtil.isEmpty(item)) {
    return false;
  }
  sender.sendMessage(Messages.prefix(iteminfo));
  sender.sendMessage(ChatColor.WHITE + "String_Node_Str" + ChatColor.GRAY+ MaterialUtil.getName(item));
  sender.sendMessage(ChatColor.WHITE + "String_Node_Str" + ChatColor.GRAY+ MaterialUtil.getSignName(item));
  ItemInfoEvent event=new ItemInfoEvent(sender,item);
  ChestShop.callEvent(event);
  return true;
}

Fixed version (ground truth):
public boolean onCommand(CommandSender sender,Command cmd,String label,String[] args){
  ItemStack item;
  if (args.length == 0) {
    if (!(sender instanceof HumanEntity)) {
      return false;
    }
    item=((HumanEntity)sender).getItemInHand();
  }
 else {
    item=MaterialUtil.getItem(StringUtil.joinArray(args));
  }
  if (MaterialUtil.isEmpty(item)) {
    return false;
  }
  sender.sendMessage(Messages.prefix(iteminfo));
  try {
    sender.sendMessage(ChatColor.WHITE + "String_Node_Str" + ChatColor.GRAY+ MaterialUtil.getName(item));
  }
 catch (  IllegalArgumentException e) {
    sender.sendMessage(ChatColor.RED + "String_Node_Str" + e.getMessage());
  }
  try {
    sender.sendMessage(ChatColor.WHITE + "String_Node_Str" + ChatColor.GRAY+ MaterialUtil.getSignName(item));
  }
 catch (  IllegalArgumentException e) {
    sender.sendMessage(ChatColor.RED + "String_Node_Str" + e.getMessage());
  }
  ItemInfoEvent event=new ItemInfoEvent(sender,item);
  ChestShop.callEvent(event);
  return true;
}
Program: 178038
Project: 178038
Buggy source:
/** 
 * Returns item's name, with a maximum length
 * @param itemStack ItemStack to name
 * @param maxLength The max length that the name should have; 0 or below if it should be unlimited
 * @return ItemStack's name
 */
public static String getName(ItemStack itemStack,int maxLength){
  String alias=Odd.getAlias(itemStack);
  String itemName=alias != null ? alias : itemStack.getType().toString();
  String data=DataValue.name(itemStack);
  String durability="String_Node_Str";
  if (data == null) {
    if (itemStack.getDurability() != 0) {
      durability="String_Node_Str" + itemStack.getDurability();
    }
  }
  data=data != null ? data + "String_Node_Str" : "String_Node_Str";
  String metaData="String_Node_Str";
  if (itemStack.hasItemMeta()) {
    metaData="String_Node_Str" + Metadata.getItemCode(itemStack);
  }
  int codeLength=(data + itemName + durability+ metaData).length();
  String code=data + itemName;
  if (maxLength > 0 && codeLength > maxLength) {
    int exceeding=codeLength - maxLength;
    code=getShortenedName(code,code.length() - exceeding);
  }
  code=StringUtil.capitalizeFirstLetter(code,'_') + durability + metaData;
  ItemStack codeItem=getItem(code);
  if (!equals(itemStack,codeItem)) {
    throw new IllegalArgumentException("String_Node_Str" + itemStack + "String_Node_Str"+ maxLength+ "String_Node_Str"+ code+ "String_Node_Str"+ codeItem+ "String_Node_Str");
  }
  return code;
}

Fixed version (ground truth):
/** 
 * Returns item's name, with a maximum length
 * @param itemStack ItemStack to name
 * @param maxLength The max length that the name should have; 0 or below if it should be unlimited
 * @return ItemStack's name
 */
public static String getName(ItemStack itemStack,int maxLength){
  String alias=Odd.getAlias(itemStack);
  String itemName=alias != null ? alias : itemStack.getType().toString();
  if (itemStack.getType() != Material.HUGE_MUSHROOM_2 && itemName.endsWith("String_Node_Str")) {
    itemName=itemName.substring(0,itemName.length() - 2);
  }
  String data=DataValue.name(itemStack);
  String durability="String_Node_Str";
  if (data == null) {
    if (itemStack.getDurability() != 0) {
      durability="String_Node_Str" + itemStack.getDurability();
    }
  }
  data=data != null ? data + "String_Node_Str" : "String_Node_Str";
  String metaData="String_Node_Str";
  if (itemStack.hasItemMeta()) {
    metaData="String_Node_Str" + Metadata.getItemCode(itemStack);
  }
  int codeLength=(data + itemName + durability+ metaData).length();
  String code=data + itemName;
  if (maxLength > 0 && codeLength > maxLength) {
    int exceeding=codeLength - maxLength;
    code=getShortenedName(code,code.length() - exceeding);
  }
  code=StringUtil.capitalizeFirstLetter(code,'_') + durability + metaData;
  ItemStack codeItem=getItem(code);
  if (!equals(itemStack,codeItem)) {
    throw new IllegalArgumentException("String_Node_Str" + itemStack + "String_Node_Str"+ maxLength+ "String_Node_Str"+ code+ "String_Node_Str"+ codeItem+ "String_Node_Str");
  }
  return code;
}
Program: 178039
Project: 178039
Buggy source:
/** 
 * Gives you an ItemStack from a String
 * @param itemName Item name
 * @return ItemStack
 */
public static ItemStack getItem(String itemName){
  ItemStack itemStack=Odd.getFromString(itemName);
  if (itemStack != null) {
    return itemStack;
  }
  String[] split=itemName.split("String_Node_Str");
  for (int i=0; i < split.length; i++) {
    split[i]=split[i].trim();
  }
  Material material=getMaterial(split[0]);
  short durability=getDurability(itemName);
  MaterialData data=null;
  if (material == null) {
    if (!split[0].contains("String_Node_Str")) {
      return null;
    }
    for (int index=split[0].indexOf(' '); index >= 0 && index + 1 < split[0].length(); index=split[0].indexOf(' ',index + 1)) {
      material=getMaterial(split[0].substring(index + 1));
      if (material != null) {
        data=DataValue.getData(split[0].substring(0,index),material);
        break;
      }
    }
    if (material == null) {
      return null;
    }
  }
  itemStack=new ItemStack(material);
  if (data != null) {
    itemStack.setData(data);
    durability=data.getData();
  }
  itemStack.setDurability(durability);
  ItemMeta meta=getMetadata(itemName);
  if (meta != null) {
    itemStack.setItemMeta(meta);
  }
  return itemStack;
}

Fixed version (ground truth):
/** 
 * Gives you an ItemStack from a String
 * @param itemName Item name
 * @return ItemStack
 */
public static ItemStack getItem(String itemName){
  ItemStack itemStack=Odd.getFromString(itemName);
  if (itemStack != null) {
    return itemStack;
  }
  String[] split=itemName.split("String_Node_Str");
  for (int i=0; i < split.length; i++) {
    split[i]=split[i].trim();
  }
  Material material=getMaterial(split[0]);
  short durability=getDurability(itemName);
  MaterialData data=null;
  if (material == null) {
    if (!split[0].contains("String_Node_Str")) {
      return null;
    }
    for (int index=split[0].indexOf(' '); index >= 0 && index + 1 < split[0].length(); index=split[0].indexOf(' ',index + 1)) {
      material=getMaterial(split[0].substring(index + 1));
      if (material != null) {
        data=DataValue.getData(split[0].substring(0,index),material);
        material=data.getItemType();
        break;
      }
    }
    if (material == null) {
      return null;
    }
  }
  itemStack=new ItemStack(material);
  if (data != null) {
    itemStack.setData(data);
    durability=data.getData();
  }
  itemStack.setDurability(durability);
  ItemMeta meta=getMetadata(itemName);
  if (meta != null) {
    itemStack.setItemMeta(meta);
  }
  return itemStack;
}
Program: 178041
Project: 178041
Buggy source:
/** 
 * Returns item's name, with a maximum length
 * @param itemStack ItemStack to name
 * @param maxLength The max length that the name should have; 0 or below if it should be unlimited
 * @return ItemStack's name
 */
public static String getName(ItemStack itemStack,int maxLength){
  String alias=Odd.getAlias(itemStack);
  String itemName=alias != null ? alias : itemStack.getType().toString();
  String data=DataValue.name(itemStack);
  String durability="String_Node_Str";
  if (data == null) {
    if (itemStack.getDurability() != 0) {
      durability="String_Node_Str" + itemStack.getDurability();
    }
  }
  data=data != null ? data + "String_Node_Str" : "String_Node_Str";
  String metaData="String_Node_Str";
  if (itemStack.hasItemMeta()) {
    metaData="String_Node_Str" + Metadata.getItemCode(itemStack);
  }
  String code=data + itemName + durability+ metaData;
  if (maxLength > 0 && code.length() > maxLength) {
    int exceeding=code.length() - maxLength;
    code=data + getShortenedName(itemName,itemName.length() - exceeding) + durability+ metaData;
  }
  code=StringUtil.capitalizeFirstLetter(code,'_');
  ItemStack codeItem=getItem(code);
  if (!equals(itemStack,codeItem)) {
    throw new IllegalArgumentException("String_Node_Str" + itemStack + "String_Node_Str"+ maxLength);
  }
  return code;
}

Fixed version (ground truth):
/** 
 * Returns item's name, with a maximum length
 * @param itemStack ItemStack to name
 * @param maxLength The max length that the name should have; 0 or below if it should be unlimited
 * @return ItemStack's name
 */
public static String getName(ItemStack itemStack,int maxLength){
  String alias=Odd.getAlias(itemStack);
  String itemName=alias != null ? alias : itemStack.getType().toString();
  String data=DataValue.name(itemStack);
  String durability="String_Node_Str";
  if (data == null) {
    if (itemStack.getDurability() != 0) {
      durability="String_Node_Str" + itemStack.getDurability();
    }
  }
  data=data != null ? data + "String_Node_Str" : "String_Node_Str";
  String metaData="String_Node_Str";
  if (itemStack.hasItemMeta()) {
    metaData="String_Node_Str" + Metadata.getItemCode(itemStack);
  }
  String code=data + itemName + durability+ metaData;
  if (maxLength > 0 && code.length() > maxLength) {
    int exceeding=code.length() - maxLength;
    code=data + getShortenedName(itemName,itemName.length() - exceeding) + durability+ metaData;
  }
  code=StringUtil.capitalizeFirstLetter(code,'_');
  ItemStack codeItem=getItem(code);
  if (!equals(itemStack,codeItem)) {
    throw new IllegalArgumentException("String_Node_Str" + itemStack + "String_Node_Str"+ maxLength+ "String_Node_Str"+ code);
  }
  return code;
}
Program: 178042
Project: 178042
Buggy source:
/** 
 * Gives you an ItemStack from a String
 * @param itemName Item name
 * @return ItemStack
 */
public static ItemStack getItem(String itemName){
  ItemStack itemStack=Odd.getFromString(itemName);
  if (itemStack != null) {
    return itemStack;
  }
  String[] split=itemName.split("String_Node_Str");
  for (int i=0; i < split.length; i++) {
    split[i]=split[i].trim();
  }
  Material material=getMaterial(split[0]);
  short durability=getDurability(itemName);
  if (material == null) {
    if (!split[0].contains("String_Node_Str")) {
      return null;
    }
    for (int index=split[0].indexOf(' '); index >= 0 && index + 1 < split[0].length(); index=split[0].indexOf(' ',index + 1)) {
      material=getMaterial(split[0].substring(index + 1));
      if (material != null) {
        if (durability == 0) {
          durability=DataValue.get(split[0].substring(0,index),material);
        }
        break;
      }
    }
    if (material == null) {
      return null;
    }
  }
  itemStack=new ItemStack(material);
  itemStack.setDurability(durability);
  ItemMeta meta=getMetadata(itemName);
  if (meta != null) {
    itemStack.setItemMeta(meta);
  }
  return itemStack;
}

Fixed version (ground truth):
/** 
 * Gives you an ItemStack from a String
 * @param itemName Item name
 * @return ItemStack
 */
public static ItemStack getItem(String itemName){
  ItemStack itemStack=Odd.getFromString(itemName);
  if (itemStack != null) {
    return itemStack;
  }
  String[] split=itemName.split("String_Node_Str");
  for (int i=0; i < split.length; i++) {
    split[i]=split[i].trim();
  }
  Material material=getMaterial(split[0]);
  short durability=getDurability(itemName);
  byte data=-1;
  if (material == null) {
    if (!split[0].contains("String_Node_Str")) {
      return null;
    }
    for (int index=split[0].indexOf(' '); index >= 0 && index + 1 < split[0].length(); index=split[0].indexOf(' ',index + 1)) {
      material=getMaterial(split[0].substring(index + 1));
      if (material != null) {
        if (durability == 0) {
          durability=data=DataValue.get(split[0].substring(0,index),material);
        }
        break;
      }
    }
    if (material == null) {
      return null;
    }
  }
  itemStack=new ItemStack(material);
  itemStack.setDurability(durability);
  if (data > -1) {
    itemStack.getData().setData(data);
  }
  ItemMeta meta=getMetadata(itemName);
  if (meta != null) {
    itemStack.setItemMeta(meta);
  }
  return itemStack;
}
Program: 178043
Project: 178043
Buggy source:
/** 
 * Checks if the itemStacks are equal, ignoring their amount
 * @param one first itemStack
 * @param two second itemStack
 * @return Are they equal?
 */
public static boolean equals(ItemStack one,ItemStack two){
  if (one == null || two == null) {
    return one == two;
  }
  if (one.isSimilar(two)) {
    return true;
  }
  return one.getType() == two.getType() && one.getDurability() == two.getDurability() && one.getData().equals(two.getData()) && one.hasItemMeta() && two.hasItemMeta() && one.getItemMeta() instanceof BookMeta && two.getItemMeta() instanceof BookMeta && one.getItemMeta().serialize().equals(two.getItemMeta().serialize());
}

Fixed version (ground truth):
/** 
 * Checks if the itemStacks are equal, ignoring their amount
 * @param one first itemStack
 * @param two second itemStack
 * @return Are they equal?
 */
public static boolean equals(ItemStack one,ItemStack two){
  if (one == null || two == null) {
    return one == two;
  }
  if (one.isSimilar(two)) {
    return true;
  }
  if (one.getType() == two.getType() && one.getType() == Material.BANNER && one.getDurability() == two.getDurability()) {
    Map<String,Object> m1=new HashMap<>(one.getItemMeta().serialize());
    Map<String,Object> m2=new HashMap<>(two.getItemMeta().serialize());
    Object c1=m1.remove("String_Node_Str");
    Object c2=m2.remove("String_Node_Str");
    return (one.getData().equals(two.getData()) || c1.equals(c2)) && m1.equals(m2);
  }
  return one.getType() == two.getType() && one.getDurability() == two.getDurability() && one.getData().equals(two.getData()) && one.hasItemMeta() && two.hasItemMeta() && one.getItemMeta() instanceof BookMeta && two.getItemMeta() instanceof BookMeta && one.getItemMeta().serialize().equals(two.getItemMeta().serialize());
}
Program: 178045
Project: 178045
Buggy source:
/** 
 * Returns a string with the DataValue
 * @param itemStack ItemStack to describe
 * @return Data value string
 */
public static String name(ItemStack itemStack){
  MaterialData data=itemStack.getData();
  if (data == null) {
    return null;
  }
  if (data instanceof TexturedMaterial) {
    return ((TexturedMaterial)data).getMaterial().name();
  }
 else   if (data instanceof Colorable) {
    DyeColor color=((Colorable)data).getColor();
    return (color != null ? color.name() : null);
  }
 else   if (data instanceof Tree) {
    TreeSpecies specie=((Tree)data).getSpecies();
    return (specie != null && specie != TreeSpecies.GENERIC ? specie.name() : null);
  }
 else   if (data instanceof SpawnEgg) {
    EntityType type=((SpawnEgg)data).getSpawnedType();
    return (type != null ? type.name() : null);
  }
 else   if (data instanceof Coal) {
    CoalType coal=((Coal)data).getType();
    return (coal != null && coal != CoalType.COAL ? coal.name() : null);
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Returns a string with the DataValue
 * @param itemStack ItemStack to describe
 * @return Data value string
 */
public static String name(ItemStack itemStack){
  MaterialData data=itemStack.getData();
  if (data == null) {
    return null;
  }
  if (data.getItemType() == Material.BANNER && data.getData() < 16) {
    return DyeColor.getByDyeData(data.getData()).name();
  }
  if (data instanceof TexturedMaterial) {
    return ((TexturedMaterial)data).getMaterial().name();
  }
 else   if (data instanceof Colorable) {
    DyeColor color=((Colorable)data).getColor();
    return (color != null ? color.name() : null);
  }
 else   if (data instanceof Tree) {
    TreeSpecies specie=((Tree)data).getSpecies();
    return (specie != null && specie != TreeSpecies.GENERIC ? specie.name() : null);
  }
 else   if (data instanceof SpawnEgg) {
    EntityType type=((SpawnEgg)data).getSpawnedType();
    return (type != null ? type.name() : null);
  }
 else   if (data instanceof Coal) {
    CoalType coal=((Coal)data).getType();
    return (coal != null && coal != CoalType.COAL ? coal.name() : null);
  }
 else {
    return null;
  }
}
Program: 178046
Project: 178046
Buggy source:
/** 
 * Checks if the inventory has stock of this type
 * @param items     items
 * @param inventory inventory
 * @return Does the inventory contain stock of this type?
 */
public static boolean hasItems(ItemStack[] items,Inventory inventory){
  for (  ItemStack item : items) {
    if (getAmount(item,inventory) < item.getAmount()) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Checks if the inventory has stock of this type
 * @param items     items
 * @param inventory inventory
 * @return Does the inventory contain stock of this type?
 */
public static boolean hasItems(ItemStack[] items,Inventory inventory){
  ItemStack[] mergedItems=mergeSimilarStacks(items);
  for (  ItemStack item : mergedItems) {
    if (getAmount(item,inventory) < item.getAmount()) {
      return false;
    }
  }
  return true;
}
Program: 178047
Project: 178047
Buggy source:
/** 
 * Checks if the item fits the inventory
 * @param item      Item to check
 * @param inventory inventory
 * @return Does item fit inside inventory?
 */
public static boolean fits(ItemStack item,Inventory inventory){
  int left=item.getAmount();
  if (inventory.getMaxStackSize() == Integer.MAX_VALUE) {
    return true;
  }
  for (  ItemStack iStack : getStorageContents(inventory)) {
    if (left <= 0) {
      return true;
    }
    if (MaterialUtil.isEmpty(iStack)) {
      left-=item.getMaxStackSize();
      continue;
    }
    if (!MaterialUtil.equals(iStack,item)) {
      continue;
    }
    left-=(iStack.getMaxStackSize() - iStack.getAmount());
  }
  return left <= 0;
}

Fixed version (ground truth):
/** 
 * Checks if the item fits the inventory
 * @param item      Item to check
 * @param inventory inventory
 * @return Does item fit inside inventory?
 */
public static boolean fits(ItemStack item,Inventory inventory){
  int left=item.getAmount();
  if (inventory.getMaxStackSize() == Integer.MAX_VALUE) {
    return true;
  }
  for (  ItemStack iStack : getStorageContents(inventory)) {
    if (left <= 0) {
      return true;
    }
    if (MaterialUtil.isEmpty(iStack)) {
      left-=getMaxStackSize(item);
      continue;
    }
    if (!MaterialUtil.equals(iStack,item)) {
      continue;
    }
    left-=(getMaxStackSize(iStack) - iStack.getAmount());
  }
  return left <= 0;
}
Program: 178048
Project: 178048
Buggy source:
/** 
 * Removes an item from the inventory
 * @param item      Item to remove
 * @param inventory Inventory
 * @return Number of items that couldn't be removed
 */
public static int remove(ItemStack item,Inventory inventory){
  Map<Integer,ItemStack> leftovers=inventory.removeItem(item);
  if (!leftovers.isEmpty()) {
    for (Iterator<ItemStack> iterator=leftovers.values().iterator(); iterator.hasNext(); ) {
      ItemStack left=iterator.next();
      if (removeManually(left,inventory) == 0) {
        iterator.remove();
      }
    }
  }
  return countItems(leftovers);
}

Fixed version (ground truth):
/** 
 * Removes an item from the inventory
 * @param item      Item to remove
 * @param inventory Inventory
 * @return Number of items that couldn't be removed
 */
public static int remove(ItemStack item,Inventory inventory){
  Map<Integer,ItemStack> leftovers=inventory.removeItem(item);
  if (!leftovers.isEmpty()) {
    leftovers.values().removeIf(left -> removeManually(left,inventory) == 0);
  }
  return countItems(leftovers);
}
Program: 178049
Project: 178049
Buggy source:
/** 
 * If items in arguments are similar, this function merges them into stacks of the same type
 * @param items Items to merge
 * @return Merged stack array
 */
public static ItemStack[] mergeSimilarStacks(ItemStack... items){
  if (items.length <= 1) {
    return items;
  }
  List<ItemStack> itemList=new LinkedList<ItemStack>();
  Iterating:   for (  ItemStack item : items) {
    for (    ItemStack iStack : itemList) {
      if (MaterialUtil.equals(item,iStack)) {
        iStack.setAmount(iStack.getAmount() + item.getAmount());
        continue Iterating;
      }
    }
    itemList.add(item);
  }
  return itemList.toArray(new ItemStack[itemList.size()]);
}

Fixed version (ground truth):
/** 
 * If items in arguments are similar, this function merges them into stacks of the same type
 * @param items Items to merge
 * @return Merged stack array
 */
public static ItemStack[] mergeSimilarStacks(ItemStack... items){
  if (items.length <= 1) {
    return items;
  }
  List<ItemStack> itemList=new LinkedList<ItemStack>();
  Iterating:   for (  ItemStack item : items) {
    for (    ItemStack iStack : itemList) {
      if (MaterialUtil.equals(item,iStack)) {
        iStack.setAmount(iStack.getAmount() + item.getAmount());
        continue Iterating;
      }
    }
    itemList.add(item.clone());
  }
  return itemList.toArray(new ItemStack[itemList.size()]);
}
Program: 178051
Project: 178051
Buggy source:
private static int getStackAmount(ItemStack item,Inventory inventory,Player player,Action action){
  Action buy=Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
  Inventory checkedInventory=(action == buy ? inventory : player.getInventory());
  if (checkedInventory.containsAtLeast(item,item.getMaxStackSize())) {
    return item.getMaxStackSize();
  }
 else {
    return InventoryUtil.getAmount(item,checkedInventory);
  }
}

Fixed version (ground truth):
private static int getStackAmount(ItemStack item,Inventory inventory,Player player,Action action){
  Action buy=Properties.REVERSE_BUTTONS ? LEFT_CLICK_BLOCK : RIGHT_CLICK_BLOCK;
  Inventory checkedInventory=(action == buy ? inventory : player.getInventory());
  if (checkedInventory.containsAtLeast(item,InventoryUtil.getMaxStackSize(item))) {
    return InventoryUtil.getMaxStackSize(item);
  }
 else {
    return InventoryUtil.getAmount(item,checkedInventory);
  }
}
Program: 178052
Project: 178052
Buggy source:
private static boolean itemsFitInInventory(ItemStack[] items,Inventory inventory){
  for (  ItemStack item : items) {
    if (!InventoryUtil.fits(item,inventory)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private static boolean itemsFitInInventory(ItemStack[] items,Inventory inventory){
  ItemStack[] mergedItems=InventoryUtil.mergeSimilarStacks(items);
  for (  ItemStack item : mergedItems) {
    if (!InventoryUtil.fits(item,inventory)) {
      return false;
    }
  }
  return true;
}
Program: 178053
Project: 178053
Buggy source:
/** 
 * Make an array of items fit into an inventory.
 * @param stock     The items to fit in the inventory
 * @param inventory The inventory to fit it in
 * @return Whether or not the items fit into the inventory
 */
private static ItemStack[] getItemsThatFit(ItemStack[] stock,Inventory inventory){
  List<ItemStack> resultStock=new ArrayList<>();
  int emptySlots=InventoryUtil.countEmpty(inventory);
  ItemStack[] itemsInInventory=getItems(stock,inventory);
  for (  ItemStack item : stock) {
    int maxStackSize=InventoryUtil.getMaxStackSize(item);
    int free=0;
    for (    ItemStack itemInInventory : itemsInInventory) {
      if (MaterialUtil.equals(item,itemInInventory)) {
        free=(maxStackSize - itemInInventory.getAmount()) % maxStackSize;
        break;
      }
    }
    if (free == 0 && emptySlots == 0) {
      continue;
    }
    ItemStack clone=item.clone();
    if (item.getAmount() > free) {
      if (emptySlots > 0) {
        int requiredSlots=(int)Math.ceil((item.getAmount() - free) / maxStackSize);
        if (requiredSlots <= emptySlots) {
          emptySlots=emptySlots - requiredSlots;
        }
 else {
          emptySlots=0;
          clone.setAmount(free + maxStackSize * emptySlots);
        }
      }
 else {
        clone.setAmount(free);
      }
    }
    resultStock.add(clone);
  }
  return (ItemStack[])resultStock.toArray();
}

Fixed version (ground truth):
/** 
 * Make an array of items fit into an inventory.
 * @param stock     The items to fit in the inventory
 * @param inventory The inventory to fit it in
 * @return Whether or not the items fit into the inventory
 */
private static ItemStack[] getItemsThatFit(ItemStack[] stock,Inventory inventory){
  List<ItemStack> resultStock=new ArrayList<>();
  int emptySlots=InventoryUtil.countEmpty(inventory);
  ItemStack[] itemsInInventory=getItems(stock,inventory);
  for (  ItemStack item : stock) {
    int maxStackSize=InventoryUtil.getMaxStackSize(item);
    int free=0;
    for (    ItemStack itemInInventory : itemsInInventory) {
      if (MaterialUtil.equals(item,itemInInventory)) {
        free=(maxStackSize - itemInInventory.getAmount()) % maxStackSize;
        break;
      }
    }
    if (free == 0 && emptySlots == 0) {
      continue;
    }
    ItemStack clone=item.clone();
    if (item.getAmount() > free) {
      if (emptySlots > 0) {
        int requiredSlots=(int)Math.ceil((item.getAmount() - free) / maxStackSize);
        if (requiredSlots <= emptySlots) {
          emptySlots=emptySlots - requiredSlots;
        }
 else {
          emptySlots=0;
          clone.setAmount(free + maxStackSize * emptySlots);
        }
      }
 else {
        clone.setAmount(free);
      }
    }
    resultStock.add(clone);
  }
  return resultStock.toArray(new ItemStack[resultStock.size()]);
}
Program: 178054
Project: 178054
Buggy source:
public static String getServerAccountName(){
  return Properties.SERVER_ECONOMY_ACCOUNT;
}

Fixed version (ground truth):
/** 
 * Get the name of the server conomy account
 * @return The username of te server economy account
 * @deprecated Use {@link NameManager#getServerEconomyAccount()} or {@link Properties#SERVER_ECONOMY_ACCOUNT}
 */
@Deprecated public static String getServerAccountName(){
  return Properties.SERVER_ECONOMY_ACCOUNT;
}
Program: 178055
Project: 178055
Buggy source:
public static boolean isOwnerEconomicallyActive(Inventory inventory){
  return !ChestShopSign.isAdminShop(inventory) || !getServerAccountName().isEmpty();
}

Fixed version (ground truth):
public static boolean isOwnerEconomicallyActive(Inventory inventory){
  return !ChestShopSign.isAdminShop(inventory) || NameManager.getServerEconomyAccount() != null;
}
Program: 178056
Project: 178056
Buggy source:
@EventHandler(priority=EventPriority.LOWEST) public static void onBalanceCheck(CurrencyAmountEvent event){
  UUID target=event.getAccount();
  if (!NameManager.isAdminShop(target) || NameManager.isServerEconomyAccount(target)) {
    return;
  }
  if (SERVER_ECONOMY_ACCOUNT.isEmpty()) {
    event.setAmount(BigDecimal.valueOf(Double.MAX_VALUE));
    return;
  }
 else {
    Account account=NameManager.getAccount(SERVER_ECONOMY_ACCOUNT);
    if (account == null || account.getUuid() == null) {
      return;
    }
    target=account.getUuid();
  }
  CurrencyAmountEvent currencyAmountEvent=new CurrencyAmountEvent(target,event.getWorld());
  ChestShop.callEvent(currencyAmountEvent);
  event.setAmount(currencyAmountEvent.getAmount());
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOWEST) public static void onBalanceCheck(CurrencyAmountEvent event){
  UUID target=event.getAccount();
  if (!NameManager.isAdminShop(target) || NameManager.isServerEconomyAccount(target)) {
    return;
  }
  Account account=NameManager.getServerEconomyAccount();
  target=account != null ? account.getUuid() : null;
  if (target == null) {
    event.setAmount(BigDecimal.valueOf(Double.MAX_VALUE));
    return;
  }
  CurrencyAmountEvent currencyAmountEvent=new CurrencyAmountEvent(target,event.getWorld());
  ChestShop.callEvent(currencyAmountEvent);
  event.setAmount(currencyAmountEvent.getAmount());
}
Program: 178057
Project: 178057
Buggy source:
@EventHandler(priority=EventPriority.LOWEST) public static void onCurrencySubtract(CurrencySubtractEvent event){
  UUID target=event.getTarget();
  if (!NameManager.isAdminShop(target) || SERVER_ECONOMY_ACCOUNT.equals(NameManager.getUsername(target))) {
    return;
  }
  if (SERVER_ECONOMY_ACCOUNT.isEmpty()) {
    event.setSubtracted(true);
    return;
  }
 else {
    Account account=NameManager.getAccount(SERVER_ECONOMY_ACCOUNT);
    if (account != null) {
      target=account.getUuid();
    }
 else {
      target=null;
    }
  }
  event.setSubtracted(true);
  if (target == null) {
    return;
  }
  CurrencySubtractEvent currencySubtractEvent=new CurrencySubtractEvent(event.getAmount(),target,event.getWorld());
  ChestShop.callEvent(currencySubtractEvent);
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOWEST) public static void onCurrencySubtract(CurrencySubtractEvent event){
  UUID target=event.getTarget();
  if (!NameManager.isAdminShop(target) || NameManager.isServerEconomyAccount(target)) {
    return;
  }
  Account account=NameManager.getServerEconomyAccount();
  target=account != null ? account.getUuid() : null;
  event.setSubtracted(true);
  if (target == null) {
    return;
  }
  CurrencySubtractEvent currencySubtractEvent=new CurrencySubtractEvent(event.getAmount(),target,event.getWorld());
  ChestShop.callEvent(currencySubtractEvent);
}
Program: 178058
Project: 178058
Buggy source:
@EventHandler(priority=EventPriority.LOWEST) public static void onCurrencyAdd(CurrencyAddEvent event){
  UUID target=event.getTarget();
  if (!NameManager.isAdminShop(target) || SERVER_ECONOMY_ACCOUNT.equals(NameManager.getUsername(target))) {
    return;
  }
  if (SERVER_ECONOMY_ACCOUNT.isEmpty()) {
    event.setAdded(true);
    return;
  }
 else {
    Account account=NameManager.getAccount(SERVER_ECONOMY_ACCOUNT);
    if (account == null || account.getUuid() == null) {
      return;
    }
    target=account.getUuid();
  }
  event.setAdded(true);
  if (target == null) {
    return;
  }
  CurrencyAddEvent currencyAddEvent=new CurrencyAddEvent(event.getAmount(),target,event.getWorld());
  ChestShop.callEvent(currencyAddEvent);
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOWEST) public static void onCurrencyAdd(CurrencyAddEvent event){
  UUID target=event.getTarget();
  if (!NameManager.isAdminShop(target) || NameManager.isServerEconomyAccount(target)) {
    return;
  }
  Account account=NameManager.getServerEconomyAccount();
  target=account != null ? account.getUuid() : null;
  event.setAdded(true);
  if (target == null) {
    return;
  }
  CurrencyAddEvent currencyAddEvent=new CurrencyAddEvent(event.getAmount(),target,event.getWorld());
  ChestShop.callEvent(currencyAddEvent);
}
Program: 178059
Project: 178059
Buggy source:
@EventHandler(priority=EventPriority.LOWEST) public static void onCurrencyCheck(CurrencyCheckEvent event){
  UUID target=event.getAccount();
  if (!NameManager.isAdminShop(target) || SERVER_ECONOMY_ACCOUNT.equals(NameManager.getUsername(target))) {
    return;
  }
  if (SERVER_ECONOMY_ACCOUNT.isEmpty()) {
    event.hasEnough(true);
    return;
  }
 else {
    Account account=NameManager.getAccount(SERVER_ECONOMY_ACCOUNT);
    if (account == null || account.getUuid() == null) {
      event.hasEnough(true);
      return;
    }
    target=account.getUuid();
  }
  CurrencyCheckEvent currencyCheckEvent=new CurrencyCheckEvent(event.getAmount(),target,event.getWorld());
  ChestShop.callEvent(currencyCheckEvent);
  event.hasEnough(currencyCheckEvent.hasEnough());
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOWEST) public static void onCurrencyCheck(CurrencyCheckEvent event){
  UUID target=event.getAccount();
  if (!NameManager.isAdminShop(target) || NameManager.isServerEconomyAccount(target)) {
    return;
  }
  Account account=NameManager.getServerEconomyAccount();
  target=account != null ? account.getUuid() : null;
  if (target == null) {
    event.hasEnough(true);
    return;
  }
  CurrencyCheckEvent currencyCheckEvent=new CurrencyCheckEvent(event.getAmount(),target,event.getWorld());
  ChestShop.callEvent(currencyCheckEvent);
  event.hasEnough(currencyCheckEvent.hasEnough());
}
Program: 178060
Project: 178060
Buggy source:
@EventHandler(priority=EventPriority.LOWEST) public static void onCurrencyHoldCheck(CurrencyHoldEvent event){
  UUID target=event.getAccount();
  if (!NameManager.isAdminShop(target) || SERVER_ECONOMY_ACCOUNT.equals(NameManager.getUsername(target))) {
    return;
  }
  event.canHold(true);
  event.setAccount(null);
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOWEST) public static void onCurrencyHoldCheck(CurrencyHoldEvent event){
  UUID target=event.getAccount();
  if (!NameManager.isAdminShop(target) || NameManager.isServerEconomyAccount(target)) {
    return;
  }
  event.canHold(true);
  event.setAccount(null);
}
Program: 178061
Project: 178061
Buggy source:
@EventHandler(priority=EventPriority.LOW) public static void onCurrencyAdd(CurrencyAddEvent event){
  if (event.isAdded()) {
    return;
  }
  UUID target=event.getTarget();
  if (Economy.getServerAccountName().equals(NameManager.getUsername(target))) {
    return;
  }
  float taxAmount=isServerAccount(target) ? Properties.SERVER_TAX_AMOUNT : Properties.TAX_AMOUNT;
  if (taxAmount == 0) {
    return;
  }
  BigDecimal tax=getTax(event.getAmount(),taxAmount);
  if (!Economy.getServerAccountName().isEmpty()) {
    CurrencyAddEvent currencyAddEvent=new CurrencyAddEvent(tax,NameManager.getUUID(Economy.getServerAccountName()),event.getWorld());
    ChestShop.callEvent(currencyAddEvent);
  }
  event.setAmount(event.getAmount().subtract(tax));
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.LOW) public static void onCurrencyAdd(CurrencyAddEvent event){
  if (event.isAdded()) {
    return;
  }
  UUID target=event.getTarget();
  if (NameManager.isServerEconomyAccount(target)) {
    return;
  }
  float taxAmount=isServerAccount(target) ? Properties.SERVER_TAX_AMOUNT : Properties.TAX_AMOUNT;
  if (taxAmount == 0) {
    return;
  }
  BigDecimal tax=getTax(event.getAmount(),taxAmount);
  if (NameManager.getServerEconomyAccount() != null) {
    CurrencyAddEvent currencyAddEvent=new CurrencyAddEvent(tax,NameManager.getServerEconomyAccount().getUuid(),event.getWorld());
    ChestShop.callEvent(currencyAddEvent);
  }
  event.setAmount(event.getAmount().subtract(tax));
}
Program: 178062
Project: 178062
Buggy source:
@EventHandler public static void onShopCreation(ShopCreatedEvent event){
  double shopCreationPrice=Properties.SHOP_CREATION_PRICE;
  if (shopCreationPrice == 0) {
    return;
  }
  if (ChestShopSign.isAdminShop(event.getSignLine(NAME_LINE))) {
    return;
  }
  Player player=event.getPlayer();
  if (Permission.has(player,NOFEE)) {
    return;
  }
  CurrencySubtractEvent subtractionEvent=new CurrencySubtractEvent(BigDecimal.valueOf(shopCreationPrice),player);
  ChestShop.callEvent(subtractionEvent);
  if (!Economy.getServerAccountName().isEmpty()) {
    CurrencyAddEvent currencyAddEvent=new CurrencyAddEvent(BigDecimal.valueOf(shopCreationPrice),NameManager.getUUID(Economy.getServerAccountName()),player.getWorld());
    ChestShop.callEvent(currencyAddEvent);
  }
  player.sendMessage(Messages.prefix(Messages.SHOP_FEE_PAID.replace("String_Node_Str",Economy.formatBalance(shopCreationPrice))));
}

Fixed version (ground truth):
@EventHandler public static void onShopCreation(ShopCreatedEvent event){
  double shopCreationPrice=Properties.SHOP_CREATION_PRICE;
  if (shopCreationPrice == 0) {
    return;
  }
  if (ChestShopSign.isAdminShop(event.getSignLine(NAME_LINE))) {
    return;
  }
  Player player=event.getPlayer();
  if (Permission.has(player,NOFEE)) {
    return;
  }
  CurrencySubtractEvent subtractionEvent=new CurrencySubtractEvent(BigDecimal.valueOf(shopCreationPrice),player);
  ChestShop.callEvent(subtractionEvent);
  if (NameManager.getServerEconomyAccount() != null) {
    CurrencyAddEvent currencyAddEvent=new CurrencyAddEvent(BigDecimal.valueOf(shopCreationPrice),NameManager.getServerEconomyAccount().getUuid(),player.getWorld());
    ChestShop.callEvent(currencyAddEvent);
  }
  player.sendMessage(Messages.prefix(Messages.SHOP_FEE_PAID.replace("String_Node_Str",Economy.formatBalance(shopCreationPrice))));
}
Program: 178063
Project: 178063
Buggy source:
@EventHandler(priority=EventPriority.MONITOR) public static void onShopDestroy(ShopDestroyedEvent event){
  double refundPrice=Properties.SHOP_REFUND_PRICE;
  if (event.getDestroyer() == null || Permission.has(event.getDestroyer(),NOFEE) || refundPrice == 0) {
    return;
  }
  Account account=NameManager.getAccountFromShortName(event.getSign().getLine(NAME_LINE));
  if (account == null) {
    return;
  }
  CurrencyAddEvent currencyEvent=new CurrencyAddEvent(BigDecimal.valueOf(refundPrice),account.getUuid(),event.getSign().getWorld());
  ChestShop.callEvent(currencyEvent);
  if (!Economy.getServerAccountName().isEmpty()) {
    CurrencySubtractEvent currencySubtractEvent=new CurrencySubtractEvent(BigDecimal.valueOf(refundPrice),NameManager.getUUID(Economy.getServerAccountName()),event.getSign().getWorld());
    ChestShop.callEvent(currencySubtractEvent);
  }
  String message=Messages.SHOP_REFUNDED.replace("String_Node_Str",Economy.formatBalance(refundPrice));
  event.getDestroyer().sendMessage(Messages.prefix(message));
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.MONITOR) public static void onShopDestroy(ShopDestroyedEvent event){
  double refundPrice=Properties.SHOP_REFUND_PRICE;
  if (event.getDestroyer() == null || Permission.has(event.getDestroyer(),NOFEE) || refundPrice == 0) {
    return;
  }
  Account account=NameManager.getAccountFromShortName(event.getSign().getLine(NAME_LINE));
  if (account == null) {
    return;
  }
  CurrencyAddEvent currencyEvent=new CurrencyAddEvent(BigDecimal.valueOf(refundPrice),account.getUuid(),event.getSign().getWorld());
  ChestShop.callEvent(currencyEvent);
  if (NameManager.getServerEconomyAccount() != null) {
    CurrencySubtractEvent currencySubtractEvent=new CurrencySubtractEvent(BigDecimal.valueOf(refundPrice),NameManager.getServerEconomyAccount().getUuid(),event.getSign().getWorld());
    ChestShop.callEvent(currencySubtractEvent);
  }
  String message=Messages.SHOP_REFUNDED.replace("String_Node_Str",Economy.formatBalance(refundPrice));
  event.getDestroyer().sendMessage(Messages.prefix(message));
}