nus-yam/ex-repair huggingface dataset:
Program: 18923
Project: 18923
Buggy source:
@Override protected Object doExecute() throws Exception {
  getComputeService().destroyNode(id);
  return null;
}

Fixed version (ground truth):
@Override protected Object doExecute() throws Exception {
  getComputeService().destroyNode(id);
  cacheProvider.getProviderCacheForType(Constants.ACTIVE_NODE_CACHE).remove(getComputeService().getContext().getProviderSpecificContext().getId(),id);
  cacheProvider.getProviderCacheForType(Constants.INACTIVE_NODE_CACHE).remove(getComputeService().getContext().getProviderSpecificContext().getId(),id);
  cacheProvider.getProviderCacheForType(Constants.SUSPENDED_NODE_CACHE).remove(getComputeService().getContext().getProviderSpecificContext().getId(),id);
  return null;
}
Program: 18924
Project: 18924
Buggy source:
@Override protected Object doExecute() throws Exception {
  printNodes(getComputeService().listNodes(),"String_Node_Str",System.out);
  return null;
}

Fixed version (ground truth):
@Override protected Object doExecute() throws Exception {
  printNodes(getComputeService().listNodes(),"String_Node_Str",System.out);
  for (  ComputeMetadata node : getComputeService().listNodes()) {
    if (node instanceof NodeMetadata) {
      NodeMetadata metadata=(NodeMetadata)node;
      if (metadata.getState().equals(NodeState.RUNNING)) {
        cacheProvider.getProviderCacheForType(Constants.ACTIVE_NODE_CACHE).put(getComputeService().getContext().getProviderSpecificContext().getId(),node.getId());
        cacheProvider.getProviderCacheForType(Constants.INACTIVE_NODE_CACHE).remove(getComputeService().getContext().getProviderSpecificContext().getId(),node.getId());
        cacheProvider.getProviderCacheForType(Constants.SUSPENDED_NODE_CACHE).remove(getComputeService().getContext().getProviderSpecificContext().getId(),node.getId());
      }
 else       if (metadata.getState().equals(NodeState.SUSPENDED)) {
        cacheProvider.getProviderCacheForType(Constants.ACTIVE_NODE_CACHE).remove(getComputeService().getContext().getProviderSpecificContext().getId(),node.getId());
        cacheProvider.getProviderCacheForType(Constants.INACTIVE_NODE_CACHE).put(getComputeService().getContext().getProviderSpecificContext().getId(),node.getId());
        cacheProvider.getProviderCacheForType(Constants.SUSPENDED_NODE_CACHE).put(getComputeService().getContext().getProviderSpecificContext().getId(),node.getId());
      }
 else       if (metadata.getState().equals(NodeState.TERMINATED)) {
        cacheProvider.getProviderCacheForType(Constants.ACTIVE_NODE_CACHE).remove(getComputeService().getContext().getProviderSpecificContext().getId(),node.getId());
        cacheProvider.getProviderCacheForType(Constants.INACTIVE_NODE_CACHE).remove(getComputeService().getContext().getProviderSpecificContext().getId(),node.getId());
        cacheProvider.getProviderCacheForType(Constants.SUSPENDED_NODE_CACHE).remove(getComputeService().getContext().getProviderSpecificContext().getId(),node.getId());
      }
 else {
        cacheProvider.getProviderCacheForType(Constants.ACTIVE_NODE_CACHE).remove(getComputeService().getContext().getProviderSpecificContext().getId(),node.getId());
      }
    }
  }
  return null;
}
Program: 18925
Project: 18925
Buggy source:
public void init(){
  cache=cacheProvider.getProviderCacheForType("String_Node_Str");
}

Fixed version (ground truth):
public void init(){
  cache=cacheProvider.getProviderCacheForType(Constants.GROUP);
}
Program: 18926
Project: 18926
Buggy source:
public void init(){
  cache=cacheProvider.getProviderCacheForType("String_Node_Str");
}

Fixed version (ground truth):
public void init(){
  cache=cacheProvider.getProviderCacheForType(Constants.HARDWARE_CACHE);
}
Program: 18927
Project: 18927
Buggy source:
public void init(){
  cache=cacheProvider.getProviderCacheForType("String_Node_Str");
}

Fixed version (ground truth):
public void init(){
  cache=cacheProvider.getProviderCacheForType(Constants.IMAGE_CACHE);
}
Program: 18928
Project: 18928
Buggy source:
public void init(){
  cache=cacheProvider.getProviderCacheForType("String_Node_Str");
}

Fixed version (ground truth):
public void init(){
  cache=cacheProvider.getProviderCacheForType(Constants.LOCATION_CACHE);
}
Program: 18929
Project: 18929
Buggy source:
public void init(){
  cache=cacheProvider.getProviderCacheForType("String_Node_Str");
}

Fixed version (ground truth):
public void init(){
  cache=cacheProvider.getProviderCacheForType(Constants.NODE_CACHE);
}
Program: 18932
Project: 18932
Buggy source:
public void addShowcase(ShowcaseItem item){
  if (item.isChunkLoaded() && item.getItem() != null) {
    itemsByDrop.put(item.getItem().getEntityId(),item);
  }
  showcasedItems.add(item);
}

Fixed version (ground truth):
public void addShowcase(ShowcaseItem item){
  if (item.isChunkLoaded() && item.getItem() != null) {
    itemsByDrop.put(item.getItem().getEntityId(),item);
  }
  itemsByBlock.put(item.getBlock(),item);
  showcasedItems.add(item);
}
Program: 18933
Project: 18933
Buggy source:
public ShowcaseItem getItemByBlock(Block b){
  for (  ShowcaseItem item : showcasedItems) {
    if (b.equals(item.getBlock())) {
      return item;
    }
  }
  return null;
}

Fixed version (ground truth):
public ShowcaseItem getItemByBlock(Block b){
  return itemsByBlock.get(b);
}
Program: 18934
Project: 18934
Buggy source:
public void removeShowcase(ShowcaseItem showItem){
  itemsByDrop.remove(showItem.getItem().getEntityId());
  showcasedItems.remove(showItem);
}

Fixed version (ground truth):
public void removeShowcase(ShowcaseItem showItem){
  itemsByBlock.remove(showItem.getBlock());
  itemsByDrop.remove(showItem.getItem().getEntityId());
  showcasedItems.remove(showItem);
}
Program: 18935
Project: 18935
Buggy source:
@Override public void onBlockBreak(BlockBreakEvent event){
  if (!event.getBlock().getType().equals(Material.STEP)) {
    return;
  }
  ShowcaseItem item=Showcase.instance.getItemByBlock(event.getBlock());
  if (item != null) {
    event.setCancelled(true);
    event.getPlayer().sendMessage(Showcase.tr("String_Node_Str",item.getPlayer()));
  }
  if (event.isCancelled()) {
    event.getPlayer().sendBlockChange(event.getBlock().getLocation(),event.getBlock().getType(),event.getBlock().getData());
  }
}

