nus-yam/ex-repair huggingface dataset:
Program: 25370
Project: 25370
Buggy source:
public HashMap<Integer,ItemStack> removeItem(ItemStack... items){
  HashMap<Integer,ItemStack> leftover=new HashMap<Integer,ItemStack>();
  for (int i=0; i < items.length; i++) {
    ItemStack item=items[i];
    int toDelete=item.getAmount();
    while (true) {
      int first=first(item.getType());
      if (first == -1) {
        item.setAmount(toDelete);
        leftover.put(i,item);
        break;
      }
 else {
        CraftItemStack itemStack=getItem(first);
        int amount=itemStack.getAmount();
        if (amount <= toDelete) {
          toDelete-=amount;
          clear(first);
        }
 else {
          itemStack.setAmount(amount - toDelete);
          setItem(first,itemStack);
          toDelete=0;
        }
      }
      if (toDelete <= 0) {
        break;
      }
    }
  }
  return leftover;
}

Fixed version (ground truth):
public HashMap<Integer,ItemStack> removeItem(ItemStack... items){
  HashMap<Integer,ItemStack> leftover=new HashMap<Integer,ItemStack>();
  for (int i=0; i < items.length; i++) {
    ItemStack item=items[i];
    int toDelete=item.getAmount();
    while (true) {
      int first=first(item.getType());
      if (first == -1) {
        item.setAmount(toDelete);
        leftover.put(i,item);
        break;
      }
 else {
        ItemStack itemStack=getItem(first);
        int amount=itemStack.getAmount();
        if (amount <= toDelete) {
          toDelete-=amount;
          clear(first);
        }
 else {
          itemStack.setAmount(amount - toDelete);
          setItem(first,itemStack);
          toDelete=0;
        }
      }
      if (toDelete <= 0) {
        break;
      }
    }
  }
  return leftover;
}
Program: 25371
Project: 25371
Buggy source:
public CraftItemStack getItem(int index){
  return new CraftItemStack(getInventory().c_(index));
}

Fixed version (ground truth):
public ItemStack getItem(int index){
  return new CraftItemStack(getInventory().c_(index));
}
Program: 25372
Project: 25372
Buggy source:
public void remove(ItemStack item){
  ItemStack[] items=getContents();
  for (int i=0; i < items.length; i++) {
    if (items[i].equals(item)) {
      clear(i);
    }
  }
}

Fixed version (ground truth):
public void remove(ItemStack item){
  ItemStack[] items=getContents();
  for (int i=0; i < items.length; i++) {
    if (items[i] != null && items[i].equals(item)) {
      clear(i);
    }
  }
}
Program: 25373
Project: 25373
Buggy source:
public HashMap<Integer,ItemStack> addItem(ItemStack... items){
  HashMap<Integer,ItemStack> leftover=new HashMap<Integer,ItemStack>();
  for (int i=0; i < items.length; i++) {
    ItemStack item=items[i];
    while (true) {
      int firstPartial=firstPartial(item);
      if (firstPartial == -1) {
        int firstFree=firstEmpty();
        if (firstFree == -1) {
          leftover.put(i,item);
          break;
        }
 else {
          if (item.getAmount() > getMaxItemStack()) {
            setItem(firstFree,new CraftItemStack(item.getTypeId(),getMaxItemStack(),item.getDurability()));
            item.setAmount(item.getAmount() - getMaxItemStack());
          }
 else {
            setItem(firstFree,item);
            break;
          }
        }
      }
 else {
        CraftItemStack partialItem=getItem(firstPartial);
        int amount=item.getAmount();
        int partialAmount=partialItem.getAmount();
        int maxAmount=partialItem.getMaxStackSize();
        if (amount + partialAmount <= maxAmount) {
          partialItem.setAmount(amount + partialAmount);
          break;
        }
        partialItem.setAmount(maxAmount);
        item.setAmount(amount + partialAmount - maxAmount);
      }
    }
  }
  return leftover;
}

