nus-yam/ex-repair huggingface dataset:
Program: 89063
Project: 89063
Buggy source:
public static boolean hasRewardBlock(Player player){
  return player.hasPermission(permissionRewardBlock);
}

Fixed version (ground truth):
public static boolean hasRewardBlock(Player player){
  return player.hasPermission(REWARDS_BLOCK);
}
Program: 89064
Project: 89064
Buggy source:
@Override public BlockResponse processClickEvent(InventoryClickEvent event,ItemQuery block){
  boolean isCraftResult=event.getSlotType() == SlotType.RESULT;
  boolean isPotionResult=event.getSlot() < 3;
  InventoryType type=event.getInventory().getType();
  ItemStack toCraft=event.getCurrentItem();
  if (!ItemQuery.hasItems(toCraft))   return BlockResponse.FAILURE;
switch (type) {
case BREWING:
    if (isPotionResult && block.match(Material.BREWING_STAND)) {
      return new BlockResponse(type,ActionTypes.BREWING,Permissions.permissionRewardBrewing);
    }
case CRAFTING:
  if (isCraftResult) {
    return new BlockResponse(type,ActionTypes.CRAFTING,Permissions.permissionRewardCrafting);
  }
case WORKBENCH:
if (isCraftResult && block.match(Material.WORKBENCH)) {
  return new BlockResponse(type,ActionTypes.CRAFTING,Permissions.permissionRewardCrafting);
}
case FURNACE:
if (isCraftResult && (block.match(Material.FURNACE) || block.match(Material.BURNING_FURNACE))) {
return new BlockResponse(type,ActionTypes.SMELTING,Permissions.permissionRewardSmelting);
}
}
return BlockResponse.FAILURE;
}

Fixed version (ground truth):
@Override public BlockResponse processClickEvent(InventoryClickEvent event,ItemQuery block){
  boolean isCraftResult=event.getSlotType() == SlotType.RESULT;
  boolean isPotionResult=event.getSlot() < 3;
  InventoryType type=event.getInventory().getType();
  ItemStack toCraft=event.getCurrentItem();
  if (!ItemQuery.hasItems(toCraft))   return BlockResponse.FAILURE;
switch (type) {
case BREWING:
    if (isPotionResult && block.match(Material.BREWING_STAND)) {
      return new BlockResponse(type,ActionTypes.BREWING,Permissions.REWARDS_BREWING);
    }
case CRAFTING:
  if (isCraftResult) {
    return new BlockResponse(type,ActionTypes.CRAFTING,Permissions.REWARDS_CRAFTING);
  }
case WORKBENCH:
if (isCraftResult && block.match(Material.WORKBENCH)) {
  return new BlockResponse(type,ActionTypes.CRAFTING,Permissions.REWARDS_CRAFTING);
}
case FURNACE:
if (isCraftResult && (block.match(Material.FURNACE) || block.match(Material.BURNING_FURNACE))) {
return new BlockResponse(type,ActionTypes.SMELTING,Permissions.REWARDS_SMELTING);
}
}
return BlockResponse.FAILURE;
}
Program: 89065
Project: 89065
Buggy source:
@Override public void run(){
  final ItemStack[] postInv=player.getInventory().getContents();
  int newItemsCount=0;
  for (int i=0; i < preInv.length; i++) {
    ItemStack pre=preInv[i];
    ItemStack post=postInv[i];
    if (hasSameItem(compareItem,post) && (hasSameItem(compareItem,pre) || pre == null)) {
      newItemsCount+=post.getAmount() - (pre != null ? pre.getAmount() : 0);
    }
  }
  if (newItemsCount > 0) {
    int exp=action.rewardPlayer(provider,random,player,newItemsCount);
    action.emoteMessages(channelsProvider,channelsProvider.getFormatter(player,exp),player);
    if (debugger != null)     debugger.printDebug(this,"String_Node_Str",player.getName(),permissionRewardCrafting,exp,newItemsCount,compareItem.getType());
  }
}

Fixed version (ground truth):
@Override public void run(){
  final ItemStack[] postInv=player.getInventory().getContents();
  int newItemsCount=0;
  for (int i=0; i < preInv.length; i++) {
    ItemStack pre=preInv[i];
    ItemStack post=postInv[i];
    if (hasSameItem(compareItem,post) && (hasSameItem(compareItem,pre) || pre == null)) {
      newItemsCount+=post.getAmount() - (pre != null ? pre.getAmount() : 0);
    }
  }
  if (newItemsCount > 0) {
    int exp=action.rewardPlayer(provider,random,player,newItemsCount);
    action.emoteMessages(channelsProvider,channelsProvider.getFormatter(player,exp),player);
    if (debugger != null)     debugger.printDebug(this,"String_Node_Str",player.getName(),exp,newItemsCount,compareItem.getType());
  }
}
Program: 89066
Project: 89066
Buggy source:
private void schedulePostCraftingReward(final Player player,final RewardProvider provider,final ChannelProvider channelsProvider,final Action action,final ItemStack compareItem){
  final ItemStack[] preInv=player.getInventory().getContents();
  final int ticks=1;
  for (int i=0; i < preInv.length; i++) {
    preInv[i]=preInv[i] != null ? preInv[i].clone() : null;
  }
  Bukkit.getScheduler().scheduleSyncDelayedTask(parentPlugin,new Runnable(){
    @Override public void run(){
      final ItemStack[] postInv=player.getInventory().getContents();
      int newItemsCount=0;
      for (int i=0; i < preInv.length; i++) {
        ItemStack pre=preInv[i];
        ItemStack post=postInv[i];
        if (hasSameItem(compareItem,post) && (hasSameItem(compareItem,pre) || pre == null)) {
          newItemsCount+=post.getAmount() - (pre != null ? pre.getAmount() : 0);
        }
      }
      if (newItemsCount > 0) {
        int exp=action.rewardPlayer(provider,random,player,newItemsCount);
        action.emoteMessages(channelsProvider,channelsProvider.getFormatter(player,exp),player);
        if (debugger != null)         debugger.printDebug(this,"String_Node_Str",player.getName(),permissionRewardCrafting,exp,newItemsCount,compareItem.getType());
      }
    }
  }
,ticks);
}