Fixed version (ground truth):
@Override public void onBlockBreak(BlockBreakEvent event){
  if (!event.getBlock().getType().equals(Material.STEP)) {
    return;
  }
  ShowcaseItem item=Showcase.instance.getItemByBlock(event.getBlock());
  if (item != null) {
    event.setCancelled(true);
    event.getPlayer().sendMessage(Showcase.tr("String_Node_Str",item.getPlayer()));
  }
  if (event.isCancelled()) {
    event.getPlayer().sendBlockChange(event.getBlock().getLocation(),event.getBlock().getType(),event.getBlock().getData());
    if (item != null) {
      item.getItem().setVelocity(new Vector(0,0.2,0));
    }
  }
}
Program: 18936
Project: 18936
Buggy source:
@Override public boolean onDestroy(ShowcasePlayer player){
  ShowcasePlayer owner=ShowcasePlayer.getPlayer(item.getPlayer());
  owner.addItems(item.getMaterial(),item.getData(),itemAmount);
  return true;
}

Fixed version (ground truth):
@Override public boolean onDestroy(ShowcasePlayer player){
  ShowcasePlayer owner=ShowcasePlayer.getPlayer(item.getPlayer());
  owner.addItems(item.getMaterial(),item.getData(),itemAmount);
  itemAmount=0;
  return true;
}
Program: 18937
Project: 18937
Buggy source:
public void load(){
  disabledTypes.clear();
  showcaseProtection=reader.getBoolean("String_Node_Str",true);
  priceForBasic=reader.getDouble("String_Node_Str",0);
  priceForFiniteShop=reader.getDouble("String_Node_Str",0);
  basicMode=reader.getBoolean("String_Node_Str",false);
  priceForExchangeShop=reader.getDouble("String_Node_Str",0);
  removeWhenEmpty=reader.getBoolean("String_Node_Str",false);
  locale=reader.getString("String_Node_Str","String_Node_Str");
  autoSaveInterval=reader.getInteger("String_Node_Str",60);
  maxStackSize.clear();
  loadMaxStackSize();
  String list=reader.getString("String_Node_Str","String_Node_Str");
  String items[]=list.split("String_Node_Str");
  for (  String item : items) {
    disabledTypes.add(item);
  }
}

