nus-yam/ex-repair huggingface dataset:
Program: 187672
Project: 187672
Buggy source:
public void load(){
  try {
    DataInputStream F_In=new DataInputStream(new FileInputStream(NBTFile));
    nbtTagCompound=(NBTTagCompound)NBTBase.b(F_In);
    F_In.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public void load(){
  try {
    FileInputStream fi=new FileInputStream(NBTFile);
    fi.read();
    if (fi.read() != -1) {
      fi.close();
      fi=new FileInputStream(NBTFile);
      DataInputStream F_In=new DataInputStream(fi);
      nbtTagCompound=(NBTTagCompound)NBTBase.b(F_In);
      F_In.close();
    }
    fi.close();
  }
 catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 187673
Project: 187673
Buggy source:
@Override public void onEntityTarget(final EntityTargetEvent event){
  if (!event.isCancelled()) {
    if (event.getEntity() instanceof Wolf) {
      for (      MyWolf Wolf : ConfigBuffer.mWolves.values()) {
        if (Wolf.getID() == event.getEntity().getEntityId()) {
          Wolf.ResetSitTimer();
          if (Wolf.Behavior == de.Keyle.MyWolf.MyWolf.BehaviorState.Friendly) {
            event.setCancelled(true);
          }
 else           if (Wolf.Behavior == BehaviorState.Raid) {
            if (event.getTarget() instanceof Player || (event.getTarget() instanceof Wolf && ((Wolf)event.getTarget()).isTamed())) {
              event.setCancelled(true);
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onEntityTarget(final EntityTargetEvent event){
  if (!event.isCancelled()) {
    if (event.getEntity() instanceof Wolf) {
      for (      MyWolf Wolf : ConfigBuffer.mWolves.values()) {
        if (Wolf.getID() == event.getEntity().getEntityId()) {
          Wolf.ResetSitTimer();
          if (Wolf.Behavior == de.Keyle.MyWolf.MyWolf.BehaviorState.Friendly) {
            event.setCancelled(true);
          }
 else           if (event.getTarget() instanceof Player && ((Player)event.getTarget()).getName() == Wolf.getOwner().getName()) {
            event.setCancelled(true);
          }
 else           if (Wolf.Behavior == BehaviorState.Raid) {
            if (event.getTarget() instanceof Player || (event.getTarget() instanceof Wolf && ((Wolf)event.getTarget()).isTamed())) {
              event.setCancelled(true);
            }
          }
        }
      }
    }
  }
}
Program: 187676
Project: 187676
Buggy source:
@Override public void activate(MyWolf wolf,Object args){
  if (!MyWolfUtil.hasSkill(wolf.Abilities,"String_Node_Str")) {
    wolf.Abilities.put("String_Node_Str",true);
  }
  if (wolf.inv.getSize() >= 54) {
    return;
  }
  if (!MyWolfPermissions.has(wolf.getOwner(),"String_Node_Str" + (wolf.inv.getSize() + 9))) {
    return;
  }
  CustomMCInventory newinv=new CustomMCInventory(wolf.inv.getSize() + 9,wolf.Name + "String_Node_Str");
  for (int i=0; i < wolf.inv.getSize(); i++) {
    newinv.setItem(i,wolf.inv.getItem(i));
  }
  wolf.inv=newinv;
  wolf.sendMessageToOwner(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")).replace("String_Node_Str",wolf.Name).replace("String_Node_Str","String_Node_Str" + wolf.inv.getSize()));
}

Fixed version (ground truth):
@Override public void activate(MyWolf wolf,Object args){
  if (!MyWolfUtil.hasSkill(wolf.Abilities,"String_Node_Str")) {
    wolf.Abilities.put("String_Node_Str",true);
  }
  if (wolf.inv.getSize() >= 54) {
    return;
  }
  if (!MyWolfPermissions.has(wolf.getOwner(),"String_Node_Str" + (wolf.inv.getSize() + 9))) {
    return;
  }
  CustomMCInventory newinv=new CustomMCInventory(wolf.inv.getSize() + 9,"String_Node_Str");
  for (int i=0; i < wolf.inv.getSize(); i++) {
    newinv.setItem(i,wolf.inv.getItem(i));
  }
  wolf.inv=newinv;
  wolf.sendMessageToOwner(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")).replace("String_Node_Str",wolf.Name).replace("String_Node_Str","String_Node_Str" + wolf.inv.getSize()));
}
Program: 187677
Project: 187677
Buggy source:
@EventHandler() public void onEntityDeath(final EntityDeathEvent event){
  if (event.getEntity() instanceof Wolf) {
    for (    MyWolf wolf : ConfigBuffer.mWolves.values()) {
      if (wolf.getID() == event.getEntity().getEntityId()) {
        wolf.Status=WolfState.Dead;
        wolf.RespawnTime=MyWolfConfig.RespawnTimeFixed + (wolf.Experience.getLevel() * MyWolfConfig.RespawnTimeFactor);
        SendDeathMessage(event);
        wolf.sendMessageToOwner(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str").replace("String_Node_Str",wolf.Name).replace("String_Node_Str","String_Node_Str" + wolf.RespawnTime)));
        break;
      }
    }
  }
  if (MyWolfConfig.LevelSystem && event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
    if (((EntityDamageByEntityEvent)event.getEntity().getLastDamageCause()).getDamager() instanceof Wolf) {
      EntityDamageByEntityEvent e=(EntityDamageByEntityEvent)event.getEntity().getLastDamageCause();
      for (      MyWolf wolf : ConfigBuffer.mWolves.values()) {
        if (wolf.getID() == e.getDamager().getEntityId()) {
          if (MyWolfUtil.getCreatureType(e.getEntity()) != null) {
            if (MyWolfExperience.defaultEXPvalues) {
              wolf.Experience.addExp((double)event.getDroppedExp());
            }
 else {
              wolf.Experience.addEXP(MyWolfUtil.getCreatureType(e.getEntity()));
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@EventHandler() public void onEntityDeath(final EntityDeathEvent event){
  if (event.getEntity() instanceof Wolf) {
    for (    MyWolf wolf : ConfigBuffer.mWolves.values()) {
      if (wolf.getID() == event.getEntity().getEntityId()) {
        wolf.Status=WolfState.Dead;
        wolf.RespawnTime=MyWolfConfig.RespawnTimeFixed + (wolf.Experience.getLevel() * MyWolfConfig.RespawnTimeFactor);
        SendDeathMessage(event);
        wolf.sendMessageToOwner(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str").replace("String_Node_Str",wolf.Name).replace("String_Node_Str","String_Node_Str" + wolf.RespawnTime)));
        break;
      }
    }
  }
  if (MyWolfConfig.LevelSystem && event.getEntity().getLastDamageCause() instanceof EntityDamageByEntityEvent) {
    if (((EntityDamageByEntityEvent)event.getEntity().getLastDamageCause()).getDamager() instanceof Wolf) {
      EntityDamageByEntityEvent e=(EntityDamageByEntityEvent)event.getEntity().getLastDamageCause();
      for (      MyWolf wolf : ConfigBuffer.mWolves.values()) {
        if (wolf.getID() == e.getDamager().getEntityId()) {
          if (MyWolfUtil.getCreatureType(e.getEntity()) != null) {
            if (MyWolfExperience.defaultEXPvalues) {
              wolf.Experience.addExp((double)event.getDroppedExp());
            }
 else {
              wolf.Experience.addExp(MyWolfUtil.getCreatureType(e.getEntity()));
            }
          }
        }
      }
    }
  }
}
Program: 187678
Project: 187678
Buggy source:
@EventHandler() public void onLevelUp(MyWolfLevelUpEvent eventMyWolf){
  if (eventMyWolf.getWolf().Status == WolfState.Here && MyWolfConfig.SpoutSounds) {
    SpoutManager.getSoundManager().playCustomMusic(MyWolfPlugin.Plugin,(SpoutPlayer)eventMyWolf.getOwner(),MyWolfConfig.SpoutSoundLevelup,true);
  }
  if (ConfigBuffer.SkillPerLevel.containsKey(eventMyWolf.getLevel())) {
    for (    String skill : ConfigBuffer.SkillPerLevel.get(eventMyWolf.getLevel())) {
      if (ConfigBuffer.RegisteredSkills.containsKey(skill)) {
        ConfigBuffer.RegisteredSkills.get(skill).activate(eventMyWolf.getWolf(),0);
      }
    }
  }
}

Fixed version (ground truth):
@EventHandler() public void onLevelUp(MyWolfLevelUpEvent eventMyWolf){
  if (eventMyWolf.getWolf().Status == WolfState.Here && MyWolfConfig.SpoutSounds) {
    SpoutManager.getSoundManager().playCustomMusic(MyWolfPlugin.Plugin,(SpoutPlayer)eventMyWolf.getOwner(),MyWolfConfig.SpoutSoundLevelup,true);
    eventMyWolf.getWolf().sendMessageToOwner(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")).replace("String_Node_Str",eventMyWolf.getWolf().Name).replace("String_Node_Str","String_Node_Str" + eventMyWolf.getLevel()));
  }
  if (ConfigBuffer.SkillPerLevel.containsKey(eventMyWolf.getLevel())) {
    for (    String skill : ConfigBuffer.SkillPerLevel.get(eventMyWolf.getLevel())) {
      if (ConfigBuffer.RegisteredSkills.containsKey(skill)) {
        MyWolfUtil.Log.info(skill);
        ConfigBuffer.RegisteredSkills.get(skill).activate(eventMyWolf.getWolf(),0);
      }
    }
  }
}
Program: 187679
Project: 187679
Buggy source:
public MyWolf(String Owner){
  this.Owner=Owner;
  if (MyWolfConfig.LevelSystem)   this.inv=new CustomMCInventory(0,Owner);
 else   this.inv=new CustomMCInventory(54,Owner);
  Experience=new MyWolfExperience(this);
}

Fixed version (ground truth):
public MyWolf(String Owner){
  this.Owner=Owner;
  if (MyWolfConfig.LevelSystem) {
    this.inv=new CustomMCInventory(0,Owner);
  }
 else {
    this.inv=new CustomMCInventory(54,Owner);
  }
  Experience=new MyWolfExperience(this);
}
Program: 187681
Project: 187681
Buggy source:
public MyWolfExperience(MyWolf Wolf){
  this.Wolf=Wolf;
}

Fixed version (ground truth):
public MyWolfExperience(MyWolf Wolf){
  this.Wolf=Wolf;
  MyWolfPlugin.Plugin.getServer().getPluginManager().callEvent(new MyWolfLevelUpEvent(Wolf,1));
}
Program: 187682
Project: 187682
Buggy source:
public void setExp(double Exp){
  MyWolfExpEvent event=new MyWolfExpEvent(Wolf,this.getExp(),Exp);
  MyWolfPlugin.Plugin.getServer().getPluginManager().callEvent(event);
  if (event.isCancelled()) {
    return;
  }
  int tmplvl=getLevel();
  this.Exp=event.getEXP();
  for (int i=tmplvl; i < getLevel(); i++) {
    MyWolfPlugin.Plugin.getServer().getPluginManager().callEvent(new MyWolfLevelUpEvent(Wolf,i + 1));
  }
}

Fixed version (ground truth):
public void setExp(double Exp){
  MyWolfExpEvent event=new MyWolfExpEvent(Wolf,this.getExp(),Exp);
  MyWolfPlugin.Plugin.getServer().getPluginManager().callEvent(event);
  if (event.isCancelled()) {
    return;
  }
  int tmplvl=getLevel();
  MyWolfUtil.Log.info("String_Node_Str" + tmplvl);
  MyWolfUtil.Log.info("String_Node_Str" + this.Exp);
  this.Exp=event.getEXP();
  MyWolfUtil.Log.info("String_Node_Str" + this.Exp);
  MyWolfUtil.Log.info("String_Node_Str" + getLevel());
  for (int i=tmplvl; i < getLevel(); i++) {
    MyWolfUtil.Log.info("String_Node_Str" + (i + 1));
    MyWolfPlugin.Plugin.getServer().getPluginManager().callEvent(new MyWolfLevelUpEvent(Wolf,i + 1));
  }
}
Program: 187683
Project: 187683
Buggy source:
public void addExp(double Exp){
  MyWolfExpEvent event=new MyWolfExpEvent(Wolf,this.Exp,this.Exp+=Exp);
  MyWolfPlugin.Plugin.getServer().getPluginManager().callEvent(event);
  if (event.isCancelled()) {
    return;
  }
  int tmplvl=getLevel();
  this.Exp=event.getEXP();
  for (int i=tmplvl; i < getLevel(); i++) {
    MyWolfPlugin.Plugin.getServer().getPluginManager().callEvent(new MyWolfLevelUpEvent(Wolf,i + 1));
  }
}

Fixed version (ground truth):
public void addExp(CreatureType type){
  if (MobEXP.containsKey(type)) {
    MyWolfExpEvent event=new MyWolfExpEvent(Wolf,this.Exp,MobEXP.get(type) + this.Exp);
    MyWolfPlugin.Plugin.getServer().getPluginManager().callEvent(event);
    if (event.isCancelled()) {
      return;
    }
    int tmplvl=getLevel();
    MyWolfUtil.Log.info("String_Node_Str" + tmplvl);
    MyWolfUtil.Log.info("String_Node_Str" + this.Exp);
    this.Exp=event.getEXP();
    MyWolfUtil.Log.info("String_Node_Str" + this.Exp);
    MyWolfUtil.Log.info("String_Node_Str" + getLevel());
    for (int i=tmplvl; i < getLevel(); i++) {
      MyWolfUtil.Log.info("String_Node_Str" + (i + 1));
      MyWolfPlugin.Plugin.getServer().getPluginManager().callEvent(new MyWolfLevelUpEvent(Wolf,i + 1));
    }
  }
}
Program: 187684
Project: 187684
Buggy source:
public double getExp(){
  return Exp;
}

Fixed version (ground truth):
public double getExp(){
  return this.Exp;
}
Program: 187685
Project: 187685
Buggy source:
@Override public void activate(MyWolf wolf,Object args){
  if (!MyWolfPermissions.has(wolf.getOwner(),"String_Node_Str" + this.Name)) {
    return;
  }
  wolf.Healthregen-=1;
  wolf.sendMessageToOwner(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str").replace("String_Node_Str",wolf.Name)));
}

Fixed version (ground truth):
@Override public void activate(MyWolf wolf,Object args){
  if (!MyWolfPermissions.has(wolf.getOwner(),"String_Node_Str" + this.Name)) {
    return;
  }
  if (wolf.Healthregen > 1) {
    wolf.Healthregen-=1;
  }
  wolf.sendMessageToOwner(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str").replace("String_Node_Str",wolf.Name).replace("String_Node_Str","String_Node_Str" + wolf.Healthregen)));
}
Program: 187686
Project: 187686
Buggy source:
@Override public void run(MyWolf wolf,Object args){
  if (!MyWolfPermissions.has(wolf.getOwner(),"String_Node_Str" + this.Name)) {
    return;
  }
  if (MyWolfSkill.hasSkill(wolf.Abilities,"String_Node_Str")) {
    if (args != null && args instanceof Boolean) {
      wolf.isPickup=(Boolean)args;
    }
 else {
      if (wolf.isPickup) {
        wolf.isPickup=false;
        wolf.sendMessageToOwner("String_Node_Str");
      }
 else {
        wolf.isPickup=true;
        wolf.sendMessageToOwner("String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
@Override public void run(MyWolf wolf,Object args){
  if (!MyWolfPermissions.has(wolf.getOwner(),"String_Node_Str" + this.Name)) {
    return;
  }
  if (MyWolfSkill.hasSkill(wolf.Abilities,"String_Node_Str")) {
    if (args != null && args instanceof Boolean) {
      wolf.isPickup=(Boolean)args;
    }
 else {
      if (wolf.isPickup) {
        wolf.isPickup=false;
        wolf.sendMessageToOwner(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")).replace("String_Node_Str",wolf.Name));
      }
 else {
        wolf.isPickup=true;
        wolf.sendMessageToOwner(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")).replace("String_Node_Str",wolf.Name));
      }
    }
  }
}
Program: 187690
Project: 187690
Buggy source:
public void SetName(){
  String NameColor;
  if (MyWolfConfig.NameColor >= 0 && MyWolfConfig.NameColor <= 0xf) {
    NameColor="String_Node_Str" + MyWolfConfig.NameColor;
  }
 else {
    if (getHealth() > HealthMax / 3 * 2) {
      NameColor="String_Node_Str" + ChatColor.GREEN;
    }
 else     if (getHealth() > HealthMax / 3 * 1) {
      NameColor="String_Node_Str" + ChatColor.YELLOW;
    }
 else {
      NameColor="String_Node_Str" + ChatColor.RED;
    }
  }
  if (Status == WolfState.Here) {
    BukkitContrib.getAppearanceManager().setGlobalTitle(Wolf,NameColor + this.Name);
  }
}

Fixed version (ground truth):
public void SetName(int HP){
  String NameColor;
  if (MyWolfConfig.NameColor >= 0 && MyWolfConfig.NameColor <= 0xf) {
    NameColor="String_Node_Str" + MyWolfConfig.NameColor;
  }
 else {
    if (HP > HealthMax / 3 * 2) {
      NameColor="String_Node_Str" + ChatColor.GREEN;
    }
 else     if (HP > HealthMax / 3 * 1) {
      NameColor="String_Node_Str" + ChatColor.YELLOW;
    }
 else {
      NameColor="String_Node_Str" + ChatColor.RED;
    }
  }
  if (Status == WolfState.Here) {
    BukkitContrib.getAppearanceManager().setGlobalTitle(Wolf,NameColor + this.Name);
  }
}
Program: 187691
Project: 187691
Buggy source:
public int getHealth(){
  return HealthNow;
}

Fixed version (ground truth):
public int getHealth(){
  if (Status == WolfState.Here) {
    return Wolf.getHealth();
  }
 else {
    return HealthNow;
  }
}
Program: 187692
Project: 187692
Buggy source:
@Override public void activate(MyWolf wolf,Object args){
  if (MyWolfPermissions.has(wolf.getOwner(),"String_Node_Str" + this.Name) == false) {
    return;
  }
  wolf.HealthMax+=1;
  wolf.setHealth(wolf.HealthMax);
  wolf.sendMessageToOwner(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str").replace("String_Node_Str",wolf.Name)));
}

Fixed version (ground truth):
@Override public void activate(MyWolf wolf,Object args){
  if (MyWolfPermissions.has(wolf.getOwner(),"String_Node_Str" + this.Name) == false) {
    return;
  }
  if (wolf.HealthMax < 20) {
    wolf.HealthMax+=1;
    wolf.setHealth(wolf.HealthMax);
    wolf.sendMessageToOwner(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str").replace("String_Node_Str",wolf.Name)));
  }
}
Program: 187693
Project: 187693
Buggy source:
public static boolean isNPC(Player player){
  Plugin plugin=server.getPluginManager().getPlugin("String_Node_Str");
  if (plugin != null) {
    int version=Integer.parseInt(plugin.getDescription().getVersion().replace("String_Node_Str","String_Node_Str"),109);
    if (version <= 108) {
      return com.fullwall.Citizens.NPCs.NPCManager.isNPC(player);
    }
 else {
      return com.citizens.NPCs.NPCManager.isNPC(player);
    }
  }
  return false;
}

Fixed version (ground truth):
public static boolean isNPC(Player player){
  Plugin plugin=server.getPluginManager().getPlugin("String_Node_Str");
  if (plugin != null) {
    return com.citizens.npcs.NPCManager.isNPC(player);
  }
  return false;
}
Program: 187694
Project: 187694
Buggy source:
public void setStandart(){
  Config.setProperty("String_Node_Str",287);
  Config.setProperty("String_Node_Str",340);
  Config.setProperty("String_Node_Str",54);
  Config.setProperty("String_Node_Str",357);
  Config.setProperty("String_Node_Str",354);
  Config.setProperty("String_Node_Str",287);
  Config.setProperty("String_Node_Str",false);
  Config.setProperty("String_Node_Str",false);
  Config.setProperty("String_Node_Str",false);
  Config.setProperty("String_Node_Str",2);
  Config.setProperty("String_Node_Str",331);
  Config.setProperty("String_Node_Str",5);
  Config.setProperty("String_Node_Str",20);
  Config.setProperty("String_Node_Str",-1);
  Config.save();
}

Fixed version (ground truth):
public void setStandart(){
  setProperty("String_Node_Str",287);
  setProperty("String_Node_Str",340);
  setProperty("String_Node_Str",54);
  setProperty("String_Node_Str",357);
  setProperty("String_Node_Str",354);
  setProperty("String_Node_Str",287);
  setProperty("String_Node_Str",false);
  setProperty("String_Node_Str",false);
  setProperty("String_Node_Str",false);
  setProperty("String_Node_Str",2);
  setProperty("String_Node_Str",331);
  setProperty("String_Node_Str",5);
  setProperty("String_Node_Str",20);
  setProperty("String_Node_Str",-1);
  Config.save();
}
Program: 187696
Project: 187696
Buggy source:
private void DisplayName(){
  if (cb.Plugin.getServer().getPluginManager().getPlugin("String_Node_Str") != null) {
    BukkitContrib.getAppearanceManager().setGlobalTitle(MyWolf,ChatColor.AQUA + Name);
  }
}

Fixed version (ground truth):
private void DisplayName(){
  if (cb.hasBukkitContrib) {
    BukkitContrib.getAppearanceManager().setGlobalTitle(MyWolf,ChatColor.AQUA + Name);
  }
}
Program: 187697
Project: 187697
Buggy source:
public boolean onCommand(CommandSender sender,Command command,String label,String[] args){
  if (sender instanceof Player) {
    Player player=(Player)sender;
    if (cb.mWolves.containsKey(player.getName())) {
      if (cb.Permissions.has(player,"String_Node_Str") == false) {
        return true;
      }
      if (cb.mWolves.get(player.getName()).isDead == true || cb.mWolves.get(player.getName()).isThere == false) {
        sender.sendMessage(MyWolfUtil.SetColors(cb.lv.Msg_CallFirst));
        return true;
      }
      sender.sendMessage(MyWolfUtil.SetColors(cb.lv.Msg_StopAttack));
      cb.mWolves.get(player.getName()).MyWolf.setTarget((LivingEntity)null);
      return true;
    }
 else {
      sender.sendMessage(MyWolfUtil.SetColors(cb.lv.Msg_DontHaveWolf));
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean onCommand(CommandSender sender,Command command,String label,String[] args){
  if (sender instanceof Player) {
    Player player=(Player)sender;
    if (cb.mWolves.containsKey(player.getName())) {
      if (cb.Permissions.has(player,"String_Node_Str") == false) {
        return true;
      }
      if (cb.mWolves.get(player.getName()).isDead == true || cb.mWolves.get(player.getName()).isThere == false) {
        sender.sendMessage(MyWolfUtil.SetColors(cb.lv.Msg_CallFirst));
        return true;
      }
      sender.sendMessage(MyWolfUtil.SetColors(cb.lv.Msg_StopAttack).replace("String_Node_Str",cb.mWolves.get(player.getName()).Name));
      cb.mWolves.get(player.getName()).MyWolf.setTarget((LivingEntity)null);
      return true;
    }
 else {
      sender.sendMessage(MyWolfUtil.SetColors(cb.lv.Msg_DontHaveWolf));
    }
  }
  return true;
}
Program: 187699
Project: 187699
Buggy source:
public MyWolfLanguage(Configuration cfg){
  Config=cfg;
}

Fixed version (ground truth):
public MyWolfLanguage(Configuration cfg){
  Config=cfg;
  Config.load();
}
Program: 187702
Project: 187702
Buggy source:
@Override public void onEntityTarget(EntityTargetEvent event){
  if (!event.isCancelled()) {
    if (event.getEntity() instanceof Wolf) {
      for (      Wolves Wolf : ConfigBuffer.mWolves.values()) {
        if (Wolf.getID() == event.getEntity().getEntityId()) {
          Wolf.ResetSitTimer();
          if (Wolf.Behavior == de.Keyle.MyWolf.Wolves.BehaviorState.Friendly) {
            event.setCancelled(true);
          }
 else           if (Wolf.Behavior == BehaviorState.Raid) {
            if (event.getTarget() instanceof Player || (event.getTarget() instanceof Wolf && ((Wolf)event.getTarget()).isTamed() == true)) {
              continue;
            }
          }
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onEntityTarget(final EntityTargetEvent event){
  if (!event.isCancelled()) {
    if (event.getEntity() instanceof Wolf) {
      for (      Wolves Wolf : ConfigBuffer.mWolves.values()) {
        if (Wolf.getID() == event.getEntity().getEntityId()) {
          Wolf.ResetSitTimer();
          if (Wolf.Behavior == de.Keyle.MyWolf.Wolves.BehaviorState.Friendly) {
            event.setCancelled(true);
          }
 else           if (Wolf.Behavior == BehaviorState.Raid) {
            if (event.getTarget() instanceof Player || (event.getTarget() instanceof Wolf && ((Wolf)event.getTarget()).isTamed() == true)) {
              continue;
            }
          }
        }
      }
    }
  }
}
Program: 187704
Project: 187704
Buggy source:
@Override public void onPlayerQuit(PlayerQuitEvent event){
  if (ConfigBuffer.mWolves.containsKey(event.getPlayer().getName())) {
    Wolves Wolf=ConfigBuffer.mWolves.get(event.getPlayer().getName());
    if (Wolf.Status == WolfState.Here) {
      Wolf.removeWolf();
      if (Wolf.getLocation() == null) {
        Wolf.setLocation(event.getPlayer().getLocation());
      }
    }
    MyWolf.Plugin.SaveWolves(ConfigBuffer.WolvesConfig);
  }
}

Fixed version (ground truth):
@Override public void onPlayerQuit(final PlayerQuitEvent event){
  if (ConfigBuffer.mWolves.containsKey(event.getPlayer().getName())) {
    Wolves Wolf=ConfigBuffer.mWolves.get(event.getPlayer().getName());
    if (Wolf.Status == WolfState.Here) {
      Wolf.removeWolf();
      if (Wolf.getLocation() == null) {
        Wolf.setLocation(event.getPlayer().getLocation());
      }
    }
    Wolf.StopTimer();
    MyWolf.Plugin.SaveWolves(ConfigBuffer.WolvesConfig);
  }
}
Program: 187705
Project: 187705
Buggy source:
@Override public void onPlayerMove(PlayerMoveEvent event){
  if (ConfigBuffer.mWolves.containsKey(event.getPlayer().getName())) {
    Wolves Wolf=ConfigBuffer.mWolves.get(event.getPlayer().getName());
    Wolf.ResetSitTimer();
    if (Wolf.Status == WolfState.Here) {
      if (Wolf.getLocation().getWorld() != event.getPlayer().getLocation().getWorld()) {
        if (Wolf.isSitting() == false) {
          Wolf.removeWolf();
          Wolf.setLocation(event.getPlayer().getLocation());
          Wolf.createWolf(false);
        }
 else {
          Wolf.removeWolf();
        }
      }
 else       if (MyWolfUtil.getDistance(Wolf.getLocation(),event.getPlayer().getLocation()) > 75) {
        Wolf.removeWolf();
      }
    }
 else     if (Wolf.Status == WolfState.Despawned) {
      if (Wolf.getLocation().getWorld() == event.getPlayer().getLocation().getWorld()) {
        if (MyWolfUtil.getDistance(Wolf.getLocation(),event.getPlayer().getLocation()) < 75) {
          Wolf.createWolf(Wolf.isSitting());
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onPlayerMove(final PlayerMoveEvent event){
  if (ConfigBuffer.mWolves.containsKey(event.getPlayer().getName())) {
    Wolves Wolf=ConfigBuffer.mWolves.get(event.getPlayer().getName());
    Wolf.ResetSitTimer();
    if (Wolf.Status == WolfState.Here) {
      if (Wolf.getLocation().getWorld() != event.getPlayer().getLocation().getWorld()) {
        if (Wolf.isSitting() == false) {
          Wolf.removeWolf();
          Wolf.setLocation(event.getPlayer().getLocation());
          Wolf.createWolf(false);
        }
 else {
          Wolf.removeWolf();
        }
      }
 else       if (MyWolfUtil.getDistance(Wolf.getLocation(),event.getPlayer().getLocation()) > 75) {
        Wolf.removeWolf();
      }
    }
 else     if (Wolf.Status == WolfState.Despawned) {
      if (Wolf.getLocation().getWorld() == event.getPlayer().getLocation().getWorld()) {
        if (MyWolfUtil.getDistance(Wolf.getLocation(),event.getPlayer().getLocation()) < 75) {
          Wolf.createWolf(Wolf.isSitting());
        }
      }
    }
  }
}
Program: 187706
Project: 187706
Buggy source:
@Override public void onPlayerJoin(final PlayerJoinEvent event){
  if (ConfigBuffer.mWolves.containsKey(event.getPlayer().getName())) {
    Wolves Wolf=ConfigBuffer.mWolves.get(event.getPlayer().getName());
    if (MyWolfUtil.getDistance(Wolf.getLocation(),event.getPlayer().getLocation()) < 75) {
      Wolf.ResetSitTimer();
      Wolf.createWolf(Wolf.isSitting());
    }
 else {
      Wolf.Status=WolfState.Despawned;
    }
  }
}

Fixed version (ground truth):
@Override public void onPlayerJoin(final PlayerJoinEvent event){
  if (ConfigBuffer.mWolves.containsKey(event.getPlayer().getName())) {
    Wolves Wolf=ConfigBuffer.mWolves.get(event.getPlayer().getName());
    if (Wolf.Status == WolfState.Dead) {
      Wolf.Timer();
    }
 else     if (MyWolfUtil.getDistance(Wolf.getLocation(),event.getPlayer().getLocation()) < 75) {
      Wolf.ResetSitTimer();
      Wolf.createWolf(Wolf.isSitting());
    }
 else {
      Wolf.Status=WolfState.Despawned;
    }
  }
}
Program: 187709
Project: 187709
Buggy source:
public Pickup(){
  this.Name="String_Node_Str";
}

Fixed version (ground truth):
public Pickup(){
  this.Name="String_Node_Str";
  registerSkill();
}
Program: 187712
Project: 187712
Buggy source:
public boolean RespawnWolf(){
  if (Status == WolfState.Dead) {
    return false;
  }
 else {
    HealthNow=HealthMax;
    Location=getOwner().getLocation();
    getOwner().sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")).replace("String_Node_Str",Name));
    createWolf(false);
    RespawnTime=0;
    return true;
  }
}

Fixed version (ground truth):
public boolean RespawnWolf(){
  if (Status == WolfState.Here) {
    return false;
  }
 else {
    HealthNow=HealthMax;
    Location=getOwner().getLocation();
    getOwner().sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")).replace("String_Node_Str",Name));
    createWolf(false);
    RespawnTime=0;
    return true;
  }
}
Program: 187714
Project: 187714
Buggy source:
public boolean onCommand(CommandSender sender,Command command,String label,String[] args){
  if (sender instanceof Player) {
    Player player=(Player)sender;
    if (ConfigBuffer.mWolves.containsKey(player.getName())) {
      Wolves Wolf=ConfigBuffer.mWolves.get(player.getName());
      if (Wolf.Status == WolfState.Despawned) {
        sender.sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")));
        return true;
      }
      if (MyWolfUtil.hasSkill(Wolf.Abilities,"String_Node_Str") || MyWolfUtil.hasSkill(Wolf.Abilities,"String_Node_Str")) {
        ConfigBuffer.RegisteredSkills.get("String_Node_Str").run(Wolf,null);
      }
 else {
        sender.sendMessage("String_Node_Str");
      }
      return true;
    }
 else {
      sender.sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")));
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean onCommand(CommandSender sender,Command command,String label,String[] args){
  if (sender instanceof Player) {
    Player player=(Player)sender;
    if (ConfigBuffer.mWolves.containsKey(player.getName())) {
      Wolves Wolf=ConfigBuffer.mWolves.get(player.getName());
      if (Wolf.Status == WolfState.Despawned) {
        sender.sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")));
        return true;
      }
 else       if (Wolf.Status == WolfState.Dead) {
        sender.sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")).replace("String_Node_Str",ConfigBuffer.mWolves.get(player.getName()).Name).replace("String_Node_Str","String_Node_Str" + ConfigBuffer.mWolves.get(player.getName()).RespawnTime));
        return true;
      }
      if (MyWolfUtil.hasSkill(Wolf.Abilities,"String_Node_Str") || MyWolfUtil.hasSkill(Wolf.Abilities,"String_Node_Str")) {
        ConfigBuffer.RegisteredSkills.get("String_Node_Str").run(Wolf,null);
      }
 else {
        sender.sendMessage("String_Node_Str");
      }
      return true;
    }
 else {
      sender.sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")));
    }
  }
  return true;
}
Program: 187715
Project: 187715
Buggy source:
public boolean onCommand(CommandSender sender,Command command,String label,String[] args){
  if (sender instanceof Player) {
    Player player=(Player)sender;
    if (ConfigBuffer.mWolves.containsKey(player.getName())) {
      Wolves Wolf=ConfigBuffer.mWolves.get(player.getName());
      if (Wolf.Status == WolfState.Despawned) {
        sender.sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")));
        return true;
      }
      if (MyWolfUtil.hasSkill(Wolf.Abilities,"String_Node_Str")) {
        ConfigBuffer.RegisteredSkills.get("String_Node_Str").run(Wolf,null);
      }
 else {
        sender.sendMessage("String_Node_Str");
      }
      return true;
    }
 else {
      sender.sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")));
    }
  }
  return true;
}

Fixed version (ground truth):
public boolean onCommand(CommandSender sender,Command command,String label,String[] args){
  if (sender instanceof Player) {
    Player player=(Player)sender;
    if (ConfigBuffer.mWolves.containsKey(player.getName())) {
      Wolves Wolf=ConfigBuffer.mWolves.get(player.getName());
      if (Wolf.Status == WolfState.Despawned) {
        sender.sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")));
        return true;
      }
 else       if (Wolf.Status == WolfState.Dead) {
        sender.sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")).replace("String_Node_Str",ConfigBuffer.mWolves.get(player.getName()).Name).replace("String_Node_Str","String_Node_Str" + ConfigBuffer.mWolves.get(player.getName()).RespawnTime));
        return true;
      }
      if (MyWolfUtil.hasSkill(Wolf.Abilities,"String_Node_Str")) {
        ConfigBuffer.RegisteredSkills.get("String_Node_Str").run(Wolf,null);
      }
 else {
        sender.sendMessage("String_Node_Str");
      }
      return true;
    }
 else {
      sender.sendMessage(MyWolfUtil.SetColors(MyWolfLanguage.getString("String_Node_Str")));
    }
  }
  return true;
}
Program: 187716
Project: 187716
Buggy source:
public boolean isNPC(Player p){
  if (Plugin.getServer().getPluginManager().getPlugin("String_Node_Str") != null && com.fullwall.Citizens.NPCs.NPCManager.isNPC(p) == true) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean isNPC(Player p){
  if (Plugin.getServer().getPluginManager().getPlugin("String_Node_Str") != null) {
    return com.fullwall.Citizens.NPCs.NPCManager.isNPC(p);
  }
  return false;
}
Program: 187719
Project: 187719
Buggy source:
@Override public void onEntityDeath(EntityDeathEvent event){
  if (event.getEntity() instanceof Wolf) {
    for (    String owner : cb.mWolves.keySet()) {
      if (cb.mWolves.get(owner).ID == event.getEntity().getEntityId()) {
        if (cb.cv.WolfMaxLives > -1) {
          cb.mWolves.get(owner).Lives-=1;
          if (cb.mWolves.get(owner).Lives <= 0) {
            cb.mWolves.get(owner).StopDropTimer();
            for (            ItemStack is : cb.mWolves.get(owner).Inventory.getContents()) {
              cb.mWolves.get(owner).MyWolf.getWorld().dropItem(cb.mWolves.get(owner).getLocation(),new org.bukkit.inventory.ItemStack(is.id,is.count,(short)is.damage));
            }
            cb.mWolves.get(owner).getPlayer().sendMessage(ChatColor.AQUA + cb.mWolves.get(owner).Name + ChatColor.WHITE+ "String_Node_Str"+ ChatColor.RED+ "String_Node_Str"+ ChatColor.WHITE+ "String_Node_Str");
            cb.mWolves.remove(cb.mWolves.get(owner).getPlayer().getName());
            cb.Plugin.SaveWolves();
          }
 else {
            cb.mWolves.get(owner).StopDropTimer();
            cb.mWolves.get(owner).isDead=true;
            cb.mWolves.get(owner).RespawnTimer();
          }
        }
 else {
          cb.mWolves.get(owner).StopDropTimer();
          cb.mWolves.get(owner).isDead=true;
          cb.mWolves.get(owner).RespawnTimer();
        }
        SendDeathMessage(event);
        break;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onEntityDeath(EntityDeathEvent event){
  if (event.getEntity() instanceof Wolf) {
    for (    String owner : cb.mWolves.keySet()) {
      if (cb.mWolves.get(owner).ID == event.getEntity().getEntityId()) {
        if (cb.cv.WolfMaxLives > -1) {
          cb.mWolves.get(owner).Lives-=1;
          if (cb.mWolves.get(owner).Lives <= 0) {
            cb.mWolves.get(owner).StopDropTimer();
            for (            ItemStack is : cb.mWolves.get(owner).LargeInventory.getContents()) {
              cb.mWolves.get(owner).MyWolf.getWorld().dropItem(cb.mWolves.get(owner).getLocation(),new org.bukkit.inventory.ItemStack(is.id,is.count,(short)is.damage));
            }
            cb.mWolves.get(owner).getPlayer().sendMessage(ChatColor.AQUA + cb.mWolves.get(owner).Name + ChatColor.WHITE+ "String_Node_Str"+ ChatColor.RED+ "String_Node_Str"+ ChatColor.WHITE+ "String_Node_Str");
            cb.mWolves.remove(cb.mWolves.get(owner).getPlayer().getName());
            cb.Plugin.SaveWolves();
          }
 else {
            cb.mWolves.get(owner).StopDropTimer();
            cb.mWolves.get(owner).isDead=true;
            cb.mWolves.get(owner).RespawnTimer();
          }
        }
 else {
          cb.mWolves.get(owner).StopDropTimer();
          cb.mWolves.get(owner).isDead=true;
          cb.mWolves.get(owner).RespawnTimer();
        }
        SendDeathMessage(event);
        break;
      }
    }
  }
}
Program: 187722
Project: 187722
Buggy source:
@Override public void onPlayerJoin(final PlayerJoinEvent event){
  if (cb.mWolves.containsKey(event.getPlayer().getName())) {
    double dist=Math.sqrt(Math.pow(cb.mWolves.get(event.getPlayer().getName()).getLocation().getX() - event.getPlayer().getLocation().getX(),2.0D) + Math.pow(cb.mWolves.get(event.getPlayer().getName()).getLocation().getZ() - event.getPlayer().getLocation().getZ(),2.0D));
    if (dist < 75) {
      cb.mWolves.get(event.getPlayer().getName()).createWolf(cb.mWolves.get(event.getPlayer().getName()).isSitting);
    }
  }
}

Fixed version (ground truth):
@Override public void onPlayerJoin(final PlayerJoinEvent event){
  if (cb.mWolves.containsKey(event.getPlayer().getName())) {
    double dist=Math.sqrt(Math.pow(cb.mWolves.get(event.getPlayer().getName()).getLocation().getX() - event.getPlayer().getLocation().getX(),2.0D) + Math.pow(cb.mWolves.get(event.getPlayer().getName()).getLocation().getZ() - event.getPlayer().getLocation().getZ(),2.0D));
    if (dist < 75) {
      cb.mWolves.get(event.getPlayer().getName()).createWolf(cb.mWolves.get(event.getPlayer().getName()).isSitting);
    }
 else {
      cb.mWolves.get(event.getPlayer().getName()).isThere=false;
    }
  }
}
Program: 187724
Project: 187724
Buggy source:
public void run(){
  if (isThere == false || isDead == true || getPlayer() == null) {
    StopDropTimer();
  }
 else {
    if (getPlayer() != null) {
      try {
        for (        Entity e : MyWolf.getWorld().getEntities()) {
          if (e instanceof Item) {
            Item item=(Item)e;
            Vector distance=getLocation().toVector().add(new Vector(0.5,0,0.5)).subtract(item.getLocation().toVector());
            if (distance.lengthSquared() < 1.0 * cb.cv.WolfPickupRange * cb.cv.WolfPickupRange + 1) {
              int amountleft=Inventory.addItem(item);
              if (amountleft == 0) {
                e.remove();
              }
 else {
                if (item.getItemStack().getAmount() > amountleft) {
                  item.getItemStack().setAmount(amountleft);
                }
              }
            }
          }
        }
      }
 catch (      Exception e) {
        System.out.println("String_Node_Str");
        e.printStackTrace();
      }
    }
 else {
      StopDropTimer();
    }
  }
}

Fixed version (ground truth):
public void run(){
  if (isThere == false || isDead == true || getPlayer() == null) {
    StopDropTimer();
  }
 else {
    if (getPlayer() != null) {
      try {
        for (        Entity e : MyWolf.getWorld().getEntities()) {
          if (e instanceof Item) {
            Item item=(Item)e;
            Vector distance=getLocation().toVector().add(new Vector(0.5,0,0.5)).subtract(item.getLocation().toVector());
            if (distance.lengthSquared() < 1.0 * cb.cv.WolfPickupRange * cb.cv.WolfPickupRange + 1) {
              int amountleft=Inventory1.addItem(item);
              if (amountleft == 0) {
                e.remove();
              }
 else {
                if (item.getItemStack().getAmount() > amountleft) {
                  item.getItemStack().setAmount(amountleft);
                }
                if (InventoryMode == InventoryType.LARGE) {
                  amountleft=Inventory2.addItem(item);
                  if (amountleft == 0) {
                    e.remove();
                  }
 else {
                    if (item.getItemStack().getAmount() > amountleft) {
                      item.getItemStack().setAmount(amountleft);
                    }
                  }
                }
              }
            }
          }
        }
      }
 catch (      Exception e) {
        System.out.println("String_Node_Str");
        e.printStackTrace();
      }
    }
 else {
      StopDropTimer();
    }
  }
}
Program: 187725
Project: 187725
Buggy source:
public void createWolf(Wolf wolf){
  MyWolf=wolf;
  ID=MyWolf.getEntityId();
  Location=MyWolf.getLocation();
  isThere=true;
  isDead=false;
  if (cb.Permissions.has(getPlayer(),"String_Node_Str") && hasPickup == true) {
    DropTimer();
  }
}

Fixed version (ground truth):
public void createWolf(Wolf wolf){
  MyWolf=wolf;
  ID=MyWolf.getEntityId();
  Location=MyWolf.getLocation();
  isThere=true;
  isDead=false;
  DisplayName();
  if (cb.Permissions.has(getPlayer(),"String_Node_Str") && hasPickup == true) {
    DropTimer();
  }
}
Program: 187727
Project: 187727
Buggy source:
@Override public void onEntityDeath(EntityDeathEvent event){
  if (event.getEntity() instanceof Wolf) {
    for (    String owner : cb.mWolves.keySet()) {
      if (cb.mWolves.get(owner).ID == event.getEntity().getEntityId()) {
        if (cb.cv.WolfMaxLives > -1) {
          cb.mWolves.get(owner).Lives-=1;
          if (cb.mWolves.get(owner).Lives <= 0) {
            for (            ItemStack is : cb.mWolves.get(owner).Inventory.getContents()) {
              cb.mWolves.get(owner).MyWolf.getWorld().dropItem(cb.mWolves.get(owner).getLocation(),new org.bukkit.inventory.ItemStack(is.id,is.count,(short)is.damage));
            }
            cb.mWolves.get(owner).getPlayer().sendMessage(ChatColor.AQUA + cb.mWolves.get(owner).Name + ChatColor.WHITE+ "String_Node_Str"+ ChatColor.RED+ "String_Node_Str"+ ChatColor.WHITE+ "String_Node_Str");
            cb.mWolves.remove(cb.mWolves.get(owner).getPlayer().getName());
            cb.Plugin.SaveWolves();
          }
 else {
            cb.mWolves.get(owner).isDead=true;
            cb.mWolves.get(owner).RespawnTimer();
          }
        }
 else {
          cb.mWolves.get(owner).isDead=true;
          cb.mWolves.get(owner).RespawnTimer();
        }
        SendDeathMessage(event);
        break;
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onEntityDeath(EntityDeathEvent event){
  if (event.getEntity() instanceof Wolf) {
    for (    String owner : cb.mWolves.keySet()) {
      if (cb.mWolves.get(owner).ID == event.getEntity().getEntityId()) {
        if (cb.cv.WolfMaxLives > -1) {
          cb.mWolves.get(owner).Lives-=1;
          if (cb.mWolves.get(owner).Lives <= 0) {
            cb.mWolves.get(owner).StopDropTimer();
            for (            ItemStack is : cb.mWolves.get(owner).Inventory.getContents()) {
              cb.mWolves.get(owner).MyWolf.getWorld().dropItem(cb.mWolves.get(owner).getLocation(),new org.bukkit.inventory.ItemStack(is.id,is.count,(short)is.damage));
            }
            cb.mWolves.get(owner).getPlayer().sendMessage(ChatColor.AQUA + cb.mWolves.get(owner).Name + ChatColor.WHITE+ "String_Node_Str"+ ChatColor.RED+ "String_Node_Str"+ ChatColor.WHITE+ "String_Node_Str");
            cb.mWolves.remove(cb.mWolves.get(owner).getPlayer().getName());
            cb.Plugin.SaveWolves();
          }
 else {
            cb.mWolves.get(owner).StopDropTimer();
            cb.mWolves.get(owner).isDead=true;
            cb.mWolves.get(owner).RespawnTimer();
          }
        }
 else {
          cb.mWolves.get(owner).StopDropTimer();
          cb.mWolves.get(owner).isDead=true;
          cb.mWolves.get(owner).RespawnTimer();
        }
        SendDeathMessage(event);
        break;
      }
    }
  }
}
Program: 187730
Project: 187730
Buggy source:
public void DropTimer(){
  if (isThere == true) {
    DropTimer=cb.Plugin.getServer().getScheduler().scheduleSyncRepeatingTask(cb.Plugin,new Runnable(){
      public void run(){
        if (isThere == false || isDead == true || getPlayer() == null) {
          cb.Plugin.getServer().getScheduler().cancelTask(DropTimer);
        }
 else {
          if (getPlayer() != null) {
            try {
              for (              Entity e : MyWolf.getWorld().getEntities()) {
                if (e instanceof Item) {
                  Item item=(Item)e;
                  Vector distance=getLocation().toVector().add(new Vector(0.5,0,0.5)).subtract(item.getLocation().toVector());
                  if (distance.lengthSquared() < 1.0 * cb.cv.WolfPickupRange * cb.cv.WolfPickupRange + 1) {
                    int amountleft=Inventory.addItem(item);
                    if (amountleft == 0) {
                      e.remove();
                    }
 else {
                      if (item.getItemStack().getAmount() > amountleft) {
                        item.getItemStack().setAmount(amountleft);
                      }
                    }
                  }
                }
              }
            }
 catch (            Exception e) {
              System.out.println("String_Node_Str");
              e.printStackTrace();
            }
          }
 else {
            cb.Plugin.getServer().getScheduler().cancelTask(DropTimer);
          }
        }
      }
    }
,0L,20L);
  }
}

Fixed version (ground truth):
public void DropTimer(){
  if (isThere == true) {
    DropTimer=cb.Plugin.getServer().getScheduler().scheduleSyncRepeatingTask(cb.Plugin,new Runnable(){
      public void run(){
        if (isThere == false || isDead == true || getPlayer() == null) {
          StopDropTimer();
        }
 else {
          if (getPlayer() != null) {
            try {
              for (              Entity e : MyWolf.getWorld().getEntities()) {
                if (e instanceof Item) {
                  Item item=(Item)e;
                  Vector distance=getLocation().toVector().add(new Vector(0.5,0,0.5)).subtract(item.getLocation().toVector());
                  if (distance.lengthSquared() < 1.0 * cb.cv.WolfPickupRange * cb.cv.WolfPickupRange + 1) {
                    int amountleft=Inventory.addItem(item);
                    if (amountleft == 0) {
                      e.remove();
                    }
 else {
                      if (item.getItemStack().getAmount() > amountleft) {
                        item.getItemStack().setAmount(amountleft);
                      }
                    }
                  }
                }
              }
            }
 catch (            Exception e) {
              System.out.println("String_Node_Str");
              e.printStackTrace();
            }
          }
 else {
            StopDropTimer();
          }
        }
      }
    }
,0L,20L);
  }
}
Program: 187731
Project: 187731
Buggy source:
public void removeWolf(){
  isSitting=MyWolf.isSitting();
  HealthNow=MyWolf.getHealth();
  Location=MyWolf.getLocation();
  isThere=false;
  ((LivingEntity)MyWolf).remove();
  MyWolf=null;
}

Fixed version (ground truth):
public void removeWolf(){
  StopDropTimer();
  isSitting=MyWolf.isSitting();
  HealthNow=MyWolf.getHealth();
  Location=MyWolf.getLocation();
  isThere=false;
  ((LivingEntity)MyWolf).remove();
  MyWolf=null;
}
Program: 187732
Project: 187732
Buggy source:
public void run(){
  if (isThere == false || isDead == true || getPlayer() == null) {
    cb.Plugin.getServer().getScheduler().cancelTask(DropTimer);
  }
 else {
    if (getPlayer() != null) {
      try {
        for (        Entity e : MyWolf.getWorld().getEntities()) {
          if (e instanceof Item) {
            Item item=(Item)e;
            Vector distance=getLocation().toVector().add(new Vector(0.5,0,0.5)).subtract(item.getLocation().toVector());
            if (distance.lengthSquared() < 1.0 * cb.cv.WolfPickupRange * cb.cv.WolfPickupRange + 1) {
              int amountleft=Inventory.addItem(item);
              if (amountleft == 0) {
                e.remove();
              }
 else {
                if (item.getItemStack().getAmount() > amountleft) {
                  item.getItemStack().setAmount(amountleft);
                }
              }
            }
          }
        }
      }
 catch (      Exception e) {
        System.out.println("String_Node_Str");
        e.printStackTrace();
      }
    }
 else {
      cb.Plugin.getServer().getScheduler().cancelTask(DropTimer);
    }
  }
}

Fixed version (ground truth):
public void run(){
  if (isThere == false || isDead == true || getPlayer() == null) {
    StopDropTimer();
  }
 else {
    if (getPlayer() != null) {
      try {
        for (        Entity e : MyWolf.getWorld().getEntities()) {
          if (e instanceof Item) {
            Item item=(Item)e;
            Vector distance=getLocation().toVector().add(new Vector(0.5,0,0.5)).subtract(item.getLocation().toVector());
            if (distance.lengthSquared() < 1.0 * cb.cv.WolfPickupRange * cb.cv.WolfPickupRange + 1) {
              int amountleft=Inventory.addItem(item);
              if (amountleft == 0) {
                e.remove();
              }
 else {
                if (item.getItemStack().getAmount() > amountleft) {
                  item.getItemStack().setAmount(amountleft);
                }
              }
            }
          }
        }
      }
 catch (      Exception e) {
        System.out.println("String_Node_Str");
        e.printStackTrace();
      }
    }
 else {
      StopDropTimer();
    }
  }
}