Fixed version (ground truth):
private void schedulePostCraftingReward(final Player player,final RewardProvider provider,final ChannelProvider channelsProvider,final Action action,final ItemStack compareItem){
  final ItemStack[] preInv=player.getInventory().getContents();
  final int ticks=1;
  for (int i=0; i < preInv.length; i++) {
    preInv[i]=preInv[i] != null ? preInv[i].clone() : null;
  }
  Bukkit.getScheduler().scheduleSyncDelayedTask(parentPlugin,new Runnable(){
    @Override public void run(){
      final ItemStack[] postInv=player.getInventory().getContents();
      int newItemsCount=0;
      for (int i=0; i < preInv.length; i++) {
        ItemStack pre=preInv[i];
        ItemStack post=postInv[i];
        if (hasSameItem(compareItem,post) && (hasSameItem(compareItem,pre) || pre == null)) {
          newItemsCount+=post.getAmount() - (pre != null ? pre.getAmount() : 0);
        }
      }
      if (newItemsCount > 0) {
        int exp=action.rewardPlayer(provider,random,player,newItemsCount);
        action.emoteMessages(channelsProvider,channelsProvider.getFormatter(player,exp),player);
        if (debugger != null)         debugger.printDebug(this,"String_Node_Str",player.getName(),exp,newItemsCount,compareItem.getType());
      }
    }
  }
,ticks);
}
Program: 89067
Project: 89067
Buggy source:
/** 
 * Returns a shallow copy of this object with a different experience multiplier.
 * @param - newMultiplier New multiplier value.
 * @return Shallow copy of this object.
 */
public T withMultiplier(double newMultiplier);

Fixed version (ground truth):
/** 
 * Returns a shallow copy of this object with a different experience multiplier.
 * @param newMultiplier - New multiplier value.
 * @return Shallow copy of this object.
 */
public T withMultiplier(double newMultiplier);
Program: 89068
Project: 89068
Buggy source:
/** 
 * Creates a copy of this channel provider with shallow references to the same list of channel services, except with a different internal default reward type. 
 * @param config Configuration settings for the different services.
 * @return A shallow copy of this reward service provider.
 */
public ChannelProvider createView(){
  return new ChannelProvider(this);
}

Fixed version (ground truth):
/** 
 * Creates a copy of this channel provider with shallow references to the same list of channel services, except with a different internal default reward type. 
 * @return A shallow copy of this reward service provider.
 */
public ChannelProvider createView(){
  return new ChannelProvider(this);
}
Program: 89069
Project: 89069
Buggy source:
/** 
 * Retrieves the specific or single entity type of this matcher.
 * @return
 */
public EntityType getSpecific(){
  return specific;
}

Fixed version (ground truth):
/** 
 * Retrieves the specific or single entity type of this matcher.
 */
public EntityType getSpecific(){
  return specific;
}
Program: 89070
Project: 89070
Buggy source:
/** 
 * Whether or not the player actually can be rewarded (or penalized, if negative)  with the given amount of resources.
 * @param player - player to test.
 * @param amount - amount of resources to given or take away.
 * @return
 */
public boolean canReward(Player player,int amount);

Fixed version (ground truth):
/** 
 * Whether or not the player actually can be rewarded (or penalized, if negative)  with the given amount of resources.
 * @param player - player to test.
 * @param amount - amount of resources to given or take away.
 */
public boolean canReward(Player player,int amount);
Program: 89071
Project: 89071
Buggy source:
@Override public void onEnable(){
  RewardEconomy rewardEconomy;
  manager=getServer().getPluginManager();
  currentLogger=this.getLogger();
  informer=new ExperienceInformer();
  commandExperienceMod=new CommandExperienceMod(this);
  commandSpawn=new CommandSpawnExp(this);
  rewardProvider=new RewardProvider();
  channelProvider=new ChannelProvider();
  if (!hasEconomy())   economy=getRegistration(Economy.class);
  if (!hasChat())   chat=getRegistration(Chat.class);
  rewardProvider.register(new RewardExperience(),true);
  rewardProvider.register(new RewardVirtual(),true);
  rewardProvider.setDefaultReward(RewardTypes.EXPERIENCE);
  channelProvider.register(new HeroService(),true);
  if (hasEconomy()) {
    itemListener=new ItemRewardListener(this);
    rewardEconomy=new RewardEconomy(economy,this,itemListener);
    rewardProvider.register(rewardEconomy,true);
    itemListener.setReward(rewardEconomy);
    manager.registerEvents(itemListener,this);
  }
  try {
    loadDefaults(false);
    manager.registerEvents(listener,this);
    manager.registerEvents(informer,this);
  }
 catch (  IOException e) {
    currentLogger.severe("String_Node_Str" + e.getMessage());
  }
  getCommand(commandReload).setExecutor(commandExperienceMod);
  getCommand(commandSpawnExp).setExecutor(commandSpawn);
}