Fixed version (ground truth):
public void load(){
  disabledTypes.clear();
  showcaseProtection=reader.getBoolean("String_Node_Str",true);
  priceForBasic=reader.getDouble("String_Node_Str",0);
  priceForFiniteShop=reader.getDouble("String_Node_Str",0);
  basicMode=reader.getBoolean("String_Node_Str",false);
  priceForExchangeShop=reader.getDouble("String_Node_Str",0);
  removeWhenEmpty=reader.getBoolean("String_Node_Str",false);
  locale=reader.getString("String_Node_Str","String_Node_Str");
  autoSaveInterval=reader.getInteger("String_Node_Str",60);
  showAutosaveNotification=reader.getBoolean("String_Node_Str",false);
  maxStackSize.clear();
  loadMaxStackSize();
  String list=reader.getString("String_Node_Str","String_Node_Str");
  String items[]=list.split("String_Node_Str");
  for (  String item : items) {
    disabledTypes.add(item);
  }
}
Program: 18938
Project: 18938
Buggy source:
@Override public void run(){
  for (  ShowcaseItem item : ShowcaseMain.instance.showcasedItems) {
    if (item.getItem() == null || item.getItem().isDead()) {
      item.respawn();
    }
    item.updatePosition();
    if (item.getMaterial().equals(Material.TORCH)) {
      int x, y, z;
      x=item.getBlock().getX();
      y=item.getBlock().getY();
      z=item.getBlock().getZ();
      CraftWorld world=(CraftWorld)item.getBlock().getWorld();
      world.getHandle().b(EnumSkyBlock.BLOCK,x,y,z,14);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  for (  ShowcaseItem item : ShowcaseMain.instance.showcasedItems) {
    if (item.getItem() == null || item.getItem().isDead()) {
      item.respawn();
    }
    item.updatePosition();
  }
}
Program: 18939
Project: 18939
Buggy source:
public ShowcaseCreationAssistant(Player p,ItemStack item,Location loc){
  super(p);
  player=ShowcasePlayer.getPlayer(getPlayer());
  setTitle(ShowcaseMain.tr("String_Node_Str"));
  ShowcaseTypeSelectionPage page=new ShowcaseTypeSelectionPage(player,this);
  page.assistant=this;
  addPage(page);
  material=item.getType();
  data=item.getDurability();
  this.loc=loc;
}

Fixed version (ground truth):
public ShowcaseCreationAssistant(Player p,ItemStack item,Location loc){
  super(p);
  player=ShowcasePlayer.getPlayer(getPlayer());
  setTitle(ShowcaseMain.tr("String_Node_Str"));
  ShowcaseTypeSelectionPage typeSelectionPage=new ShowcaseTypeSelectionPage(player,this);
  typeSelectionPage.assistant=this;
  if (item == null) {
    addPage(new AssistantPage(this){
{
        setTitle(ShowcaseMain.tr("String_Node_Str"));
        setText(ShowcaseMain.tr("String_Node_Str"));
      }
      @Override public AssistantAction onPageInput(      String text){
        ItemStack result=null;
        OddItem odd=(OddItem)Bukkit.getServer().getPluginManager().getPlugin("String_Node_Str");
        try {
          result=odd.getItemStack(text);
        }
 catch (        IllegalArgumentException e) {
          sendMessage(formatLine(ShowcaseMain.tr("String_Node_Str",e.getMessage())));
          return AssistantAction.SILENT_REPEAT;
        }
        material=result.getType();
        data=result.getDurability();
        return AssistantAction.CONTINUE;
      }
    }
);
  }
 else {
    material=item.getType();
    data=item.getDurability();
  }
  addPage(typeSelectionPage);
  this.loc=loc;
}
Program: 18940
Project: 18940
Buggy source:
@Override public void run(){
  save();
  log.log(Level.INFO,"String_Node_Str");
}

Fixed version (ground truth):
@Override public void run(){
  save();
  if (config.isShowingAutosaveNotification()) {
    log.log(Level.INFO,"String_Node_Str");
  }
}
Program: 18943
Project: 18943
Buggy source:
@Override public ShowcaseExtra createShowcase(ShowcaseCreationAssistant assistant){
  return null;
}

Fixed version (ground truth):
@Override public ShowcaseExtra createShowcase(ShowcaseCreationAssistant assistant){
  return new SellShowcaseExtra();
}
Program: 18944
Project: 18944
Buggy source:
@Override public ShowcaseExtra loadShowcase(String values){
  return null;
}

Fixed version (ground truth):
@Override public ShowcaseExtra loadShowcase(String values){
  SellShowcaseExtra extra=new SellShowcaseExtra();
  String args[]=values.split("String_Node_Str");
  if (args.length >= 3) {
    extra.setAmountLeft(Integer.valueOf(args[0]));
    extra.setPricePerItem(Double.valueOf(args[1]));
    extra.setAmountOfItems(Integer.valueOf(args[2]));
    return extra;
  }
  return null;
}
Program: 18948
Project: 18948
Buggy source:
public ShowcaseTypeSelectionPage(ShowcasePlayer player){
  setTitle("String_Node_Str");
  String text="String_Node_Str";
  for (  ShowcaseProvider provider : ShowcaseMain.instance.providers.values()) {
    if (player.hasPermission(provider.getPermission(),provider.isOpMethod())) {
      text+=ChatColor.YELLOW + provider.getType() + ChatColor.WHITE;
      text+="String_Node_Str" + ChatColor.YELLOW + getPrice(provider.getPriceForCreation(player))+ ChatColor.WHITE+ "String_Node_Str";
    }
  }
  text=text.substring(0,text.length() - 2) + "String_Node_Str";
  text+="String_Node_Str";
  setText(text);
}

Fixed version (ground truth):
public ShowcaseTypeSelectionPage(ShowcasePlayer player){
  setTitle("String_Node_Str");
  String text="String_Node_Str";
  for (  ShowcaseProvider provider : ShowcaseMain.instance.providers.values()) {
    if (player.hasPermission(provider.getPermission(),provider.isOpMethod())) {
      text+=ChatColor.YELLOW + provider.getType() + ChatColor.WHITE;
      text+="String_Node_Str" + ChatColor.YELLOW + getPrice(provider.getPriceForCreation(player))+ ChatColor.WHITE+ "String_Node_Str";
    }
  }
  if (text.equals("String_Node_Str")) {
    text="String_Node_Str";
    getAssistant().cancel();
  }
 else {
    text=text.substring(0,text.length() - 2) + "String_Node_Str";
    text+="String_Node_Str";
  }
  setText(text);
}
Program: 18949
Project: 18949
Buggy source:
public static int getVersion(){
  String args[]=version.split("String_Node_Str");
  int result=0;
  for (int i=0; i < args.length; i++) {
    try {
      int v=Integer.valueOf(args[args.length - i - 1]);
      result+=v * Math.pow(i,10);
    }
 catch (    Exception e) {
    }
  }
  System.out.println(version + "String_Node_Str" + result);
  return result;
}

Fixed version (ground truth):
public static int getVersion(){
  return version;
}
Program: 18950
Project: 18950
Buggy source:
private static void load(){
  FlatFileReader reader=new FlatFileReader(file,true);
  for (  String key : reader.keys()) {
    if (!key.equals("String_Node_Str")) {
      String trans=parseColors(reader.getString(key,"String_Node_Str" + key + "String_Node_Str"));
      trans=trans.replaceAll("String_Node_Str","String_Node_Str");
      translations.put(key,trans);
    }
  }
  version=reader.getString("String_Node_Str","String_Node_Str");
}

Fixed version (ground truth):
private static void load(){
  FlatFileReader reader=new FlatFileReader(file,true);
  for (  String key : reader.keys()) {
    if (!key.equals("String_Node_Str")) {
      String trans=parseColors(reader.getString(key,"String_Node_Str" + key + "String_Node_Str"));
      trans=trans.replaceAll("String_Node_Str","String_Node_Str");
      translations.put(key,trans);
    }
  }
  version=reader.getInteger("String_Node_Str",0);
}
Program: 18951
Project: 18951
Buggy source:
@Override public void run(){
  for (  ShowcaseItem item : ShowcaseMain.instance.showcasedItems) {
    Chunk c=item.getBlock().getChunk();
    if (item.getItem().getWorld().isChunkLoaded(c)) {
      if (!item.isChunkLoaded()) {
        for (        Entity e : c.getEntities()) {
          if (e instanceof Item) {
            if (e.getLocation().getBlock().equals(item.getBlock())) {
              item.setItem((Item)e);
              System.out.println("String_Node_Str");
            }
          }
        }
      }
      item.setChunkLoaded(true);
    }
 else {
      item.setChunkLoaded(false);
    }
    if (item.getItem().isDead()) {
      item.respawn();
    }
    item.updatePosition();
  }
}

Fixed version (ground truth):
@Override public void run(){
  for (  ShowcaseItem item : ShowcaseMain.instance.showcasedItems) {
    Chunk c=item.getBlock().getChunk();
    if (c.getWorld().isChunkLoaded(c)) {
      if (!item.isChunkLoaded()) {
        System.out.println("String_Node_Str");
        boolean itemFound=false;
        for (        Entity e : c.getEntities()) {
          if (e instanceof Item) {
            if (e.getLocation().getBlock().equals(item.getBlock())) {
              item.setItem((Item)e);
              System.out.println("String_Node_Str");
              itemFound=true;
              break;
            }
          }
        }
        if (!itemFound) {
          item.respawn();
        }
      }
    }
    item.setChunkLoaded(c.getWorld().isChunkLoaded(c));
    if ((item.getItem() == null || item.getItem().isDead()) && item.isChunkLoaded()) {
      item.respawn();
    }
    item.updatePosition();
  }
}
Program: 18952
Project: 18952
Buggy source:
public void respawn(){
  item.remove();
  ItemStack stack=new ItemStack(getMaterial(),1,getData());
  item=item.getLocation().getWorld().dropItemNaturally(location,stack);
  updatedPosition=false;
}

Fixed version (ground truth):
public void respawn(){
  if (item != null) {
    item.remove();
  }
  ItemStack stack=new ItemStack(getMaterial(),1,getData());
  item=getLocation().getWorld().dropItemNaturally(location,stack);
  updatedPosition=false;
}
Program: 18953
Project: 18953
Buggy source:
public void remove(){
  item.remove();
}

Fixed version (ground truth):
public void remove(){
  checkForDupedItem();
  item.remove();
}
Program: 18954
Project: 18954
Buggy source:
public void updatePosition(){
  if (!updatedPosition || item.getLocation().getY() >= block.getLocation().getBlockY() + 0.5) {
    item.teleport(location);
    item.setVelocity(new Vector(0,0,0));
    updatedPosition=true;
  }
}

Fixed version (ground truth):
public void updatePosition(){
  if (item != null && (!updatedPosition || item.getLocation().getY() >= block.getLocation().getBlockY() + 0.5)) {
    item.teleport(location);
    item.setVelocity(new Vector(0,0,0));
    updatedPosition=true;
  }
}
Program: 18955
Project: 18955
Buggy source:
public ShowcaseItem(Location loc,Material mat,short data,String player,ShowcaseType type,int amount,double price){
  setItem(loc.getWorld().dropItemNaturally(loc,new ItemStack(mat,1,data)));
  setLocation(loc);
  setMaterial(mat);
  setData(data);
  setPlayer(player);
  setType(type);
  setItemAmount(amount);
  setPricePerItem(price);
}

Fixed version (ground truth):
public ShowcaseItem(Location loc,Material mat,short data,String player,ShowcaseType type,int amount,double price){
  setMaterial(mat);
  setData(data);
  setPlayer(player);
  setType(type);
  setItemAmount(amount);
  setPricePerItem(price);
  setBlock(loc.getBlock());
  setChunkLoaded(block.getWorld().isChunkLoaded(block.getChunk()));
  if (isChunkLoaded()) {
    setItem(loc.getWorld().dropItemNaturally(loc,new ItemStack(mat,1,data)));
    setLocation(loc);
    checkForDupedItem();
  }
 else {
    location=loc;
    setItem(null);
    System.out.println("String_Node_Str");
  }
}
Program: 18957
Project: 18957
Buggy source:
public void addShowcase(Location loc,Material material,short data,Player owner,ShowcaseType type,int amount,double price){
  ItemStack stack=new ItemStack(material,1,data);
  Item item=loc.getWorld().dropItemNaturally(loc,stack);
  ShowcaseItem shit=new ShowcaseItem(item,loc,owner.getName());
  ShowcaseMain.instance.showcasedItems.add(shit);
  shit.setItemAmount(amount);
  shit.setPricePerItem(price);
  shit.setType(type);
}

Fixed version (ground truth):
public void addShowcase(Location loc,Material material,short data,Player owner,ShowcaseType type,int amount,double price){
  ShowcaseItem shit=new ShowcaseItem(loc,material,data,owner.getName(),type,amount,price);
  ShowcaseMain.instance.showcasedItems.add(shit);
}
Program: 18958
Project: 18958
Buggy source:
public void remove(){
  if (type.equals(ShowcaseType.FINITE_SHOP)) {
    ShowcasePlayer player=ShowcasePlayer.getPlayer(this.player);
    ItemStack stack=item.getItemStack().clone();
    stack.setAmount(itemAmount);
    player.getPlayer().getInventory().addItem(stack);
  }
  item.remove();
}

Fixed version (ground truth):
public void remove(){
  item.remove();
}
Program: 18959
Project: 18959
Buggy source:
@Override public void onEnable(){
  instance=this;
  log=getServer().getLogger();
  try {
    dclistener=new DropChestListener();
  }
 catch (  NoClassDefFoundError e) {
    dclistener=null;
  }
  PluginDescriptionFile pdfFile=this.getDescription();
  log.log(Level.INFO,pdfFile.getName() + "String_Node_Str" + pdfFile.getVersion()+ "String_Node_Str");
  PluginManager pm=getServer().getPluginManager();
  pm.registerEvent(Type.PLAYER_INTERACT,playerListener,Priority.Normal,this);
  pm.registerEvent(Type.PLAYER_PICKUP_ITEM,playerListener,Priority.Normal,this);
  pm.registerEvent(Type.BLOCK_BREAK,blockListener,Priority.Low,this);
  pm.registerEvent(Type.PLAYER_CHAT,playerListener,Priority.Normal,this);
  pm.registerEvent(Type.PLUGIN_ENABLE,serverListener,Priority.Normal,this);
  pm.registerEvent(Type.PLUGIN_DISABLE,serverListener,Priority.Normal,this);
  if (dclistener != null) {
    pm.registerEvent(Type.CUSTOM_EVENT,dclistener,Priority.Normal,this);
  }
  getServer().getScheduler().scheduleSyncRepeatingTask(this,watcher,0,10);
  load();
  setupPermissions();
}

Fixed version (ground truth):
@Override public void onEnable(){
  instance=this;
  log=getServer().getLogger();
  try {
    dclistener=new DropChestListener();
  }
 catch (  NoClassDefFoundError e) {
    dclistener=null;
  }
  PluginDescriptionFile pdfFile=this.getDescription();
  log.log(Level.INFO,pdfFile.getName() + "String_Node_Str" + pdfFile.getVersion()+ "String_Node_Str");
  PluginManager pm=getServer().getPluginManager();
  pm.registerEvent(Type.PLAYER_INTERACT,playerListener,Priority.Normal,this);
  pm.registerEvent(Type.PLAYER_PICKUP_ITEM,playerListener,Priority.Normal,this);
  pm.registerEvent(Type.BLOCK_BREAK,blockListener,Priority.Low,this);
  pm.registerEvent(Type.PLAYER_CHAT,playerListener,Priority.Normal,this);
  pm.registerEvent(Type.PLUGIN_ENABLE,serverListener,Priority.Normal,this);
  pm.registerEvent(Type.PLUGIN_DISABLE,serverListener,Priority.Normal,this);
  if (dclistener != null) {
    pm.registerEvent(Type.CUSTOM_EVENT,dclistener,Priority.Normal,this);
  }
  getServer().getScheduler().scheduleSyncRepeatingTask(this,watcher,0,10);
  for (  World w : getServer().getWorlds()) {
    for (    Entity e : w.getEntities()) {
      if (e instanceof Item) {
        Location loc=e.getLocation();
        Block b=loc.getBlock();
        if (b.getType().equals(Material.GLASS)) {
          e.remove();
        }
      }
    }
  }
  load();
  setupPermissions();
}
Program: 18960
Project: 18960
Buggy source:
public void remove(Material mat,short data,int amount){
  Inventory inv=getPlayer().getInventory();
  for (int i=0; i < inv.getSize(); i++) {
    ItemStack stack=inv.getItem(i);
    if (stack.getType().equals(mat) && stack.getDurability() == data) {
      if (stack.getAmount() >= amount) {
        stack.setAmount(stack.getAmount() - amount);
        inv.setItem(i,stack);
        return;
      }
 else {
        amount-=stack.getAmount();
        inv.setItem(i,null);
      }
    }
  }
}

Fixed version (ground truth):
public void remove(Material mat,short data,int amount){
  Inventory inv=getPlayer().getInventory();
  for (int i=0; i < inv.getSize(); i++) {
    ItemStack stack=inv.getItem(i).clone();
    if (stack.getType().equals(mat) && stack.getDurability() == data) {
      if (stack.getAmount() > amount) {
        stack.setAmount(stack.getAmount() - amount);
        inv.setItem(i,stack);
        return;
      }
 else {
        amount-=stack.getAmount();
        inv.setItem(i,null);
      }
    }
  }
}
Program: 18961
Project: 18961
Buggy source:
public void printAmountMenu(Player p){
  ShowcasePlayer player=ShowcasePlayer.getPlayer(p);
  ShowcaseType type=player.getRequestedType();
  String print=ChatColor.YELLOW + "String_Node_Str" + player.getRequestedPrice()+ ChatColor.YELLOW+ "String_Node_Str";
  print+=ChatColor.YELLOW + "String_Node_Str";
  print+=ChatColor.YELLOW + "String_Node_Str" + ChatColor.WHITE;
  ItemStack stack=player.getRequestedItem();
  print+=player.getAmountOfType(stack.getType(),stack.getDurability());
  print+=ChatColor.YELLOW + "String_Node_Str" + ChatColor.WHITE+ stack.getType()+ ChatColor.YELLOW+ "String_Node_Str";
  player.sendMessage(print);
}

Fixed version (ground truth):
public void printAmountMenu(Player p){
  ShowcasePlayer player=ShowcasePlayer.getPlayer(p);
  String print=ChatColor.YELLOW + "String_Node_Str" + player.getRequestedPrice()+ ChatColor.YELLOW+ "String_Node_Str";
  print+=ChatColor.YELLOW + "String_Node_Str";
  print+=ChatColor.YELLOW + "String_Node_Str" + ChatColor.WHITE;
  ItemStack stack=player.getRequestedItem();
  print+=player.getAmountOfType(stack.getType(),stack.getDurability());
  print+=ChatColor.YELLOW + "String_Node_Str" + ChatColor.WHITE+ stack.getType()+ ChatColor.YELLOW+ "String_Node_Str";
  player.sendMessage(print);
}
Program: 18963
Project: 18963
Buggy source:
public void updatePosition(){
  if (!updatedPosition) {
    item.teleport(location);
    item.setVelocity(new Vector(0,0,0));
    updatedPosition=true;
  }
}

Fixed version (ground truth):
public void updatePosition(){
  if (!updatedPosition || item.getLocation().getY() >= block.getLocation().getBlockY() + 0.5) {
    item.teleport(location);
    item.setVelocity(new Vector(0,0,0));
    updatedPosition=true;
  }
}
Program: 18964
Project: 18964
Buggy source:
/** 
 * @param location the location to set
 */
public void setLocation(Location location){
  Vector vec=location.toVector();
  vec.add(new Vector(0.5,0.1,0.5));
  location=vec.toLocation(location.getWorld());
  this.location=location;
  item.teleport(location);
}

Fixed version (ground truth):
/** 
 * @param location the location to set
 */
public void setLocation(Location location){
  Vector vec=location.toVector();
  vec.add(new Vector(0.5,0.0,0.5));
  location=vec.toLocation(location.getWorld());
  this.location=location;
  item.teleport(location);
}
Program: 18966
Project: 18966
Buggy source:
@Override public ScheduledFuture<?> scheduleAtFixedRate(Runnable command,long initialDelay,long period,TimeUnit unit){
  return super.scheduleAtFixedRate(wrapRunnable(command),initialDelay,period,unit);
}

Fixed version (ground truth):
@Override public ScheduledFuture<?> scheduleAtFixedRate(Runnable command,long initialDelay,long period,TimeUnit unit){
  return super.scheduleAtFixedRate(WrappedRunnable.wrap(LOG,command),initialDelay,period,unit);
}
Program: 18967
Project: 18967
Buggy source:
@Override public ScheduledFuture<?> schedule(Runnable command,long delay,TimeUnit unit){
  return super.schedule(wrapRunnable(command),delay,unit);
}

Fixed version (ground truth):
@Override public ScheduledFuture<?> schedule(Runnable command,long delay,TimeUnit unit){
  return super.schedule(WrappedRunnable.wrap(LOG,command),delay,unit);
}
Program: 18968
Project: 18968
Buggy source:
@Override public Future<?> submit(Runnable task){
  return super.submit(wrapRunnable(task));
}

Fixed version (ground truth):
@Override public Future<?> submit(Runnable task){
  return super.submit(WrappedRunnable.wrap(LOG,task));
}
Program: 18969
Project: 18969
Buggy source:
@Override public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command,long initialDelay,long delay,TimeUnit unit){
  return super.scheduleWithFixedDelay(wrapRunnable(command),initialDelay,delay,unit);
}

Fixed version (ground truth):
@Override public ScheduledFuture<?> scheduleWithFixedDelay(Runnable command,long initialDelay,long delay,TimeUnit unit){
  return super.scheduleWithFixedDelay(WrappedRunnable.wrap(LOG,command),initialDelay,delay,unit);
}
Program: 18970
Project: 18970
Buggy source:
@Override public void execute(Runnable command){
  super.execute(wrapRunnable(command));
}

Fixed version (ground truth):
@Override public void execute(Runnable command){
  super.execute(WrappedRunnable.wrap(LOG,command));
}
Program: 18971
Project: 18971
Buggy source:
@Override public Future<?> submit(Runnable task){
  return super.submit(wrapRunnable(task));
}

Fixed version (ground truth):
@Override public Future<?> submit(Runnable task){
  return super.submit(WrappedRunnable.wrap(LOG,task));
}
Program: 18972
Project: 18972
Buggy source:
@Override public void execute(Runnable command){
  super.execute(wrapRunnable(command));
}

Fixed version (ground truth):
@Override public void execute(Runnable command){
  super.execute(WrappedRunnable.wrap(LOG,command));
}
Program: 18973
Project: 18973
Buggy source:
/** 
 * Set the menu's autosave status - will menus be automatically saved to disk when modified?
 * @param autosave	true or false
 * @return			the previous autosave status - true or false
 * @deprecated method is a no-op now, autosave is always true
 */
@Deprecated public boolean setAutosave(boolean autosave){
  return true;
}

Fixed version (ground truth):
/** 
 * Set the menu's autosave status - will menus be automatically saved to disk when modified?
 * @param autosave	true or false
 * @return			the previous autosave status - true or false
 */
public boolean setAutosave(boolean autosave){
  boolean prevAutosave=this.autosave;
  this.autosave=autosave;
  if (autosave) {
    autosave();
  }
  return prevAutosave;
}
Program: 18974
Project: 18974
Buggy source:
public void setAttribute(String k,String val) throws SMSException {
  if (!attributes.contains(k)) {
    throw new SMSException("String_Node_Str" + k);
  }
  attributes.set(k,val);
}

Fixed version (ground truth):
public void setAttribute(String k,String val){
  if (!attributes.contains(k)) {
    throw new SMSException("String_Node_Str" + k);
  }
  attributes.set(k,val);
}
Program: 18975
Project: 18975
Buggy source:
/** 
 * Temporarily delete a menu.  The menu object is dereferenced but saved menu data is not  deleted from disk.
 */
void deleteTemporary(){
  try {
    SMSMenu.unregisterMenu(getName());
    notifyObservers(SMSMenuAction.DELETE_TEMP);
  }
 catch (  SMSException e) {
    LogUtils.warning("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Temporarily delete a menu.  The menu object is dereferenced but saved menu data is not  deleted from disk.
 */
void deleteTemporary(){
  try {
    SMSMenu.unregisterMenu(getName());
    notifyObservers(SMSMenuAction.DELETE_TEMP);
  }
 catch (  SMSException e) {
    LogUtils.warning("String_Node_Str" + e.getMessage());
  }
}
Program: 18976
Project: 18976
Buggy source:
/** 
 * Retrieve the menu with the given name
 * @param menuName	The name of the menu to retrieve
 * @return	The menu object
 * @throws SMSException if the menu name is not found
 */
public static SMSMenu getMenu(String menuName) throws SMSException {
  if (!menus.containsKey(menuName))   throw new SMSException("String_Node_Str" + menuName + "String_Node_Str");
  return menus.get(menuName);
}

Fixed version (ground truth):
/** 
 * Retrieve the menu with the given name.
 * @param menuName	The name of the menu to retrieve
 * @return	The menu object
 * @throws SMSException if the menu name is not found
 */
public static SMSMenu getMenu(String menuName){
  if (!menus.containsKey(menuName))   throw new SMSException("String_Node_Str" + menuName + "String_Node_Str");
  return menus.get(menuName);
}
Program: 18977
Project: 18977
Buggy source:
public void autosave(){
  if (SMSMenu.checkForMenu(getName()))   SMSPersistence.save(this);
}

Fixed version (ground truth):
public void autosave(){
  if (SMSMenu.checkForMenu(getName()) && isAutosave()) {
    SMSPersistence.save(this);
  }
}
Program: 18978
Project: 18978
Buggy source:
/** 
 * Remove a menu from the list, destroying the reference to it.
 * @param menuName	The menu's name
 * @param action	Action to take on removal
 * @throws SMSException
 */
static void unregisterMenu(String menuName) throws SMSException {
  menus.remove(menuName);
}

Fixed version (ground truth):
/** 
 * Remove a menu from the list, destroying the reference to it.
 * @param menuName	The menu's name
 * @param action	Action to take on removal
 * @throws SMSException
 */
static void unregisterMenu(String menuName){
  deletedMenus.put(menuName,getMenu(menuName));
  menus.remove(menuName);
}
Program: 18979
Project: 18979
Buggy source:
/** 
 * Get the menu's autosave status - will menus be automatically saved to disk when modified?
 * @return	true or false
 * @deprecated always true now, not necessary to use anymore
 */
@Deprecated public boolean isAutosave(){
  return true;
}

Fixed version (ground truth):
/** 
 * Get the menu's autosave status - will menus be automatically saved to disk when modified?
 * @return	true or false
 */
public boolean isAutosave(){
  return autosave;
}
Program: 18980
Project: 18980
Buggy source:
/** 
 * Get the menu at the given location
 * @param loc	The location
 * @return	The menu object
 * @throws SMSException if there is no menu sign at the location
 */
static SMSMenu getMenuAt(Location loc) throws SMSException {
  return getMenu(getMenuNameAt(loc));
}

Fixed version (ground truth):
/** 
 * Get the menu at the given location
 * @param loc	The location
 * @return	The menu object
 * @throws SMSException if there is no menu sign at the location
 */
static SMSMenu getMenuAt(Location loc){
  return getMenu(getMenuNameAt(loc));
}
Program: 18981
Project: 18981
Buggy source:
/** 
 * Cause the views on all menus to be redrawn
 */
public static void updateAllMenus(){
  for (  SMSMenu menu : listMenus()) {
    menu.notifyObservers(SMSMenuAction.REPAINT);
  }
}

Fixed version (ground truth):
/** 
 * Force the views on all menus to be redrawn.
 */
public static void updateAllMenus(){
  for (  SMSMenu menu : listMenus()) {
    menu.notifyObservers(SMSMenuAction.REPAINT);
  }
}
Program: 18983
Project: 18983
Buggy source:
/** 
 * Permanently delete a menu, dereferencing the object and removing saved data from disk.
 */
void deletePermanent(){
  try {
    setChanged();
    notifyObservers(SMSMenuAction.DELETE_PERM);
    SMSMenu.unregisterMenu(getName());
    SMSPersistence.unPersist(this);
  }
 catch (  SMSException e) {
    LogUtils.warning("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Permanently delete a menu, dereferencing the object and removing saved data from disk.
 */
void deletePermanent(){
  try {
    setChanged();
    notifyObservers(SMSMenuAction.DELETE_PERM);
    SMSMenu.unregisterMenu(getName());
    SMSPersistence.unPersist(this);
  }
 catch (  SMSException e) {
    LogUtils.warning("String_Node_Str" + e.getMessage());
  }
}
Program: 18984
Project: 18984
Buggy source:
private void registerCommands(){
  cmds.registerCommand(new AddItemCommand());
  cmds.registerCommand(new AddMacroCommand());
  cmds.registerCommand(new AddViewCommand());
  cmds.registerCommand(new CreateMenuCommand());
  cmds.registerCommand(new DeleteMenuCommand());
  cmds.registerCommand(new EditMenuCommand());
  cmds.registerCommand(new FontCommand());
  cmds.registerCommand(new GetConfigCommand());
  cmds.registerCommand(new GiveCommand());
  cmds.registerCommand(new ItemUseCommand());
  cmds.registerCommand(new ListMacroCommand());
  cmds.registerCommand(new ListMenusCommand());
  cmds.registerCommand(new MenuCommand());
  cmds.registerCommand(new PageCommand());
  cmds.registerCommand(new ReloadCommand());
  cmds.registerCommand(new RemoveItemCommand());
  cmds.registerCommand(new RemoveMacroCommand());
  cmds.registerCommand(new RemoveViewCommand());
  cmds.registerCommand(new SaveCommand());
  cmds.registerCommand(new SetConfigCommand());
  cmds.registerCommand(new VarCommand());
  cmds.registerCommand(new ViewCommand());
}

Fixed version (ground truth):
private void registerCommands(){
  cmds.registerCommand(new AddItemCommand());
  cmds.registerCommand(new AddMacroCommand());
  cmds.registerCommand(new AddViewCommand());
  cmds.registerCommand(new CreateMenuCommand());
  cmds.registerCommand(new DeleteMenuCommand());
  cmds.registerCommand(new EditMenuCommand());
  cmds.registerCommand(new FontCommand());
  cmds.registerCommand(new GetConfigCommand());
  cmds.registerCommand(new GiveCommand());
  cmds.registerCommand(new ItemUseCommand());
  cmds.registerCommand(new ListMacroCommand());
  cmds.registerCommand(new ListMenusCommand());
  cmds.registerCommand(new MenuCommand());
  cmds.registerCommand(new PageCommand());
  cmds.registerCommand(new ReloadCommand());
  cmds.registerCommand(new RemoveItemCommand());
  cmds.registerCommand(new RemoveMacroCommand());
  cmds.registerCommand(new RemoveViewCommand());
  cmds.registerCommand(new SaveCommand());
  cmds.registerCommand(new SetConfigCommand());
  cmds.registerCommand(new UndeleteMenuCommand());
  cmds.registerCommand(new VarCommand());
  cmds.registerCommand(new ViewCommand());
}
Program: 18985
Project: 18985
Buggy source:
@Override public boolean execute(Plugin plugin,CommandSender sender,String[] args){
  String menuName=args[0];
  SMSMenu menu=SMSMenu.getMenu(menuName);
  if (args.length < 3 && menu.getDefaultCommand().isEmpty()) {
    throw new SMSException(getUsage()[0]);
  }
  menu.ensureAllowedToModify(sender);
  int pos=hasOption("String_Node_Str") ? getIntOption("String_Node_Str") : -1;
  String label=MiscUtil.parseColourSpec(sender,args[1]);
  String cmd=args.length >= 3 ? args[2] : "String_Node_Str";
  String msg=hasOption("String_Node_Str") ? getStringOption("String_Node_Str") : "String_Node_Str";
  String iconMat=hasOption("String_Node_Str") ? getStringOption("String_Node_Str") : plugin.getConfig().getString("String_Node_Str","String_Node_Str");
  String[] lore=hasOption("String_Node_Str") ? getStringOption("String_Node_Str").split("String_Node_Str") : new String[0];
  if (sender instanceof Player && !new CommandParser().verifyCreationPerms((Player)sender,cmd)) {
    throw new SMSException("String_Node_Str");
  }
  SMSMenuItem newItem=new SMSMenuItem(menu,label,cmd,msg,iconMat,lore);
  if (pos < 0) {
    menu.addItem(newItem);
    MiscUtil.statusMessage(sender,"String_Node_Str" + label + "String_Node_Str"+ menuName);
  }
 else {
    menu.insertItem(pos,newItem);
    int actualPos=menu.indexOfItem(label);
    MiscUtil.statusMessage(sender,"String_Node_Str" + label + "String_Node_Str"+ menuName+ "String_Node_Str"+ actualPos);
  }
  menu.notifyObservers(SMSMenuAction.REPAINT);
  return true;
}

Fixed version (ground truth):
@Override public boolean execute(Plugin plugin,CommandSender sender,String[] args){
  String menuName=args[0];
  SMSMenu menu=getMenu(sender,menuName);
  if (args.length < 3 && menu.getDefaultCommand().isEmpty()) {
    throw new SMSException(getUsage()[0]);
  }
  menu.ensureAllowedToModify(sender);
  int pos=hasOption("String_Node_Str") ? getIntOption("String_Node_Str") : -1;
  String label=MiscUtil.parseColourSpec(sender,args[1]);
  String cmd=args.length >= 3 ? args[2] : "String_Node_Str";
  String msg=hasOption("String_Node_Str") ? getStringOption("String_Node_Str") : "String_Node_Str";
  String iconMat=hasOption("String_Node_Str") ? getStringOption("String_Node_Str") : plugin.getConfig().getString("String_Node_Str","String_Node_Str");
  String[] lore=hasOption("String_Node_Str") ? getStringOption("String_Node_Str").split("String_Node_Str") : new String[0];
  if (sender instanceof Player && !new CommandParser().verifyCreationPerms((Player)sender,cmd)) {
    throw new SMSException("String_Node_Str");
  }
  SMSMenuItem newItem=new SMSMenuItem(menu,label,cmd,msg,iconMat,lore);
  if (pos < 0) {
    menu.addItem(newItem);
    MiscUtil.statusMessage(sender,"String_Node_Str" + label + "String_Node_Str"+ menu.getName());
  }
 else {
    menu.insertItem(pos,newItem);
    int actualPos=menu.indexOfItem(label);
    MiscUtil.statusMessage(sender,"String_Node_Str" + label + "String_Node_Str"+ menu.getName()+ "String_Node_Str"+ actualPos);
  }
  menu.notifyObservers(SMSMenuAction.REPAINT);
  return true;
}
Program: 18988
Project: 18988
Buggy source:
@Override public boolean execute(Plugin plugin,CommandSender sender,String[] args) throws SMSException {
  SMSHandler handler=((ScrollingMenuSign)plugin).getHandler();
  SMSMenu menu=null;
  if (args.length > 0) {
    menu=handler.getMenu(args[0]);
  }
 else {
    notFromConsole(sender);
    Player player=(Player)sender;
    SMSView view=SMSView.getTargetedView(player,true);
    menu=view.getActiveMenu(player.getName());
  }
  menu.ensureAllowedToModify(sender);
  handler.deleteMenu(menu.getName());
  MiscUtil.statusMessage(sender,"String_Node_Str" + menu.getName());
  return true;
}

Fixed version (ground truth):
@Override public boolean execute(Plugin plugin,CommandSender sender,String[] args) throws SMSException {
  SMSHandler handler=((ScrollingMenuSign)plugin).getHandler();
  SMSMenu menu=null;
  if (args.length > 0) {
    menu=getMenu(sender,args[0]);
  }
 else {
    notFromConsole(sender);
    Player player=(Player)sender;
    SMSView view=SMSView.getTargetedView(player,true);
    menu=view.getActiveMenu(player.getName());
  }
  menu.ensureAllowedToModify(sender);
  handler.deleteMenu(menu.getName());
  MiscUtil.statusMessage(sender,"String_Node_Str" + menu.getName() + "String_Node_Str"+ menu.getName()+ "String_Node_Str");
  return true;
}
Program: 18989
Project: 18989
Buggy source:
@Override public List<String> onTabComplete(Plugin plugin,CommandSender sender,String[] args){
switch (args.length) {
case 1:
    return getMenuCompletions(plugin,sender,args[0]);
case 2:
  SMSMenu menu=SMSMenu.getMenu(args[0]);
return getMenuItemCompletions(sender,menu,args[1]);
default :
showUsage(sender);
return noCompletions(sender);
}
}

Fixed version (ground truth):
@Override public List<String> onTabComplete(Plugin plugin,CommandSender sender,String[] args){
switch (args.length) {
case 1:
    return getMenuCompletions(plugin,sender,args[0]);
case 2:
  SMSMenu menu=getMenu(sender,args[0]);
return getMenuItemCompletions(sender,menu,args[1]);
default :
showUsage(sender);
return noCompletions(sender);
}
}
Program: 18991
Project: 18991
Buggy source:
@Override public void pushMenu(String playerName,SMSMenu newActive){
  super.pushMenu(playerName,newActive);
  String menuName=newActive.getName();
  if (playersUsing(menuName).isEmpty()) {
    iconMenus.put(menuName,new IconMenu(this));
  }
  playersUsing(menuName).add(playerName);
}

Fixed version (ground truth):
@Override public void pushMenu(String playerName,SMSMenu newActive){
  super.pushMenu(playerName,newActive);
  String menuName=newActive.getName();
  if (playersUsing(menuName).isEmpty()) {
    iconMenus.put(menuName,new IconMenu(this,menuName));
  }
  playersUsing(menuName).add(playerName);
}
Program: 18992
Project: 18992
Buggy source:
public SMSInventoryView(String name,SMSMenu menu){
  super(name,menu);
  registerAttribute(WIDTH,9,"String_Node_Str");
  registerAttribute(AUTOPOPDOWN,true,"String_Node_Str");
  iconMenus=new HashMap<String,IconMenu>();
  iconMenus.put(getNativeMenu().getName(),new IconMenu(this));
  users=new HashMap<String,Set<String>>();
}

Fixed version (ground truth):
public SMSInventoryView(String name,SMSMenu menu){
  super(name,menu);
  registerAttribute(WIDTH,9,"String_Node_Str");
  registerAttribute(AUTOPOPDOWN,true,"String_Node_Str");
  iconMenus=new HashMap<String,IconMenu>();
  iconMenus.put(getNativeMenu().getName(),new IconMenu(this,getNativeMenu().getName()));
  users=new HashMap<String,Set<String>>();
}
Program: 18993
Project: 18993
Buggy source:
public IconMenu(SMSInventoryView view){
  this.view=view;
  Bukkit.getPluginManager().registerEvents(this,ScrollingMenuSign.getInstance());
}

Fixed version (ground truth):
public IconMenu(SMSInventoryView view,String menuName){
  this.view=view;
  this.menuName=menuName;
  LogUtils.fine("String_Node_Str" + this + "String_Node_Str"+ view.getName());
  Bukkit.getPluginManager().registerEvents(this,ScrollingMenuSign.getInstance());
}
Program: 18994
Project: 18994
Buggy source:
public void destroy(){
  HandlerList.unregisterAll(this);
}

Fixed version (ground truth):
public void destroy(){
  LogUtils.fine("String_Node_Str" + this + "String_Node_Str"+ view.getName());
  HandlerList.unregisterAll(this);
}
Program: 18995
Project: 18995
Buggy source:
@EventHandler(priority=EventPriority.MONITOR) void onInventoryClick(InventoryClickEvent event){
  String playerName=event.getWhoClicked().getName();
  String name=getView().variableSubs(getView().getActiveMenuTitle(playerName));
  if (event.getInventory().getTitle().equals(name)) {
    LogUtils.fine("String_Node_Str" + playerName + "String_Node_Str"+ getView().getName()+ "String_Node_Str"+ event.getInventory().getTitle());
    event.setCancelled(true);
    int slot=event.getRawSlot();
    if (slot >= 0 && slot < size && optionNames[slot] != null) {
      OptionClickEvent optionEvent=new OptionClickEvent((Player)event.getWhoClicked(),getMenuIndexForSlot(slot),optionNames[slot]);
      view.onOptionClick(optionEvent);
      if (optionEvent.willClose()) {
        final Player p=(Player)event.getWhoClicked();
        Bukkit.getScheduler().scheduleSyncDelayedTask(ScrollingMenuSign.getInstance(),new Runnable(){
          public void run(){
            p.closeInventory();
          }
        }
,1);
      }
      if (optionEvent.willDestroy()) {
        destroy();
      }
    }
  }
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.MONITOR) void onInventoryClick(InventoryClickEvent event){
  if (!(event.getWhoClicked() instanceof Player)) {
    return;
  }
  Player player=(Player)event.getWhoClicked();
  String playerName=player.getName();
  String menuTitle=getView().variableSubs(getView().getActiveMenuTitle(playerName));
  String activeMenuName=view.getActiveMenu(playerName).getName();
  if (isPoppedUp(player) && event.getInventory().getTitle().equals(menuTitle) && menuName.equals(activeMenuName)) {
    LogUtils.fine("String_Node_Str" + playerName + "String_Node_Str"+ getView().getName()+ "String_Node_Str"+ event.getInventory().getTitle()+ "String_Node_Str"+ this);
    event.setCancelled(true);
    int slot=event.getRawSlot();
    if (slot >= 0 && slot < size && optionNames[slot] != null) {
      OptionClickEvent optionEvent=new OptionClickEvent((Player)event.getWhoClicked(),getMenuIndexForSlot(slot),optionNames[slot]);
      try {
        view.onOptionClick(optionEvent);
      }
 catch (      SMSException e) {
        if (event.getWhoClicked() instanceof Player) {
          MiscUtil.errorMessage((Player)event.getWhoClicked(),e.getMessage());
        }
 else {
          LogUtils.warning(event.getWhoClicked().getName() + "String_Node_Str" + e.getMessage());
        }
      }
      if (optionEvent.willClose()) {
        final Player p=(Player)event.getWhoClicked();
        Bukkit.getScheduler().scheduleSyncDelayedTask(ScrollingMenuSign.getInstance(),new Runnable(){
          public void run(){
            p.closeInventory();
          }
        }
,1);
      }
      if (optionEvent.willDestroy()) {
        destroy();
      }
    }
  }
}
Program: 18996
Project: 18996
Buggy source:
public static boolean showTextEntryPopup(final Player player,final String prompt){
  final SpoutPlayer sp=(SpoutPlayer)player;
  if (!sp.isSpoutCraftEnabled()) {
    return false;
  }
  Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(ScrollingMenuSign.getInstance(),new Runnable(){
    @Override public void run(){
      TextEntryPopup.show(sp,prompt);
    }
  }
);
  return true;
}

Fixed version (ground truth):
public static boolean showTextEntryPopup(final Player player,final String prompt){
  final SpoutPlayer sp=(SpoutPlayer)player;
  if (!sp.isSpoutCraftEnabled()) {
    return false;
  }
  LogUtils.fine("String_Node_Str" + player.getName() + "String_Node_Str"+ prompt);
  Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(ScrollingMenuSign.getInstance(),new Runnable(){
    @Override public void run(){
      TextEntryPopup.show(sp,prompt);
    }
  }
,5L);
  return true;
}