Fixed version (ground truth):
public HashMap<Integer,ItemStack> addItem(ItemStack... items){
  HashMap<Integer,ItemStack> leftover=new HashMap<Integer,ItemStack>();
  for (int i=0; i < items.length; i++) {
    ItemStack item=items[i];
    while (true) {
      int firstPartial=firstPartial(item);
      if (firstPartial == -1) {
        int firstFree=firstEmpty();
        if (firstFree == -1) {
          leftover.put(i,item);
          break;
        }
 else {
          if (item.getAmount() > getMaxItemStack()) {
            setItem(firstFree,new CraftItemStack(item.getTypeId(),getMaxItemStack(),item.getDurability()));
            item.setAmount(item.getAmount() - getMaxItemStack());
          }
 else {
            setItem(firstFree,item);
            break;
          }
        }
      }
 else {
        ItemStack partialItem=getItem(firstPartial);
        int amount=item.getAmount();
        int partialAmount=partialItem.getAmount();
        int maxAmount=partialItem.getMaxStackSize();
        if (amount + partialAmount <= maxAmount) {
          partialItem.setAmount(amount + partialAmount);
          break;
        }
        partialItem.setAmount(maxAmount);
        item.setAmount(amount + partialAmount - maxAmount);
      }
    }
  }
  return leftover;
}
Program: 25374
Project: 25374
Buggy source:
public boolean contains(ItemStack item,int amount){
  for (  ItemStack i : getContents()) {
    if (item.equals(i) && item.getAmount() >= amount) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
public boolean contains(ItemStack item,int amount){
  if (item == null) {
    return false;
  }
  int amt=0;
  for (  ItemStack i : getContents()) {
    if (item.equals(i)) {
      amt+=item.getAmount();
    }
  }
  return amt >= amount;
}
Program: 25375
Project: 25375
Buggy source:
public int firstPartial(ItemStack item){
  ItemStack[] inventory=getContents();
  for (int i=0; i < inventory.length; i++) {
    ItemStack cItem=inventory[i];
    if (item != null && cItem.getTypeId() == item.getTypeId() && cItem.getAmount() < cItem.getMaxStackSize() && cItem.getDurability() == item.getDurability()) {
      return i;
    }
  }
  return -1;
}

Fixed version (ground truth):
public int firstPartial(ItemStack item){
  ItemStack[] inventory=getContents();
  if (item == null) {
    return -1;
  }
  for (int i=0; i < inventory.length; i++) {
    ItemStack cItem=inventory[i];
    if (cItem != null && cItem.getTypeId() == item.getTypeId() && cItem.getAmount() < cItem.getMaxStackSize() && cItem.getDurability() == item.getDurability()) {
      return i;
    }
  }
  return -1;
}
Program: 25376
Project: 25376
Buggy source:
public int first(ItemStack item){
  ItemStack[] inventory=getContents();
  for (int i=0; i < inventory.length; i++) {
    if (item.equals(inventory[i])) {
      return i;
    }
  }
  return -1;
}

Fixed version (ground truth):
public int first(ItemStack item){
  if (item == null) {
    return -1;
  }
  ItemStack[] inventory=getContents();
  for (int i=0; i < inventory.length; i++) {
    if (item.equals(inventory[i])) {
      return i;
    }
  }
  return -1;
}
Program: 25377
Project: 25377
Buggy source:
public CraftItemStack getChestplate(){
  return getItem(getSize() + 2);
}

Fixed version (ground truth):
public ItemStack getChestplate(){
  return getItem(getSize() + 2);
}
Program: 25378
Project: 25378
Buggy source:
public CraftItemStack getLeggings(){
  return getItem(getSize() + 1);
}

Fixed version (ground truth):
public ItemStack getLeggings(){
  return getItem(getSize() + 1);
}
Program: 25379
Project: 25379
Buggy source:
public CraftItemStack getHelmet(){
  return getItem(getSize() + 3);
}

Fixed version (ground truth):
public ItemStack getHelmet(){
  return getItem(getSize() + 3);
}
Program: 25380
Project: 25380
Buggy source:
public CraftItemStack getBoots(){
  return getItem(getSize() + 0);
}

Fixed version (ground truth):
public ItemStack getBoots(){
  return getItem(getSize() + 0);
}
Program: 25381
Project: 25381
Buggy source:
public void q(){
  this.A=!this.d.isEmpty();
  Iterator iterator=this.d.iterator();
  while (iterator.hasNext()) {
    EntityHuman entityhuman=(EntityHuman)iterator.next();
    if (!entityhuman.F()) {
      this.A=false;
      break;
    }
  }
}

Fixed version (ground truth):
public void q(){
  this.A=!this.d.isEmpty();
  Iterator iterator=this.d.iterator();
  while (iterator.hasNext()) {
    EntityHuman entityhuman=(EntityHuman)iterator.next();
    if (!entityhuman.F() && !entityhuman.fauxSleeping) {
      this.A=false;
      break;
    }
  }
}
Program: 25382
Project: 25382
Buggy source:
public boolean s(){
  if (this.A && !this.isStatic) {
    Iterator iterator=this.d.iterator();
    EntityHuman entityhuman;
    do {
      if (!iterator.hasNext()) {
        return true;
      }
      entityhuman=(EntityHuman)iterator.next();
    }
 while (entityhuman.G());
    return false;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean s(){
  if (this.A && !this.isStatic) {
    Iterator iterator=this.d.iterator();
    boolean foundActualSleepers=false;
    EntityHuman entityhuman;
    do {
      if (!iterator.hasNext()) {
        return foundActualSleepers;
      }
      entityhuman=(EntityHuman)iterator.next();
      if (entityhuman.G()) {
        foundActualSleepers=true;
      }
    }
 while (entityhuman.G() || entityhuman.fauxSleeping);
    return false;
  }
 else {
    return false;
  }
}
Program: 25383
Project: 25383
Buggy source:
public CraftServer(MinecraftServer console,ServerConfigurationManager server){
  this.console=console;
  this.server=server;
  this.serverVersion=CraftServer.class.getPackage().getImplementationVersion();
  pluginManager.registerInterface(JavaPluginLoader.class);
  Logger.getLogger("String_Node_Str").log(Level.INFO,"String_Node_Str" + getName() + "String_Node_Str"+ getVersion());
}

Fixed version (ground truth):
public CraftServer(MinecraftServer console,ServerConfigurationManager server){
  this.console=console;
  this.server=server;
  this.serverVersion=CraftServer.class.getPackage().getImplementationVersion();
  Logger.getLogger("String_Node_Str").log(Level.INFO,"String_Node_Str" + getName() + "String_Node_Str"+ getVersion());
}
Program: 25384
Project: 25384
Buggy source:
public void loadPlugins(){
  File pluginFolder=(File)console.options.valueOf("String_Node_Str");
  if (pluginFolder.exists()) {
    try {
      Plugin[] plugins=pluginManager.loadPlugins(pluginFolder);
      for (      Plugin plugin : plugins) {
        try {
          plugin.onLoad();
        }
 catch (        AbstractMethodError ame) {
          Logger.getLogger("String_Node_Str").warning("String_Node_Str" + plugin.getDescription().getName() + "String_Node_Str");
        }
      }
      for (      Plugin plugin : plugins) {
        loadPlugin(plugin);
      }
    }
 catch (    Throwable ex) {
      Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE,ex.getMessage() + "String_Node_Str",ex);
    }
  }
 else {
    pluginFolder.mkdir();
  }
}

Fixed version (ground truth):
public void loadPlugins(){
  pluginManager.registerInterface(JavaPluginLoader.class);
  File pluginFolder=(File)console.options.valueOf("String_Node_Str");
  if (pluginFolder.exists()) {
    try {
      Plugin[] plugins=pluginManager.loadPlugins(pluginFolder);
      for (      Plugin plugin : plugins) {
        try {
          plugin.onLoad();
        }
 catch (        AbstractMethodError ame) {
          Logger.getLogger("String_Node_Str").warning("String_Node_Str" + plugin.getDescription().getName() + "String_Node_Str");
        }
      }
      for (      Plugin plugin : plugins) {
        loadPlugin(plugin);
      }
    }
 catch (    Throwable ex) {
      Logger.getLogger(CraftServer.class.getName()).log(Level.SEVERE,ex.getMessage() + "String_Node_Str",ex);
    }
  }
 else {
    pluginFolder.mkdir();
  }
}
Program: 25385
Project: 25385
Buggy source:
public net.minecraft.server.Chunk getHandle(){
  net.minecraft.server.Chunk c=weakChunk.get();
  if (c == null) {
    weakChunk=new WeakReference<net.minecraft.server.Chunk>(worldServer.c(x,z));
    c=weakChunk.get();
  }
  return c;
}

Fixed version (ground truth):
public net.minecraft.server.Chunk getHandle(){
  net.minecraft.server.Chunk c=weakChunk.get();
  if (c == null) {
    c=worldServer.c(x,z);
    weakChunk=new WeakReference<net.minecraft.server.Chunk>(c);
  }
  return c;
}
Program: 25386
Project: 25386
Buggy source:
public void preserveChunk(CraftChunk chunk){
  unloadedChunks.put((chunk.getX() << 16) + chunk.getZ(),chunk);
}

Fixed version (ground truth):
public void preserveChunk(CraftChunk chunk){
  chunk.breakLink();
  unloadedChunks.put((chunk.getX() << 16) + chunk.getZ(),chunk);
}
Program: 25387
Project: 25387
Buggy source:
public boolean unloadChunk(int x,int z,boolean save,boolean safe){
  if (safe && isChunkInUse(x,z)) {
    return false;
  }
  net.minecraft.server.Chunk chunk=provider.b(x,z);
  if (save) {
    chunk.e();
    provider.b(chunk);
    provider.a(chunk);
  }
  provider.a.remove(x,z);
  provider.e.remove(x,z);
  provider.f.remove(chunk);
  return true;
}

Fixed version (ground truth):
public boolean unloadChunk(int x,int z,boolean save,boolean safe){
  if (safe && isChunkInUse(x,z)) {
    return false;
  }
  net.minecraft.server.Chunk chunk=provider.b(x,z);
  if (save) {
    chunk.e();
    provider.b(chunk);
    provider.a(chunk);
  }
  preserveChunk((CraftChunk)chunk.bukkitChunk);
  provider.a.remove(x,z);
  provider.e.remove(x,z);
  provider.f.remove(chunk);
  return true;
}
Program: 25389
Project: 25389
Buggy source:
public boolean d(int i,int j,int k){
  if (this.a instanceof EntityPlayer) {
    CraftServer server=((WorldServer)this.b).getServer();
    org.bukkit.block.Block block=((WorldServer)this.b).getWorld().getBlockAt(i,j,k);
    org.bukkit.entity.Player player=(org.bukkit.entity.Player)this.a.getBukkitEntity();
    BlockBreakEvent event=new BlockBreakEvent(block,player);
    server.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
      return true;
    }
  }
  int l=this.b.getTypeId(i,j,k);
  int i1=this.b.getData(i,j,k);
  boolean flag=this.c(i,j,k);
  ItemStack itemstack=this.a.z();
  if (itemstack != null) {
    itemstack.a(l,i,j,k);
    if (itemstack.count == 0) {
      itemstack.a(this.a);
      this.a.A();
    }
  }
  if (flag && this.a.b(Block.byId[l])) {
    Block.byId[l].a_(this.b,i,j,k,i1);
    ((EntityPlayer)this.a).a.b((Packet)(new Packet53BlockChange(i,j,k,this.b)));
  }
  return flag;
}

Fixed version (ground truth):
public boolean d(int i,int j,int k){
  if (this.a instanceof EntityPlayer) {
    CraftServer server=((WorldServer)this.b).getServer();
    org.bukkit.block.Block block=((WorldServer)this.b).getWorld().getBlockAt(i,j,k);
    org.bukkit.entity.Player player=(org.bukkit.entity.Player)this.a.getBukkitEntity();
    BlockBreakEvent event=new BlockBreakEvent(block,player);
    server.getPluginManager().callEvent(event);
    if (event.isCancelled()) {
      MinecraftServer.a.info("String_Node_Str");
      return false;
    }
  }
  int l=this.b.getTypeId(i,j,k);
  int i1=this.b.getData(i,j,k);
  boolean flag=this.c(i,j,k);
  ItemStack itemstack=this.a.z();
  if (itemstack != null) {
    itemstack.a(l,i,j,k);
    if (itemstack.count == 0) {
      itemstack.a(this.a);
      this.a.A();
    }
  }
  if (flag && this.a.b(Block.byId[l])) {
    Block.byId[l].a_(this.b,i,j,k,i1);
    ((EntityPlayer)this.a).a.b((Packet)(new Packet53BlockChange(i,j,k,this.b)));
  }
  return flag;
}
Program: 25390
Project: 25390
Buggy source:
public boolean chat(String msg){
  if (msg.startsWith("String_Node_Str")) {
    this.c(msg);
    return true;
  }
 else {
    Player player=getPlayer();
    PlayerChatEvent event=new PlayerChatEvent(Type.PLAYER_CHAT,player,msg);
    server.getPluginManager().callEvent(event);
    msg=String.format(event.getFormat(),event.getPlayer().getDisplayName(),event.getMessage());
    if (event.isCancelled()) {
      return true;
    }
    a.info(msg);
    this.d.f.a((Packet)(new Packet3Chat(msg)));
  }
  return false;
}

Fixed version (ground truth):
public boolean chat(String msg){
  if (msg.startsWith("String_Node_Str")) {
    this.c(msg);
    return true;
  }
 else {
    Player player=getPlayer();
    PlayerChatEvent event=new PlayerChatEvent(Type.PLAYER_CHAT,player,msg);
    server.getPluginManager().callEvent(event);
    msg=String.format(event.getFormat(),event.getPlayer().getDisplayName(),event.getMessage());
    if (event.isCancelled()) {
      return true;
    }
    a.info(msg);
    for (    final String line : TextWrapper.wrapText(msg)) {
      this.d.f.a((Packet)(new Packet3Chat(line)));
    }
  }
  return false;
}
Program: 25391
Project: 25391
Buggy source:
public void sendMessage(String message){
  entity.a.b(new Packet3Chat(message));
}

Fixed version (ground truth):
public void sendMessage(String message){
  for (  final String line : TextWrapper.wrapText(message)) {
    entity.a.b(new Packet3Chat(line));
  }
}
Program: 25392
Project: 25392
Buggy source:
public long popFirst(){
  for (  long[][] outer : values) {
    if (outer == null)     continue;
    for (int i=0; i < outer.length; i++) {
      long[] inner=outer[i];
      if (inner == null || inner.length == 0)       continue;
      count--;
      long ret=inner[inner.length - 1];
      outer[i]=Arrays.copyOf(inner,inner.length - 1);
      System.err.println("String_Node_Str" + msw(ret) + "String_Node_Str"+ lsw(ret)+ "String_Node_Str");
      return ret;
    }
  }
  return 0;
}

Fixed version (ground truth):
public long popFirst(){
  for (  long[][] outer : values) {
    if (outer == null)     continue;
    for (int i=0; i < outer.length; i++) {
      long[] inner=outer[i];
      if (inner == null || inner.length == 0)       continue;
      count--;
      long ret=inner[inner.length - 1];
      outer[i]=Arrays.copyOf(inner,inner.length - 1);
      return ret;
    }
  }
  return 0;
}
Program: 25393
Project: 25393
Buggy source:
public void mainThreadHeartbeat(long currentTick){
  if (mainThreadLock.tryLock()) {
    try {
      this.currentTick=currentTick;
      while (!mainThreadQueue.isEmpty()) {
        mainThreadQueue.removeFirst().run();
      }
    }
  finally {
      mainThreadLock.unlock();
    }
  }
}

Fixed version (ground truth):
public void mainThreadHeartbeat(long currentTick){
  if (mainThreadLock.tryLock()) {
    try {
      this.currentTick=currentTick;
      while (!mainThreadQueue.isEmpty()) {
        syncedTasks.addLast(mainThreadQueue.removeFirst());
      }
    }
  finally {
      mainThreadLock.unlock();
    }
    while (!syncedTasks.isEmpty()) {
      syncedTasks.removeFirst().run();
    }
  }
}
Program: 25394
Project: 25394
Buggy source:
@Override public void teleportTo(Location location){
  boolean worldChange=location.getWorld() != getWorld();
  if (worldChange) {
    server.getServer().f.d.b(entity);
    entity.c=new ItemInWorldManager(((CraftWorld)location.getWorld()).getHandle());
    entity.c.a=entity;
  }
  entity.world=((CraftWorld)location.getWorld()).getHandle();
  entity.b(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  if (worldChange) {
    server.getServer().f.d.a(entity);
  }
}

Fixed version (ground truth):
@Override public void teleportTo(Location location){
  boolean worldChange=location.getWorld() != getWorld();
  ServerConfigurationManager manager=server.getHandle();
  if (worldChange) {
    manager.c.k.a(entity);
    manager.c.k.b(entity);
    manager.d.b(entity);
    entity.world.e(entity);
    entity.world=((CraftWorld)location.getWorld()).getHandle();
    entity.c=new ItemInWorldManager(((CraftWorld)location.getWorld()).getHandle());
    entity.c.a=entity;
    ((WorldServer)entity.world).A.d((int)entity.locX >> 4,(int)entity.locZ >> 4);
  }
  entity.a.a(location.getX(),location.getY(),location.getZ(),location.getYaw(),location.getPitch());
  if (worldChange) {
    manager.d.a(entity);
    entity.world.a(entity);
  }
}
Program: 25395
Project: 25395
Buggy source:
public EntityMinecart(World world,double d1,double d2,double d3,int i){
  this(world);
  a(d1,d2 + (double)H,d3);
  s=0.0D;
  t=0.0D;
  u=0.0D;
  m=d1;
  n=d2;
  o=d3;
  d=i;
  handleCreation(world);
}

Fixed version (ground truth):
public EntityMinecart(World world,double d1,double d2,double d3,int i){
  this(world);
  a(d1,d2 + (double)H,d3);
  s=0.0D;
  t=0.0D;
  u=0.0D;
  m=d1;
  n=d2;
  o=d3;
  d=i;
}
Program: 25396
Project: 25396
Buggy source:
public void a(World world,int i,int j,int k,Entity entity){
  if (entity instanceof EntityLiving) {
    CraftServer server=((WorldServer)world).getServer();
    CraftEntity toPassIn=new CraftLivingEntity(server,(EntityLiving)entity);
    EntityDamageByBlockEvent edbbe=new EntityDamageByBlockEvent(((WorldServer)world).getWorld().getBlockAt(i,j,k),toPassIn,EntityDamageEvent.DamageCause.CONTACT,1);
    server.getPluginManager().callEvent(edbbe);
    if (!edbbe.isCancelled()) {
      entity.a(((Entity)(null)),edbbe.getDamage());
    }
    return;
  }
  entity.a(((Entity)(null)),1);
}

Fixed version (ground truth):
public void a(World world,int i,int j,int k,Entity entity){
  if (entity instanceof EntityLiving) {
    CraftServer server=((WorldServer)world).getServer();
    org.bukkit.block.Block damager=((WorldServer)world).getWorld().getBlockAt(i,j,k);
    org.bukkit.entity.Entity damagee=entity.getBukkitEntity();
    DamageCause damageType=EntityDamageEvent.DamageCause.CONTACT;
    int damageDone=1;
    EntityDamageByBlockEvent edbbe=new EntityDamageByBlockEvent(damager,damagee,damageType,damageDone);
    server.getPluginManager().callEvent(edbbe);
    if (!edbbe.isCancelled()) {
      entity.a(((Entity)(null)),edbbe.getDamage());
    }
    return;
  }
 else {
    entity.a(((Entity)(null)),1);
  }
}
Program: 25398
Project: 25398
Buggy source:
protected void s(){
  if (!ae) {
    if (this instanceof EntityLiving) {
      CraftServer server=((WorldServer)l).getServer();
      EntityDamageByBlockEvent ede=new EntityDamageByBlockEvent(null,this.getBukkitEntity(),EntityDamageEvent.DamageCause.LAVA,4);
      server.getPluginManager().callEvent(ede);
      if (!ede.isCancelled()) {
        a(((Entity)(null)),ede.getDamage());
      }
      EntityCombustEvent ece=new EntityCombustEvent(Type.ENTITY_COMBUST,this.getBukkitEntity());
      server.getPluginManager().callEvent(ece);
      if (!ece.isCancelled()) {
        Z=600;
      }
    }
 else {
      a(((Entity)(null)),4);
      Z=600;
    }
  }
}

Fixed version (ground truth):
protected void s(){
  if (!ae) {
    if (this instanceof EntityLiving) {
      CraftServer server=((WorldServer)l).getServer();
      org.bukkit.block.Block damager=null;
      org.bukkit.entity.Entity damagee=this.getBukkitEntity();
      DamageCause damageType=EntityDamageEvent.DamageCause.LAVA;
      int damageDone=4;
      EntityDamageByBlockEvent ede=new EntityDamageByBlockEvent(damager,damagee,damageType,damageDone);
      server.getPluginManager().callEvent(ede);
      if (!ede.isCancelled()) {
        a(((Entity)(null)),ede.getDamage());
      }
      if (Z <= 0) {
        Type eventType=Type.ENTITY_COMBUST;
        EntityCombustEvent ece=new EntityCombustEvent(eventType,damagee);
        server.getPluginManager().callEvent(ece);
        if (!ece.isCancelled()) {
          Z=600;
        }
      }
 else {
        Z=600;
      }
    }
 else {
      a(((Entity)(null)),4);
      Z=600;
    }
  }
}
Program: 25400
Project: 25400
Buggy source:
public Block getBlockAt(int x,int y,int z){
  BlockCoordinate loc=new BlockCoordinate(x,y,z);
  CraftBlock block=blockCache.get(loc);
  if (block == null) {
    block=new CraftBlock(this,x,y,z,world.a(x,y,z),(byte)world.b(x,y,z));
    blockCache.put(loc,block);
  }
  return block;
}

Fixed version (ground truth):
public Block getBlockAt(int x,int y,int z){
  BlockCoordinate loc=new BlockCoordinate(x,y,z);
  CraftBlock block=blockCache.get(loc);
  if (block == null) {
    block=new CraftBlock(this,x,y,z,world.a(x,y,z),(byte)world.b(x,y,z));
    blockCache.put(loc,block);
  }
 else {
    block.update();
  }
  return block;
}
Program: 25401
Project: 25401
Buggy source:
public void update(){
  type=world.getHandle().a(x,y,z);
  data=(byte)world.getHandle().b(x,y,z);
}

Fixed version (ground truth):
public void update(){
  type=world.getHandle().a(x,y,z);
  data=(byte)world.getHandle().b(x,y,z);
  light=(byte)world.getHandle().j(x,y,z);
}
Program: 25402
Project: 25402
Buggy source:
public Block updateBlock(int x,int y,int z){
  BlockCoordinate loc=new BlockCoordinate(x,y,z);
  CraftBlock block=(CraftBlock)blockCache.get(loc);
  final int type=world.a(x,y,z);
  final byte data=(byte)world.b(x,y,z);
  if (block == null) {
    block=new CraftBlock(this,x,y,z,type,data);
    blockCache.put(loc,block);
  }
 else {
    block.type=type;
    block.data=data;
  }
  return block;
}

Fixed version (ground truth):
public Block updateBlock(int x,int y,int z){
  BlockCoordinate loc=new BlockCoordinate(x,y,z);
  CraftBlock block=(CraftBlock)blockCache.get(loc);
  final int type=world.a(x,y,z);
  final byte data=(byte)world.b(x,y,z);
  if (block == null) {
    block=new CraftBlock(this,x,y,z,type,data);
    blockCache.put(loc,block);
  }
 else {
    block.update();
  }
  return block;
}
Program: 25403
Project: 25403
Buggy source:
public void setContents(ItemStack[] items){
  if (getInventory().getContents().length != items.length) {
    throw new IllegalArgumentException("String_Node_Str" + getInventory().getContents().length);
  }
  net.minecraft.server.ItemStack[] mcItems=getInventory().getContents();
  for (int i=0; i < items.length; i++) {
    ItemStack item=items[i];
    if (item == null) {
      mcItems[i]=null;
    }
 else {
      mcItems[i]=new net.minecraft.server.ItemStack(item.getTypeId(),item.getAmount(),item.getDamage());
    }
  }
}

Fixed version (ground truth):
public void setContents(ItemStack[] items){
  if (getInventory().getContents().length != items.length) {
    throw new IllegalArgumentException("String_Node_Str" + getInventory().getContents().length);
  }
  net.minecraft.server.ItemStack[] mcItems=getInventory().getContents();
  for (int i=0; i < items.length; i++) {
    ItemStack item=items[i];
    if (item == null || item.getTypeId() <= 0) {
      mcItems[i]=null;
    }
 else {
      mcItems[i]=new net.minecraft.server.ItemStack(item.getTypeId(),item.getAmount(),item.getDamage());
    }
  }
}
Program: 25404
Project: 25404
Buggy source:
public ItemStack getItem(int index){
  return new CraftItemStack(getInventory().a(index));
}

Fixed version (ground truth):
public CraftItemStack getItem(int index){
  return new CraftItemStack(getInventory().a(index));
}
Program: 25405
Project: 25405
Buggy source:
public HashMap<Integer,ItemStack> addItem(ItemStack... items){
  HashMap<Integer,ItemStack> leftover=new HashMap<Integer,ItemStack>();
  for (int i=0; i < items.length; i++) {
    ItemStack item=items[i];
    while (true) {
      int firstPartial=firstPartial(item.getTypeID());
      if (firstPartial == -1) {
        int firstFree=firstEmpty();
        if (firstFree == -1) {
          leftover.put(i,item);
        }
 else {
          setItem(firstFree,item);
        }
        break;
      }
      ItemStack partialItem=getItem(firstPartial);
      int amount=item.getAmount();
      int partialAmount=partialItem.getAmount();
      int maxAmount=partialItem.getMaxStackSize();
      if (amount + partialAmount <= maxAmount) {
        partialItem.setAmount(amount + partialAmount);
        break;
      }
      partialItem.setAmount(maxAmount);
      item.setAmount(amount + partialAmount - maxAmount);
    }
  }
  return leftover;
}

Fixed version (ground truth):
public HashMap<Integer,ItemStack> addItem(ItemStack... items){
  HashMap<Integer,ItemStack> leftover=new HashMap<Integer,ItemStack>();
  for (int i=0; i < items.length; i++) {
    ItemStack item=items[i];
    while (true) {
      int firstPartial=firstPartial(item.getTypeID());
      if (firstPartial == -1) {
        int firstFree=firstEmpty();
        if (firstFree == -1) {
          leftover.put(i,item);
          break;
        }
 else {
          if (item.getAmount() > getMaxItemStack()) {
            setItem(firstFree,new ItemStack(item.getTypeID(),getMaxItemStack()));
            item.setAmount(item.getAmount() - getMaxItemStack());
          }
 else {
            setItem(firstFree,item);
            break;
          }
        }
      }
 else {
        ItemStack partialItem=getItem(firstPartial);
        int amount=item.getAmount();
        int partialAmount=partialItem.getAmount();
        int maxAmount=partialItem.getMaxStackSize();
        if (amount + partialAmount <= maxAmount) {
          partialItem.setAmount(amount + partialAmount);
          break;
        }
        partialItem.setAmount(maxAmount);
        item.setAmount(amount + partialAmount - maxAmount);
      }
    }
  }
  return leftover;
}
Program: 25406
Project: 25406
Buggy source:
public ItemStack[] getContents(){
  ItemStack[] items=new ItemStack[getSize()];
  net.minecraft.server.ItemStack[] mcItems=getInventory().getContents();
  for (int i=0; i < mcItems.length; i++) {
    items[i]=new CraftItemStack(mcItems[i]);
  }
  return items;
}

Fixed version (ground truth):
public CraftItemStack[] getContents(){
  CraftItemStack[] items=new CraftItemStack[getSize()];
  net.minecraft.server.ItemStack[] mcItems=getInventory().getContents();
  for (int i=0; i < mcItems.length; i++) {
    items[i]=new CraftItemStack(mcItems[i]);
  }
  return items;
}
Program: 25407
Project: 25407
Buggy source:
public ItemStack getHelmet(){
  return getItem(getSize() - 4);
}

Fixed version (ground truth):
public CraftItemStack getHelmet(){
  return getItem(getSize() - 4);
}
Program: 25408
Project: 25408
Buggy source:
public ItemStack getChestplate(){
  return getItem(getSize() - 3);
}

Fixed version (ground truth):
public CraftItemStack getChestplate(){
  return getItem(getSize() - 3);
}
Program: 25409
Project: 25409
Buggy source:
public ItemStack getBoots(){
  return getItem(getSize() - 1);
}

Fixed version (ground truth):
public CraftItemStack getBoots(){
  return getItem(getSize() - 1);
}
Program: 25410
Project: 25410
Buggy source:
public ItemStack getLeggings(){
  return getItem(getSize() - 2);
}

Fixed version (ground truth):
public CraftItemStack getLeggings(){
  return getItem(getSize() - 2);
}
Program: 25411
Project: 25411
Buggy source:
public ArrayList<ItemStack> getArmorContents(){
  ArrayList<ItemStack> items=new ArrayList<ItemStack>();
  for (  net.minecraft.server.ItemStack item : getInventory().getArmorContents()) {
    ItemStack i=null;
    if (item != null) {
      i=new CraftItemStack(item);
    }
    items.add(i);
  }
  return items;
}

Fixed version (ground truth):
public CraftItemStack[] getArmorContents(){
  net.minecraft.server.ItemStack[] mcItems=getInventory().getArmorContents();
  CraftItemStack[] items=new CraftItemStack[mcItems.length];
  for (int i=0; i < mcItems.length; i++) {
    items[i]=new CraftItemStack(mcItems[i]);
  }
  return items;
}
Program: 25412
Project: 25412
Buggy source:
public ItemStack getItemInHand(){
  return new CraftItemStack(getInventory().e());
}

Fixed version (ground truth):
public CraftItemStack getItemInHand(){
  return new CraftItemStack(getInventory().e());
}
Program: 25413
Project: 25413
Buggy source:
@Override public int getAmount(){
  super.setAmount(item != null ? item.a : 0);
  return item.a;
}

Fixed version (ground truth):
@Override public int getAmount(){
  super.setAmount(item != null ? item.a : 0);
  return (item != null ? item.a : 0);
}
Program: 25414
Project: 25414
Buggy source:
@Override public Egg throwEgg(){
  net.minecraft.server.World world=((CraftWorld)getWorld()).getHandle();
  EntityEgg egg=new EntityEgg(world,entity);
  world.a(egg);
  return new CraftEgg(server,egg);
}

Fixed version (ground truth):
public Egg throwEgg(){
  net.minecraft.server.World world=((CraftWorld)getWorld()).getHandle();
  EntityEgg egg=new EntityEgg(world,entity);
  world.a(egg);
  return new CraftEgg(server,egg);
}
Program: 25415
Project: 25415
Buggy source:
@Override public Snowball throwSnowball(){
  net.minecraft.server.World world=((CraftWorld)getWorld()).getHandle();
  EntitySnowball snowball=new EntitySnowball(world,entity);
  world.a(snowball);
  return new CraftSnowball(server,snowball);
}

Fixed version (ground truth):
public Snowball throwSnowball(){
  net.minecraft.server.World world=((CraftWorld)getWorld()).getHandle();
  EntitySnowball snowball=new EntitySnowball(world,entity);
  world.a(snowball);
  return new CraftSnowball(server,snowball);
}
Program: 25416
Project: 25416
Buggy source:
@Override public Vector getVelocity(){
  return new Vector(minecart.s,minecart.t,minecart.u);
}

Fixed version (ground truth):
public Vector getVelocity(){
  return new Vector(minecart.s,minecart.t,minecart.u);
}
Program: 25417
Project: 25417
Buggy source:
/** 
 * Notch uses a 0-5 to mean Down, Up, East, West, North, South in that order all over. This method is convience to convert for us.
 * @return BlockFace the BlockFace represented by this number
 */
public static BlockFace notchToBlockFace(int notch){
switch (notch) {
case 0:
    return BlockFace.Down;
case 1:
  return BlockFace.Up;
case 2:
return BlockFace.East;
case 3:
return BlockFace.West;
case 4:
return BlockFace.North;
case 5:
return BlockFace.South;
default :
return BlockFace.Self;
}
}

Fixed version (ground truth):
/** 
 * Notch uses a 0-5 to mean Down, Up, East, West, North, South in that order all over. This method is convenience to convert for us.
 * @return BlockFace the BlockFace represented by this number
 */
public static BlockFace notchToBlockFace(int notch){
switch (notch) {
case 0:
    return BlockFace.Down;
case 1:
  return BlockFace.Up;
case 2:
return BlockFace.East;
case 3:
return BlockFace.West;
case 4:
return BlockFace.North;
case 5:
return BlockFace.South;
default :
return BlockFace.Self;
}
}
Program: 25418
Project: 25418
Buggy source:
public static String textFor(SniperStatus status){
  return STATUS_TEXT[status.ordinal()];
}

Fixed version (ground truth):
public static String textFor(SniperStatus status){
  return status.text;
}
Program: 25419
Project: 25419
Buggy source:
public void startBiddingIn(FakeAuctionServer... auctions) throws Exception {
  startSniper();
  for (  FakeAuctionServer a : auctions) {
    driver.typeItemId(a.itemId);
    driver.clickJoinAuctionButton();
    driver.showsSniperStatus(a.itemId,0,0,MainWindow.STATUS_JOINING);
  }
}

Fixed version (ground truth):
public void startBiddingIn(FakeAuctionServer... auctions) throws Exception {
  startSniper();
  for (  FakeAuctionServer a : auctions) {
    driver.typeItemId(a.itemId);
    driver.clickJoinAuctionButton();
    driver.showsSniperStatus(a.itemId,0,0,SniperStatus.JOINING.text);
  }
}
Program: 25420
Project: 25420
Buggy source:
public void hasShownSniperIsLosing(FakeAuctionServer auction,int lastPrice,int lastBid){
  driver.showsSniperStatus(auction.itemId,lastPrice,lastBid,MainWindow.STATUS_LOSING);
}

Fixed version (ground truth):
public void hasShownSniperIsLosing(FakeAuctionServer auction,int lastPrice,int lastBid){
  driver.showsSniperStatus(auction.itemId,lastPrice,lastBid,SniperStatus.LOSING.text);
}
Program: 25421
Project: 25421
Buggy source:
public void startBiddingWithStopPrice(FakeAuctionServer auction,int stopPrice) throws Exception {
  startSniper();
  driver.typeItemId(auction.itemId);
  driver.typeStopPrice(stopPrice);
  driver.clickJoinAuctionButton();
  driver.showsSniperStatus(auction.itemId,0,0,MainWindow.STATUS_JOINING);
}

Fixed version (ground truth):
public void startBiddingWithStopPrice(FakeAuctionServer auction,int stopPrice) throws Exception {
  startSniper();
  driver.typeItemId(auction.itemId);
  driver.typeStopPrice(stopPrice);
  driver.clickJoinAuctionButton();
  driver.showsSniperStatus(auction.itemId,0,0,SniperStatus.JOINING.text);
}
Program: 25422
Project: 25422
Buggy source:
public void showsSniperHasLostAuction(FakeAuctionServer auction,int lastPrice,int lastBid){
  driver.showsSniperStatus(auction.itemId,lastPrice,lastBid,MainWindow.STATUS_LOST);
}

Fixed version (ground truth):
public void showsSniperHasLostAuction(FakeAuctionServer auction,int lastPrice,int lastBid){
  driver.showsSniperStatus(auction.itemId,lastPrice,lastBid,SniperStatus.LOST.text);
}
Program: 25423
Project: 25423
Buggy source:
public void hasShownSniperIsWinning(FakeAuctionServer auction,int winningBid){
  driver.showsSniperStatus(auction.itemId,winningBid,winningBid,MainWindow.STATUS_WINNING);
}

Fixed version (ground truth):
public void hasShownSniperIsWinning(FakeAuctionServer auction,int winningBid){
  driver.showsSniperStatus(auction.itemId,winningBid,winningBid,SniperStatus.WINNING.text);
}
Program: 25424
Project: 25424
Buggy source:
public void showsSniperHasWonAuction(FakeAuctionServer auction,int lastPrice){
  driver.showsSniperStatus(auction.itemId,lastPrice,lastPrice,MainWindow.STATUS_WON);
}

Fixed version (ground truth):
public void showsSniperHasWonAuction(FakeAuctionServer auction,int lastPrice){
  driver.showsSniperStatus(auction.itemId,lastPrice,lastPrice,SniperStatus.WON.text);
}
Program: 25425
Project: 25425
Buggy source:
public void hasShownSniperIsBidding(FakeAuctionServer auction,int lastPrice,int lastBid){
  driver.showsSniperStatus(auction.itemId,lastPrice,lastBid,MainWindow.STATUS_BIDDING);
}

Fixed version (ground truth):
public void hasShownSniperIsBidding(FakeAuctionServer auction,int lastPrice,int lastBid){
  driver.showsSniperStatus(auction.itemId,lastPrice,lastBid,SniperStatus.BIDDING.text);
}
Program: 25426
Project: 25426
Buggy source:
public void resizeMaps(){
  if (parent.blockLives.size() > 1000) {
    parent.blockLives.clear();
  }
}

Fixed version (ground truth):
public void resizeMaps(){
  if (parent.blockLives.size() > 1000000) {
    parent.blockLives.clear();
  }
}
Program: 25427
Project: 25427
Buggy source:
@Override public void onBlockPlace(BlockPlaceEvent event){
  if (event.isCancelled())   return;
  PlacedBlock pBlock=new PlacedBlock(event.getPlayer(),event.getBlock());
  parent.getDatabase().save(pBlock);
}

Fixed version (ground truth):
@Override public void onBlockPlace(BlockPlaceEvent event){
  if (event.isCancelled())   return;
  if (parent.getPlacedBlockAt(event.getBlock().getLocation(),true) == null) {
    PlacedBlock pBlock=new PlacedBlock(event.getPlayer(),event.getBlock());
    parent.getDatabase().save(pBlock);
  }
 else   event.setCancelled(true);
}
Program: 25428
Project: 25428
Buggy source:
@Override public void onBlockPhysics(BlockPhysicsEvent event){
  if (event.isCancelled())   return;
  Block block=event.getBlock();
  if (isAttached(block)) {
    int attachedToId=(Integer)parent.attachedBlocks.get(block.getLocation().toString());
    if (attachedToId == event.getChangedTypeId()) {
      removeAttached(block);
      event.setCancelled(true);
    }
  }
}

Fixed version (ground truth):
@Override public void onBlockPhysics(BlockPhysicsEvent event){
  if (event.isCancelled())   return;
  Block block=event.getBlock();
  if (isAttached(block)) {
    int attachedToId=(Integer)parent.attachedBlocks.get(block.getLocation().toString());
    if (attachedToId == event.getChangedTypeId()) {
      untrackAttachedLives(block);
      event.setCancelled(true);
    }
  }
}
Program: 25429
Project: 25429
Buggy source:
public void removeBlock(Block block){
  if (isPlaced(block))   parent.getDatabase().delete(parent.getPlacedBlockAt(block.getLocation(),false));
}

Fixed version (ground truth):
public void removeBlock(Block block){
  if (isPlaced(block)) {
    PlacedBlock pBlock=parent.getPlacedBlockAt(block.getLocation(),false);
    if (pBlock != null)     parent.getDatabase().delete(pBlock);
  }
}
Program: 25430
Project: 25430
Buggy source:
public void damageTool(Player p,ItemStack tool){
  boolean isTool=false;
switch (tool.getType()) {
case IRON_SPADE:
case IRON_PICKAXE:
case IRON_AXE:
case IRON_SWORD:
case WOOD_SWORD:
case WOOD_SPADE:
case WOOD_PICKAXE:
case WOOD_AXE:
case STONE_SWORD:
case STONE_SPADE:
case STONE_PICKAXE:
case STONE_AXE:
case DIAMOND_SWORD:
case DIAMOND_SPADE:
case DIAMOND_PICKAXE:
case DIAMOND_AXE:
case STICK:
case GOLD_SWORD:
case GOLD_SPADE:
case GOLD_PICKAXE:
case GOLD_AXE:
case WOOD_HOE:
case STONE_HOE:
case IRON_HOE:
case DIAMOND_HOE:
case GOLD_HOE:
    isTool=true;
}
if (isTool) {
  if (tool.getDurability() >= tool.getType().getMaxDurability())   if (tool.getAmount() > 1)   tool.setAmount(tool.getAmount() - 1);
 else   p.setItemInHand(null);
 else   tool.setDurability((short)(tool.getDurability() + 1));
}
}

Fixed version (ground truth):
public void damageTool(Player p,ItemStack item){
  if (isTool(item)) {
    if (item.getDurability() >= item.getType().getMaxDurability())     if (item.getAmount() > 1)     item.setAmount(item.getAmount() - 1);
 else     p.setItemInHand(null);
 else     item.setDurability((short)(item.getDurability() + 1));
  }
}
Program: 25431
Project: 25431
Buggy source:
private byte checkSideAttached(Block block,BlockFace dir){
  Material mat=block.getFace(dir,1).getType();
switch (mat) {
case TORCH:
case LADDER:
case WALL_SIGN:
case LEVER:
case REDSTONE_TORCH_OFF:
case REDSTONE_TORCH_ON:
case STONE_BUTTON:
case PORTAL:
    return 1;
default :
  break;
}
return 0;
}

Fixed version (ground truth):
private byte checkSideAttached(Block block,BlockFace dir){
  Material mat=block.getFace(dir,1).getType();
switch (mat) {
case TORCH:
case LADDER:
case WALL_SIGN:
case LEVER:
case REDSTONE_TORCH_OFF:
case REDSTONE_TORCH_ON:
case STONE_BUTTON:
case PORTAL:
case TRAP_DOOR:
    return 1;
default :
  break;
}
return 0;
}
Program: 25432
Project: 25432
Buggy source:
public boolean updateRoom12(RoomSharedVO mroomvo){
  try {
    System.err.println("String_Node_Str" + mroomvo);
    ISharedObject roomInfoSO=this.getSharedObject(Red5.getConnectionLocal().getScope(),"String_Node_Str");
    roomInfoSO.setAttribute("String_Node_Str" + 0,mroomvo);
    System.err.println("String_Node_Str" + mroomvo.isLock());
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return true;
}

Fixed version (ground truth):
public boolean updateRoom12(boolean lock,String moderator,String presenter,boolean recording,boolean webinar,boolean muteAudio,boolean autoJoin,boolean privateChat,String viewState){
  try {
    System.err.println("String_Node_Str" + lock);
    ISharedObject roomInfoSO=this.getSharedObject(Red5.getConnectionLocal().getScope(),"String_Node_Str");
    RoomSharedVO mroomvo=new RoomSharedVO();
    mroomvo.setLock(lock);
    mroomvo.setModerator(moderator);
    mroomvo.setPresenter(presenter);
    mroomvo.setRecording(recording);
    mroomvo.setWebinar(webinar);
    mroomvo.setMuteAudio(muteAudio);
    mroomvo.setAutoJoin(autoJoin);
    mroomvo.setPrivateChat(privateChat);
    mroomvo.setViewState(viewState);
    roomInfoSO.setAttribute("String_Node_Str" + 0,mroomvo);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
  return true;
}
Program: 25433
Project: 25433
Buggy source:
public static void processFLV(List<VideoData> videoDataList,PlaybackVO playbackVO){
  for (  VideoData vData : videoDataList) {
    String flvPath=vData.getFilePath();
    long duration=(vData.getEndTime().getTime() - vData.getStartTime().getTime());
    log.debug("String_Node_Str" + flvPath + "String_Node_Str"+ vData.getVideoType()+ "String_Node_Str"+ duration);
    String command="String_Node_Str" + flvPath + "String_Node_Str"+ vData.getVideoType()+ "String_Node_Str"+ duration;
    ProcessExecutor pe=new ProcessExecutor();
    boolean val=pe.executeProcess(command,playbackVO.getTempLocation(),null);
    log.debug("String_Node_Str" + command + "String_Node_Str"+ val);
    command="String_Node_Str" + flvPath;
    val=pe.executeProcess(command,"String_Node_Str",null);
    log.debug("String_Node_Str" + command + "String_Node_Str"+ val);
  }
}

Fixed version (ground truth):
public static void processFLV(List<VideoData> videoDataList,PlaybackVO playbackVO){
  for (  VideoData vData : videoDataList) {
    String flvPath=vData.getFilePath();
    convertToAVIAndBackToFlv(flvPath);
    long duration=(vData.getEndTime().getTime() - vData.getStartTime().getTime());
    log.debug("String_Node_Str" + flvPath + "String_Node_Str"+ vData.getVideoType()+ "String_Node_Str"+ duration);
    String command="String_Node_Str" + flvPath + "String_Node_Str"+ vData.getVideoType()+ "String_Node_Str"+ duration;
    ProcessExecutor pe=new ProcessExecutor();
    boolean val=pe.executeProcess(command,playbackVO.getTempLocation(),null);
    log.debug("String_Node_Str" + command + "String_Node_Str"+ val);
    command="String_Node_Str" + flvPath;
    val=pe.executeProcess(command,"String_Node_Str",null);
    log.debug("String_Node_Str" + command + "String_Node_Str"+ val);
  }
}
Program: 25434
Project: 25434
Buggy source:
public String setExecutable(String fileName){
  try {
    String[] cmd=new String[1];
    cmd[0]="String_Node_Str" + fileName;
    Runtime rt=Runtime.getRuntime();
    Process proc=rt.exec("String_Node_Str" + fileName);
    InputStream stderr=proc.getErrorStream();
    InputStreamReader isr=new InputStreamReader(stderr);
    BufferedReader br=new BufferedReader(isr);
    String line=null;
    String error="String_Node_Str";
    while ((line=br.readLine()) != null) {
      error+=line;
      log.debug("String_Node_Str" + line);
    }
    int exitVal=proc.waitFor();
    log.debug("String_Node_Str" + exitVal);
  }
 catch (  Exception err) {
    err.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
public String setExecutable(String fileName){
  try {
    String[] cmd=new String[1];
    cmd[0]="String_Node_Str" + fileName;
    Runtime rt=Runtime.getRuntime();
    Process proc=rt.exec("String_Node_Str" + fileName);
    InputStream stderr=proc.getErrorStream();
    InputStreamReader isr=new InputStreamReader(stderr);
    BufferedReader br=new BufferedReader(isr);
    String line=null;
    String error="String_Node_Str";
    while ((line=br.readLine()) != null) {
      error+=line;
      log.debug("String_Node_Str" + line);
    }
    int exitVal=proc.waitFor();
    if (exitVal != 0) {
      log.warn("String_Node_Str" + exitVal);
    }
  }
 catch (  Exception err) {
    err.printStackTrace();
  }
  return null;
}
Program: 25435
Project: 25435
Buggy source:
public boolean executeProcess(String cmd,String tempPath,HashMap<String,String> videohm){
  try {
    log.debug(cmd);
    if (PlaybackUtil.isWindows() == false) {
      File f=new File(tempPath + "String_Node_Str" + Math.random() * 10000 + "String_Node_Str");
      FileWriter fw=new FileWriter(f);
      fw.write("String_Node_Str");
      fw.write(cmd + "String_Node_Str");
      fw.close();
      cmd=f.getAbsolutePath();
      MakeExectuable.getInstance().setExecutable(cmd);
    }
    Runtime rt=Runtime.getRuntime();
    Process proc=rt.exec(cmd);
    StreamGobbler errorGobbler=new StreamGobbler(proc.getErrorStream(),"String_Node_Str",videohm);
    StreamGobbler outputGobbler=new StreamGobbler(proc.getInputStream(),"String_Node_Str",videohm);
    errorGobbler.start();
    outputGobbler.start();
    int exitVal=proc.waitFor();
    if (exitVal == 0) {
      return true;
    }
  }
 catch (  Exception t) {
    t.printStackTrace();
    log.error(t.getMessage(),t);
  }
  return false;
}

Fixed version (ground truth):
public boolean executeProcess(String cmd,String tempPath,HashMap<String,String> videohm){
  try {
    log.debug(cmd);
    if (PlaybackUtil.isWindows() == false) {
      File f=new File(tempPath + "String_Node_Str" + Math.random() * 10000 + "String_Node_Str");
      FileWriter fw=new FileWriter(f);
      fw.write("String_Node_Str");
      fw.write(cmd + "String_Node_Str");
      fw.close();
      cmd=f.getAbsolutePath();
      MakeExectuable.getInstance().setExecutable(cmd);
    }
    Runtime rt=Runtime.getRuntime();
    Process proc=rt.exec(cmd);
    StreamGobbler errorGobbler=new StreamGobbler(proc.getErrorStream(),"String_Node_Str",videohm);
    StreamGobbler outputGobbler=new StreamGobbler(proc.getInputStream(),"String_Node_Str",videohm);
    errorGobbler.start();
    outputGobbler.start();
    int exitVal=proc.waitFor();
    while (true) {
      if (errorGobbler.isAlive() || outputGobbler.isAlive()) {
        log.debug("String_Node_Str");
        Thread.sleep(10000);
      }
 else {
        break;
      }
    }
    if (exitVal == 0) {
      return true;
    }
  }
 catch (  Exception t) {
    t.printStackTrace();
    log.error(t.getMessage(),t);
  }
  return false;
}
Program: 25436
Project: 25436
Buggy source:
public String getSubstr(String line){
  String temp[]=line.split("String_Node_Str");
  return temp[1].trim();
}

Fixed version (ground truth):
public void getSubstr(String line,String val,HashMap videohm){
  String temp[]=line.split("String_Node_Str");
  if (temp.length == 2) {
    if (temp[1] != null && PlaybackUtil.getNumLong(temp[1]) > 0) {
      videohm.put(val,temp[1].trim());
    }
  }
}