Fixed version (ground truth):
@Override public void onEnable(){
  RewardEconomy rewardEconomy;
  manager=getServer().getPluginManager();
  currentLogger=this.getLogger();
  informer=new ExperienceInformer();
  commandExperienceMod=new CommandExperienceMod(this);
  commandSpawn=new CommandSpawnExp(this);
  rewardProvider=new RewardProvider();
  channelProvider=new ChannelProvider();
  if (!hasEconomy())   economy=getRegistration(Economy.class);
  if (!hasChat())   chat=getRegistration(Chat.class);
  rewardProvider.register(new RewardExperience());
  rewardProvider.register(new RewardVirtual());
  rewardProvider.setDefaultReward(RewardTypes.EXPERIENCE);
  channelProvider.register(new HeroService());
  channelProvider.setDefaultService(HeroService.NAME);
  if (hasEconomy()) {
    itemListener=new ItemRewardListener(this);
    rewardEconomy=new RewardEconomy(economy,this,itemListener);
    rewardProvider.register(rewardEconomy);
    itemListener.setReward(rewardEconomy);
    manager.registerEvents(itemListener,this);
  }
  try {
    loadDefaults(false);
    manager.registerEvents(listener,this);
    manager.registerEvents(informer,this);
  }
 catch (  IOException e) {
    currentLogger.severe("String_Node_Str" + e.getMessage());
  }
  getCommand(commandReload).setExecutor(commandExperienceMod);
  getCommand(commandSpawnExp).setExecutor(commandSpawn);
}
Program: 89072
Project: 89072
Buggy source:
/** 
 * Determines whether or not the given service has been registered.
 * @param serviceName - name of the service to find.
 * @return TRUE if it has, FALSE otherwise.
 */
public boolean containsService(String serviceName){
  if (serviceName.equalsIgnoreCase(defaultService))   return nameLookup.containsKey(getDefaultService());
  return nameLookup.containsKey(serviceName);
}

Fixed version (ground truth):
/** 
 * Determines whether or not the given service has been registered.
 * @param serviceName - name of the service to find.
 * @return TRUE if it has, FALSE otherwise.
 */
public boolean containsService(String serviceName){
  if (serviceName.equalsIgnoreCase(defaultServiceName))   return nameLookup.containsKey(getDefaultService());
  return nameLookup.containsKey(serviceName);
}
Program: 89073
Project: 89073
Buggy source:
/** 
 * Registers a service in the system.
 * @param service - the service to register.
 * @param setDefault - TRUE to make this service default if the registration is successful. 
 * @return The previously registered service with this name, or NULL otherwise.
 * @throws NullArgumentException If service is null.
 */
public TService register(TService service,boolean setDefault){
  if (service == null)   throw new NullArgumentException("String_Node_Str");
  String name=service.getServiceName();
  if (name.equalsIgnoreCase(defaultService))   throw new IllegalArgumentException("String_Node_Str");
  TService result=setByName(name,service);
  if (result != null) {
    setDefaultService(name);
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Registers a service in the system.
 * @param service - the service to register.
 * @return The previously registered service with this name, or NULL otherwise.
 * @throws NullArgumentException If service is null.
 */
public TService register(TService service){
  if (service == null)   throw new NullArgumentException("String_Node_Str");
  String name=service.getServiceName();
  if (name.equalsIgnoreCase(defaultServiceName))   throw new IllegalArgumentException("String_Node_Str");
  return setByName(name,service);
}
Program: 89074
Project: 89074
Buggy source:
@Override public String getServiceName(){
  return "String_Node_Str";
}

Fixed version (ground truth):
@Override public String getServiceName(){
  return NAME;
}
Program: 89075
Project: 89075
Buggy source:
@Override public RewardService register(RewardService reward,boolean setDefault){
  if (reward == null)   throw new NullArgumentException("String_Node_Str");
  RewardTypes type=reward.getRewardType();
  if (type != RewardTypes.CUSTOM) {
    enumLookup.put(type,reward);
  }
 else   if (type == RewardTypes.DEFAULT) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return super.register(reward,setDefault);
}

Fixed version (ground truth):
@Override public RewardService register(RewardService reward){
  if (reward == null)   throw new NullArgumentException("String_Node_Str");
  RewardTypes type=reward.getRewardType();
  if (type != RewardTypes.CUSTOM) {
    enumLookup.put(type,reward);
  }
 else   if (type == RewardTypes.DEFAULT) {
    throw new IllegalArgumentException("String_Node_Str");
  }
  return super.register(reward);
}
Program: 89076
Project: 89076
Buggy source:
@Test public void testMerging(){
  Debugger debugger=new MockDebugger();
  RewardProvider provider=new RewardProvider();
  provider.register(new MockRewardable(RewardTypes.EXPERIENCE),false);
  provider.register(new MockRewardable(RewardTypes.VIRTUAL),false);
  provider.register(new MockRewardable(RewardTypes.ECONOMY),false);
  provider.setDefaultReward(RewardTypes.EXPERIENCE);
  String def="String_Node_Str";
  Configuration first=createConfig("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",debugger,provider);
  Configuration second=createConfig("String_Node_Str" + "String_Node_Str" + "String_Node_Str",debugger,provider);
  Configuration result=Configuration.fromMultiple(Lists.newArrayList(first,second),debugger);
  MobQuery queryBlace=MobQuery.fromAny(EntityType.BLAZE,DamageCause.ENTITY_ATTACK);
  MobQuery queryZombie=MobQuery.fromAny(EntityType.ZOMBIE,DamageCause.ENTITY_ATTACK);
  Action blaceAction=new Action();
  blaceAction.addReward(def,new Range(5));
  blaceAction.addReward("String_Node_Str",new Range(1));
  Action zombieAction=new Action(def,new Range(0));
  assertEquals(blaceAction,result.getExperienceDrop().get(queryBlace));
  assertEquals(zombieAction,result.getExperienceDrop().get(queryZombie));
}

Fixed version (ground truth):
@Test public void testMerging(){
  Debugger debugger=new MockDebugger();
  RewardProvider provider=new RewardProvider();
  provider.register(new MockRewardable(RewardTypes.EXPERIENCE));
  provider.register(new MockRewardable(RewardTypes.VIRTUAL));
  provider.register(new MockRewardable(RewardTypes.ECONOMY));
  provider.setDefaultReward(RewardTypes.EXPERIENCE);
  String def="String_Node_Str";
  Configuration first=createConfig("String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str",debugger,provider);
  Configuration second=createConfig("String_Node_Str" + "String_Node_Str" + "String_Node_Str",debugger,provider);
  Configuration result=Configuration.fromMultiple(Lists.newArrayList(first,second),debugger);
  MobQuery queryBlace=MobQuery.fromAny(EntityType.BLAZE,DamageCause.ENTITY_ATTACK);
  MobQuery queryZombie=MobQuery.fromAny(EntityType.ZOMBIE,DamageCause.ENTITY_ATTACK);
  Action blaceAction=new Action();
  blaceAction.addReward(def,new Range(5));
  blaceAction.addReward("String_Node_Str",new Range(1));
  Action zombieAction=new Action(def,new Range(0));
  assertEquals(blaceAction,result.getExperienceDrop().get(queryBlace));
  assertEquals(zombieAction,result.getExperienceDrop().get(queryZombie));
}
Program: 89077
Project: 89077
Buggy source:
private String getSafe(String[] args,int index){
  return args.length > 0 ? args[0] : "String_Node_Str";
}

Fixed version (ground truth):
private String getSafe(String[] args,int index){
  return args.length > index ? args[index] : "String_Node_Str";
}
Program: 89078
Project: 89078
Buggy source:
@EventHandler(priority=EventPriority.HIGH,ignoreCancelled=true) public void onBlockBreakEvent(PlayerLoginEvent event){
  Player player=event.getPlayer();
  if (event != null && player != null) {
    displayWarnings(player);
  }
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.HIGH,ignoreCancelled=true) public void onBlockBreakEvent(PlayerLoginEvent event){
  Player player=event.getPlayer();
  if (player != null) {
    displayWarnings(player);
  }
}
Program: 89079
Project: 89079
Buggy source:
@Override public void printWarning(Object sender,String message,Object... params){
  String warningMessage=Color.RED + "String_Node_Str" + message;
  currentLogger.warning(String.format(warningMessage,params));
  informer.addWarningMessage(String.format(message,params));
}

Fixed version (ground truth):
@Override public void printWarning(Object sender,String message,Object... params){
  String warningMessage=ChatColor.RED + "String_Node_Str" + message;
  currentLogger.warning(String.format(warningMessage,params));
  informer.addWarningMessage(String.format(message,params));
}
Program: 89080
Project: 89080
Buggy source:
private void loadFromConfig(FileConfiguration config){
  experienceDrop=new MobTree();
  simpleBlockReward=new ItemTree();
  simpleBonusReward=new ItemTree();
  simplePlacingReward=new ItemTree();
  simpleSmeltingReward=new ItemTree();
  simpleCraftingReward=new ItemTree();
  simpleBrewingReward=new ItemTree();
  complexBrewingReward=new PotionTree();
  if (config.isDouble(multiplierSetting))   multiplier=config.getDouble(multiplierSetting,1);
 else   multiplier=config.getInt(multiplierSetting,1);
  defaultRewardsDisabled=config.getBoolean(defaultRewardsSetting,true);
  loadMobs(config.getConfigurationSection("String_Node_Str"));
  loadItemActions(config.getConfigurationSection("String_Node_Str"));
}

Fixed version (ground truth):
private void loadFromConfig(FileConfiguration config){
  experienceDrop=new MobTree();
  simpleBlockReward=new ItemTree();
  simpleBonusReward=new ItemTree();
  simplePlacingReward=new ItemTree();
  simpleSmeltingReward=new ItemTree();
  simpleCraftingReward=new ItemTree();
  simpleBrewingReward=new ItemTree();
  complexBrewingReward=new PotionTree();
  if (config.isDouble(multiplierSetting))   multiplier=config.getDouble(multiplierSetting,1);
 else   multiplier=config.getInt(multiplierSetting,1);
  defaultRewardsDisabled=config.getBoolean(defaultRewardsSetting,true);
  rewardType=loadReward(config.getString(rewardTypeSetting));
  loadMobs(config.getConfigurationSection("String_Node_Str"));
  loadItemActions(config.getConfigurationSection("String_Node_Str"));
}
Program: 89081
Project: 89081
Buggy source:
private void loadDefaults(){
  FileConfiguration config=getConfig();
  File path=new File(getDataFolder(),"String_Node_Str");
  if (!path.exists()) {
    config.options().copyDefaults(true);
    saveConfig();
    currentLogger.info("String_Node_Str");
  }
  configuration=new Configuration(config,currentLogger);
}

Fixed version (ground truth):
private void loadDefaults(){
  FileConfiguration config=getConfig();
  File path=new File(getDataFolder(),"String_Node_Str");
  if (!path.exists()) {
    config.options().copyDefaults(true);
    saveConfig();
    currentLogger.info("String_Node_Str");
  }
  configuration=new Configuration(config,currentLogger);
  listener.setConfiguration(configuration);
switch (configuration.getRewardType()) {
case EXPERIENCE:
    listener.setRewardManager(new RewardExperience());
default :
  currentLogger.warning("String_Node_Str");
break;
}
}
Program: 89082
Project: 89082
Buggy source:
public static void spawnExperience(World world,Location corner,int amount){
  int xpSplit=getXPSplit(Math.abs(amount));
  int sign=amount > 0 ? 1 : -1;
  for (int current=0; current < amount; current+=xpSplit) {
    ExperienceOrb orb=world.spawn(corner,ExperienceOrb.class);
    orb.setExperience(sign * Math.min(amount - current,xpSplit));
  }
}

Fixed version (ground truth):
public static void spawnExperience(World world,Location corner,int amount){
  int xpSplit=getXPSplit(amount);
  if (amount < 0)   return;
  for (int current=0; current < amount; current+=xpSplit) {
    ExperienceOrb orb=world.spawn(corner,ExperienceOrb.class);
    orb.setExperience(Math.min(amount - current,xpSplit));
  }
}
Program: 89083
Project: 89083
Buggy source:
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void onEntityDeathEvent(EntityDeathEvent event){
  LivingEntity entity=event.getEntity();
  if (entity != null && entity.getKiller() != null) {
    Integer id=entity.getEntityId();
    MobQuery query=new MobQuery(entity,spawnReasonLookup.get(id));
    Range reward=configuration.getExperienceDrop().get(query);
    if (reward != null) {
      int xp=reward.sampleInt(random);
      event.setDroppedExp(xp);
      parentPlugin.printDebug("String_Node_Str" + id + "String_Node_Str"+ xp);
    }
 else     if (configuration.isDefaultRewardsDisabled()) {
      event.setDroppedExp(0);
      parentPlugin.printDebug("String_Node_Str" + id + "String_Node_Str");
    }
 else     if (!configuration.isDefaultRewardsDisabled()) {
      int expDropped=event.getDroppedExp();
      if (configuration.getMultiplier() != 1) {
        Range increase=new Range(expDropped * configuration.getMultiplier());
        int expChanged=increase.sampleInt(random);
        parentPlugin.printDebug("String_Node_Str" + id + "String_Node_Str"+ expChanged);
        event.setDroppedExp(expChanged);
      }
    }
    spawnReasonLookup.remove(id);
  }
}

Fixed version (ground truth):
@EventHandler(priority=EventPriority.HIGHEST,ignoreCancelled=true) public void onEntityDeathEvent(EntityDeathEvent event){
  LivingEntity entity=event.getEntity();
  boolean hasKiller=entity.getKiller() != null;
  if (entity != null) {
    Integer id=entity.getEntityId();
    MobQuery query=new MobQuery(entity,spawnReasonLookup.get(id));
    Range reward=configuration.getExperienceDrop().get(query);
    if (reward != null) {
      int xp=reward.sampleInt(random);
      event.setDroppedExp(xp);
      parentPlugin.printDebug("String_Node_Str" + id + "String_Node_Str"+ xp);
    }
 else     if (configuration.isDefaultRewardsDisabled() && hasKiller) {
      event.setDroppedExp(0);
      parentPlugin.printDebug("String_Node_Str" + id + "String_Node_Str");
    }
 else     if (!configuration.isDefaultRewardsDisabled() && hasKiller) {
      int expDropped=event.getDroppedExp();
      if (configuration.getMultiplier() != 1) {
        Range increase=new Range(expDropped * configuration.getMultiplier());
        int expChanged=increase.sampleInt(random);
        parentPlugin.printDebug("String_Node_Str" + id + "String_Node_Str"+ expChanged);
        event.setDroppedExp(expChanged);
      }
    }
    spawnReasonLookup.remove(id);
  }
}
Program: 89084
Project: 89084
Buggy source:
public void detachServicePolicy(String policyMap,String portProfile) throws CloudRuntimeException {
  String command=VsmCommand.getServicePolicy(policyMap,portProfile,false);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void detachServicePolicy(String policyMap,String portProfile) throws CloudRuntimeException {
  String command=VsmCommand.getServicePolicy(policyMap,portProfile,false);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    parseOkReply(sendAndReceive(command));
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89085
Project: 89085
Buggy source:
public void attachServicePolicy(String policyMap,String portProfile) throws CloudRuntimeException {
  String command=VsmCommand.getServicePolicy(policyMap,portProfile,true);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void attachServicePolicy(String policyMap,String portProfile) throws CloudRuntimeException {
  String command=VsmCommand.getServicePolicy(policyMap,portProfile,true);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    parseOkReply(sendAndReceive(command));
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89086
Project: 89086
Buggy source:
public void addPortProfile(String name,PortProfileType type,BindingType binding,SwitchPortMode mode,int vlanid) throws CloudRuntimeException {
  String command=VsmCommand.getAddPortProfile(name,type,binding,mode,vlanid);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    for (int i=0; i < s_retryCount; ++i) {
      send(command);
      VsmOkResponse response=new VsmOkResponse(receive().trim());
      if (!response.isResponseOk()) {
        if (i >= s_retryCount) {
          throw new CloudRuntimeException(response.toString());
        }
        try {
          Thread.sleep(1000);
        }
 catch (        final InterruptedException e) {
          s_logger.debug("String_Node_Str");
        }
      }
 else {
        break;
      }
    }
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void addPortProfile(String name,PortProfileType type,BindingType binding,SwitchPortMode mode,int vlanid) throws CloudRuntimeException {
  String command=VsmCommand.getAddPortProfile(name,type,binding,mode,vlanid);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    parseOkReply(sendAndReceive(command));
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89087
Project: 89087
Buggy source:
public PortProfile getPortProfileByName(String name) throws CloudRuntimeException {
  String command=VsmCommand.getPortProfile(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    String received=receive();
    VsmPortProfileResponse response=new VsmPortProfileResponse(received.trim());
    if (!response.isResponseOk()) {
      throw new CloudRuntimeException("String_Node_Str");
    }
 else {
      return response.getPortProfile();
    }
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public PortProfile getPortProfileByName(String name) throws CloudRuntimeException {
  String command=VsmCommand.getPortProfile(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    String received=sendAndReceive(command);
    VsmPortProfileResponse response=new VsmPortProfileResponse(received.trim());
    if (!response.isResponseOk()) {
      throw new CloudRuntimeException(response.toString());
    }
 else {
      return response.getPortProfile();
    }
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89088
Project: 89088
Buggy source:
public PolicyMap getPolicyMapByName(String name) throws CloudRuntimeException {
  String command=VsmCommand.getPolicyMap(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    String received=receive();
    VsmPolicyMapResponse response=new VsmPolicyMapResponse(received.trim());
    if (!response.isResponseOk()) {
      throw new CloudRuntimeException("String_Node_Str");
    }
 else {
      return response.getPolicyMap();
    }
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public PolicyMap getPolicyMapByName(String name) throws CloudRuntimeException {
  String command=VsmCommand.getPolicyMap(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    String received=sendAndReceive(command);
    VsmPolicyMapResponse response=new VsmPolicyMapResponse(received.trim());
    if (!response.isResponseOk()) {
      throw new CloudRuntimeException(response.toString());
    }
 else {
      return response.getPolicyMap();
    }
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89089
Project: 89089
Buggy source:
public void deletePolicyMap(String name) throws CloudRuntimeException {
  String command=VsmCommand.getDeletePolicyMap(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void deletePolicyMap(String name) throws CloudRuntimeException {
  String command=VsmCommand.getDeletePolicyMap(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    parseOkReply(sendAndReceive(command));
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89090
Project: 89090
Buggy source:
public void addPolicyMap(String name,int averageRate,int maxRate,int burstRate) throws CloudRuntimeException {
  String command=VsmCommand.getAddPolicyMap(name,averageRate,maxRate,burstRate);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void addPolicyMap(String name,int averageRate,int maxRate,int burstRate) throws CloudRuntimeException {
  String command=VsmCommand.getAddPolicyMap(name,averageRate,maxRate,burstRate);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    parseOkReply(sendAndReceive(command));
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89091
Project: 89091
Buggy source:
public void deletePortProfile(String name) throws CloudRuntimeException {
  String command=VsmCommand.getDeletePortProfile(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void deletePortProfile(String name) throws CloudRuntimeException {
  String command=VsmCommand.getDeletePortProfile(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    parseOkReply(sendAndReceive(command));
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89092
Project: 89092
Buggy source:
public void updatePortProfile(String name,SwitchPortMode mode,List<Pair<VsmCommand.OperationType,String>> params) throws CloudRuntimeException {
  String command=VsmCommand.getUpdatePortProfile(name,mode,params);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void updatePortProfile(String name,SwitchPortMode mode,List<Pair<VsmCommand.OperationType,String>> params) throws CloudRuntimeException {
  String command=VsmCommand.getUpdatePortProfile(name,mode,params);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    parseOkReply(sendAndReceive(command));
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89094
Project: 89094
Buggy source:
private String receive(){
  byte[] buffer=new byte[8192];
  InputStream inputStream=_session.getStdout();
  try {
    while (true) {
      if (inputStream.available() == 0) {
        int conditions=_session.waitForCondition(ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA | ChannelCondition.EOF,3000);
        if ((conditions & ChannelCondition.TIMEOUT) != 0) {
          break;
        }
        if ((conditions & ChannelCondition.EOF) != 0) {
          if ((conditions & (ChannelCondition.STDOUT_DATA | ChannelCondition.STDERR_DATA)) == 0) {
            break;
          }
        }
      }
      while (inputStream.available() > 0) {
        inputStream.read(buffer);
      }
    }
  }
 catch (  Exception e) {
    s_logger.error("String_Node_Str" + e.getMessage());
    throw new CloudRuntimeException("String_Node_Str" + e.getMessage());
  }
  return new String(buffer);
}

Fixed version (ground truth):
private String receive(){
  String response=new String("String_Node_Str");
  InputStream inputStream=_session.getStdout();
  try {
    Delimiter delimiter=new Delimiter();
    byte[] buffer=new byte[1024];
    int count=0;
    while (true) {
      int data=inputStream.read();
      if (data != -1) {
        byte[] dataStream=delimiter.parse(data);
        if (delimiter.endReached()) {
          response+=new String(buffer,0,count);
          break;
        }
        if (dataStream != null) {
          for (int i=0; i < dataStream.length; i++) {
            buffer[count]=dataStream[i];
            count++;
            if (count == 1024) {
              response+=new String(buffer,0,count);
              count=0;
            }
          }
        }
      }
 else {
        break;
      }
    }
  }
 catch (  final Exception e) {
    throw new CloudRuntimeException("String_Node_Str" + e.getMessage());
  }
  return response;
}
Program: 89095
Project: 89095
Buggy source:
public void detachServicePolicy(String policyMap,String portProfile) throws CloudRuntimeException {
  String command=VsmCommand.getServicePolicy(policyMap,portProfile,false);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void detachServicePolicy(String policyMap,String portProfile) throws CloudRuntimeException {
  String command=VsmCommand.getServicePolicy(policyMap,portProfile,false);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89096
Project: 89096
Buggy source:
public void attachServicePolicy(String policyMap,String portProfile) throws CloudRuntimeException {
  String command=VsmCommand.getServicePolicy(policyMap,portProfile,true);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void attachServicePolicy(String policyMap,String portProfile) throws CloudRuntimeException {
  String command=VsmCommand.getServicePolicy(policyMap,portProfile,true);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89097
Project: 89097
Buggy source:
public void addPortProfile(String name,PortProfileType type,BindingType binding,SwitchPortMode mode,int vlanid) throws CloudRuntimeException {
  String command=VsmCommand.getAddPortProfile(name,type,binding,mode,vlanid);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void addPortProfile(String name,PortProfileType type,BindingType binding,SwitchPortMode mode,int vlanid) throws CloudRuntimeException {
  String command=VsmCommand.getAddPortProfile(name,type,binding,mode,vlanid);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    for (int i=0; i < s_retryCount; ++i) {
      send(command);
      VsmOkResponse response=new VsmOkResponse(receive().trim());
      if (!response.isResponseOk()) {
        if (i >= s_retryCount) {
          throw new CloudRuntimeException(response.toString());
        }
        try {
          Thread.sleep(1000);
        }
 catch (        final InterruptedException e) {
          s_logger.debug("String_Node_Str");
        }
      }
 else {
        break;
      }
    }
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89098
Project: 89098
Buggy source:
public void queryStatus() throws CloudRuntimeException {
  String status="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ SSH_NETCONF_TERMINATOR;
  send(status);
  parseReply(receive());
}

Fixed version (ground truth):
public void queryStatus() throws CloudRuntimeException {
  String status="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str"+ SSH_NETCONF_TERMINATOR;
  send(status);
  parseOkReply(receive());
}
Program: 89099
Project: 89099
Buggy source:
public void deletePolicyMap(String name) throws CloudRuntimeException {
  String command=VsmCommand.getDeletePolicyMap(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void deletePolicyMap(String name) throws CloudRuntimeException {
  String command=VsmCommand.getDeletePolicyMap(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89100
Project: 89100
Buggy source:
public void addPolicyMap(String name,int averageRate,int maxRate,int burstRate) throws CloudRuntimeException {
  String command=VsmCommand.getPolicyMap(name,averageRate,maxRate,burstRate);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void addPolicyMap(String name,int averageRate,int maxRate,int burstRate) throws CloudRuntimeException {
  String command=VsmCommand.getPolicyMap(name,averageRate,maxRate,burstRate);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89101
Project: 89101
Buggy source:
public void deletePortProfile(String name) throws CloudRuntimeException {
  String command=VsmCommand.getDeletePortProfile(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void deletePortProfile(String name) throws CloudRuntimeException {
  String command=VsmCommand.getDeletePortProfile(name);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89102
Project: 89102
Buggy source:
public void updatePortProfile(String name,SwitchPortMode mode,List<Pair<VsmCommand.OperationType,String>> params) throws CloudRuntimeException {
  String command=VsmCommand.getUpdatePortProfile(name,mode,params);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}

Fixed version (ground truth):
public void updatePortProfile(String name,SwitchPortMode mode,List<Pair<VsmCommand.OperationType,String>> params) throws CloudRuntimeException {
  String command=VsmCommand.getUpdatePortProfile(name,mode,params);
  if (command != null) {
    command=command.concat(SSH_NETCONF_TERMINATOR);
    send(command);
    parseOkReply(receive());
  }
 else {
    throw new CloudRuntimeException("String_Node_Str");
  }
}
Program: 89103
Project: 89103
Buggy source:
private void encryptVNCPassword(Connection conn){
  s_logger.debug("String_Node_Str");
  PreparedStatement pstmt=null;
  ResultSet rs=null;
  try {
    int numRows=0;
    pstmt=conn.prepareStatement("String_Node_Str");
    rs=pstmt.executeQuery();
    if (rs.next()) {
      numRows=rs.getInt(1);
    }
    rs.close();
    pstmt.close();
    int offset=0;
    while (offset < numRows) {
      pstmt=conn.prepareStatement("String_Node_Str" + offset + "String_Node_Str");
      rs=pstmt.executeQuery();
      while (rs.next()) {
        long id=rs.getLong(1);
        String value=rs.getString(2);
        if (value == null) {
          continue;
        }
        String encryptedValue=DBEncryptionUtil.encrypt(value);
        pstmt=conn.prepareStatement("String_Node_Str");
        pstmt.setBytes(1,encryptedValue.getBytes("String_Node_Str"));
        pstmt.setLong(2,id);
        pstmt.executeUpdate();
        pstmt.close();
      }
      rs.close();
      offset+=500;
    }
  }
 catch (  SQLException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
catch (  UnsupportedEncodingException e) {
    throw new CloudRuntimeException("String_Node_Str",e);
  }
 finally {
    try {
      if (rs != null) {
        rs.close();
      }
      if (pstmt != null) {
        pstmt.close();
      }
    }
 catch (    SQLException e) {
    }
  }
  s_logger.debug("String_Node_Str");
}

Fixed version (ground truth):
private void encryptVNCPassword(Connection conn){
}
Program: 89105
Project: 89105
Buggy source:
@Override @DB public void postCreateSnapshot(Long volumeId,Long snapshotId,Long policyId,boolean backedUp){
  Long userId=getSnapshotUserId();
  SnapshotVO snapshot=_snapshotDao.findByIdIncludingRemoved(snapshotId);
  if (snapshot.isRecursive()) {
    postCreateRecurringSnapshotForPolicy(userId,volumeId,snapshotId,policyId);
  }
}

Fixed version (ground truth):
@Override @DB public void postCreateSnapshot(Long volumeId,Long snapshotId,Long policyId,boolean backedUp){
  Long userId=getSnapshotUserId();
  SnapshotVO snapshot=_snapshotDao.findById(snapshotId);
  if (snapshot != null && snapshot.isRecursive()) {
    postCreateRecurringSnapshotForPolicy(userId,volumeId,snapshotId,policyId);
  }
}
Program: 89107
Project: 89107
Buggy source:
/** 
 * This method just creates a XenServer network following the tunnel network naming convention
 */
private synchronized Network findOrCreateTunnelNetwork(Connection conn,long networkId){
  try {
    String nwName="String_Node_Str" + networkId;
    Network nw=null;
    Network.Record rec=new Network.Record();
    Set<Network> networks=Network.getByNameLabel(conn,nwName);
    if (networks.size() == 0) {
      rec.nameDescription="String_Node_Str" + networkId;
      rec.nameLabel=nwName;
      Map<String,String> otherConfig=new HashMap<String,String>();
      otherConfig.put("String_Node_Str","String_Node_Str");
      rec.otherConfig=otherConfig;
      nw=Network.create(conn,rec);
      enableXenServerNetwork(conn,nw,nwName,"String_Node_Str" + networkId);
      s_logger.debug("String_Node_Str" + nwName);
    }
 else {
      nw=networks.iterator().next();
      s_logger.debug("String_Node_Str" + nwName);
    }
    return nw;
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
}

Fixed version (ground truth):
/** 
 * This method just creates a XenServer network following the tunnel network naming convention
 */
private synchronized Network findOrCreateTunnelNetwork(Connection conn,long key){
  try {
    String nwName="String_Node_Str" + key;
    Network nw=null;
    Network.Record rec=new Network.Record();
    Set<Network> networks=Network.getByNameLabel(conn,nwName);
    if (networks.size() == 0) {
      rec.nameDescription="String_Node_Str" + key;
      rec.nameLabel=nwName;
      Map<String,String> otherConfig=new HashMap<String,String>();
      otherConfig.put("String_Node_Str","String_Node_Str");
      rec.otherConfig=otherConfig;
      nw=Network.create(conn,rec);
      enableXenServerNetwork(conn,nw,nwName,"String_Node_Str" + key);
      s_logger.debug("String_Node_Str" + nwName);
    }
 else {
      nw=networks.iterator().next();
      s_logger.debug("String_Node_Str" + nwName);
    }
    return nw;
  }
 catch (  Exception e) {
    s_logger.warn("String_Node_Str",e);
    return null;
  }
}