nus-yam/ex-repair huggingface dataset:
Program: 86125
Project: 86125
Buggy source:
/** 
 * Leaves the current arena, won't do anything if not present in any arena
 * @param playername
 * @param fullLeave Determines if player left only minigame or the server
 */
public void leavePlayer(String playername,boolean fullLeave){
  if (!this.containsPlayer(playername)) {
    return;
  }
  this.players.remove(playername);
  MinigamesAPI.global_players.remove(playername);
  if (fullLeave) {
    return;
  }
  final Player p=Bukkit.getPlayer(playername);
  Util.clearInv(p);
  p.getInventory().setContents(pinv.get(playername));
  p.getInventory().setArmorContents(pinv_armor.get(playername));
  p.updateInventory();
  p.setWalkSpeed(0.2F);
  MinigamesAPI.getAPI().pinstances.get(plugin).getRewardsInstance().giveReward(playername);
  MinigamesAPI.global_players.remove(playername);
  final String arenaname=this.getName();
  Util.teleportPlayerFixed(p,this.mainlobby);
  Bukkit.getScheduler().runTaskLater(plugin,new Runnable(){
    public void run(){
      p.setFlying(false);
      if (!p.isOp()) {
        p.setAllowFlight(false);
      }
      if (pgamemode.containsKey(p.getName())) {
        p.setGameMode(pgamemode.get(p.getName()));
      }
      try {
        MinigamesAPI.getAPI().pinstances.get(plugin).scoreboardManager.removeScoreboard(arenaname,p);
      }
 catch (      Exception e) {
      }
    }
  }
,5L);
  if (this.getAllPlayers().size() < 1) {
    this.stop();
  }
}

Fixed version (ground truth):
/** 
 * Leaves the current arena, won't do anything if not present in any arena
 * @param playername
 * @param fullLeave Determines if player left only minigame or the server
 */
public void leavePlayer(String playername,boolean fullLeave){
  if (!this.containsPlayer(playername)) {
    return;
  }
  this.players.remove(playername);
  MinigamesAPI.global_players.remove(playername);
  if (fullLeave) {
    return;
  }
  final Player p=Bukkit.getPlayer(playername);
  Util.clearInv(p);
  p.getInventory().setContents(pinv.get(playername));
  p.getInventory().setArmorContents(pinv_armor.get(playername));
  p.updateInventory();
  p.setWalkSpeed(0.2F);
  MinigamesAPI.getAPI().pinstances.get(plugin).getRewardsInstance().giveReward(playername);
  MinigamesAPI.global_players.remove(playername);
  if (MinigamesAPI.getAPI().global_lost.containsKey(playername)) {
    MinigamesAPI.getAPI().global_lost.remove(playername);
  }
  final String arenaname=this.getName();
  Util.teleportPlayerFixed(p,this.mainlobby);
  Bukkit.getScheduler().runTaskLater(plugin,new Runnable(){
    public void run(){
      p.setFlying(false);
      if (!p.isOp()) {
        p.setAllowFlight(false);
      }
      if (pgamemode.containsKey(p.getName())) {
        p.setGameMode(pgamemode.get(p.getName()));
      }
      try {
        MinigamesAPI.getAPI().pinstances.get(plugin).scoreboardManager.removeScoreboard(arenaname,p);
      }
 catch (      Exception e) {
      }
    }
  }
,5L);
  if (this.getAllPlayers().size() < 1) {
    this.stop();
  }
}
Program: 86126
Project: 86126
Buggy source:
/** 
 * Starts the lobby countdown and the arena afterwards You can insta-start an arena by using Arena.start();
 */
public void startLobby(){
  if (currentstate != ArenaState.JOIN) {
    return;
  }
  this.setArenaState(ArenaState.STARTING);
  currentlobbycount=MinigamesAPI.getAPI().lobby_countdown;
  final Arena a=this;
  currenttaskid=Bukkit.getScheduler().runTaskTimer(MinigamesAPI.getAPI(),new Runnable(){
    public void run(){
      currentlobbycount--;
      if (currentlobbycount == 60 || currentlobbycount == 30 || currentlobbycount == 15 || currentlobbycount == 10 || currentlobbycount < 6) {
        for (        String p_ : a.getAllPlayers()) {
          if (Validator.isPlayerOnline(p_)) {
            Player p=Bukkit.getPlayer(p_);
            p.sendMessage(MinigamesAPI.getAPI().pinstances.get(plugin).getMessagesConfig().teleporting_to_arena_in.replaceAll("String_Node_Str",Integer.toString(currentlobbycount)));
          }
        }
      }
      if (currentlobbycount < 0) {
        Bukkit.getScheduler().runTaskLater(plugin,new Runnable(){
          public void run(){
            currentarena.getArena().start();
          }
        }
,10L);
        try {
          Bukkit.getScheduler().cancelTask(currenttaskid);
        }
 catch (        Exception e) {
        }
      }
    }
  }
,5L,20).getTaskId();
}

Fixed version (ground truth):
/** 
 * Starts the lobby countdown and the arena afterwards You can insta-start an arena by using Arena.start();
 */
public void startLobby(){
  if (currentstate != ArenaState.JOIN) {
    return;
  }
  this.setArenaState(ArenaState.STARTING);
  currentlobbycount=MinigamesAPI.getAPI().lobby_countdown;
  final Arena a=this;
  currenttaskid=Bukkit.getScheduler().runTaskTimer(MinigamesAPI.getAPI(),new Runnable(){
    public void run(){
      currentlobbycount--;
      if (currentlobbycount == 60 || currentlobbycount == 30 || currentlobbycount == 15 || currentlobbycount == 10 || currentlobbycount < 6) {
        for (        String p_ : a.getAllPlayers()) {
          if (Validator.isPlayerOnline(p_)) {
            Player p=Bukkit.getPlayer(p_);
            p.sendMessage(MinigamesAPI.getAPI().pinstances.get(plugin).getMessagesConfig().teleporting_to_arena_in.replaceAll("String_Node_Str",Integer.toString(currentlobbycount)));
          }
        }
      }
      if (currentlobbycount < 1) {
        Bukkit.getScheduler().runTaskLater(plugin,new Runnable(){
          public void run(){
            currentarena.getArena().start();
          }
        }
,10L);
        try {
          Bukkit.getScheduler().cancelTask(currenttaskid);
        }
 catch (        Exception e) {
        }
      }
    }
  }
,5L,20).getTaskId();
}
Program: 86127
Project: 86127
Buggy source:
@EventHandler public void onSignChange(SignChangeEvent event){
  Player p=event.getPlayer();
  if (event.getLine(0).toLowerCase().equalsIgnoreCase("String_Node_Str")) {
    if (event.getPlayer().hasPermission("String_Node_Str") || event.getPlayer().isOp()) {
      if (!event.getLine(1).equalsIgnoreCase("String_Node_Str")) {
        String arena=event.getLine(1);
        PluginInstance pli=MinigamesAPI.getAPI().pinstances.get(plugin);
        if (Validator.isArenaValid(plugin,arena)) {
          pli.getArenasConfig().getConfig().set("String_Node_Str" + arena + "String_Node_Str",p.getWorld().getName());
          pli.getArenasConfig().getConfig().set("String_Node_Str" + arena + "String_Node_Str",event.getBlock().getLocation().getBlockX());
          pli.getArenasConfig().getConfig().set("String_Node_Str" + arena + "String_Node_Str",event.getBlock().getLocation().getBlockY());
          pli.getArenasConfig().getConfig().set("String_Node_Str" + arena + "String_Node_Str",event.getBlock().getLocation().getBlockZ());
          pli.getArenasConfig().saveConfig();
          p.sendMessage(pli.getMessagesConfig().successfully_set.replaceAll("String_Node_Str","String_Node_Str"));
        }
 else {
          p.sendMessage(pli.getMessagesConfig().arena_invalid);
          event.getBlock().breakNaturally();
        }
        Arena a=pli.getArenaByName(arena);
        if (a != null) {
          a.setSignLocation(event.getBlock().getLocation());
          Util.updateSign(plugin,a,event);
        }
 else {
        }
      }
    }
  }
}

Fixed version (ground truth):
@EventHandler public void onSignChange(SignChangeEvent event){
  Player p=event.getPlayer();
  if (event.getLine(0).toLowerCase().equalsIgnoreCase("String_Node_Str")) {
    if (event.getPlayer().hasPermission("String_Node_Str") || event.getPlayer().isOp()) {
      if (!event.getLine(1).equalsIgnoreCase("String_Node_Str")) {
        String arena=event.getLine(1);
        PluginInstance pli=MinigamesAPI.getAPI().pinstances.get(plugin);
        if (Validator.isArenaValid(plugin,arena)) {
          pli.getArenasConfig().getConfig().set("String_Node_Str" + arena + "String_Node_Str",p.getWorld().getName());
          pli.getArenasConfig().getConfig().set("String_Node_Str" + arena + "String_Node_Str",event.getBlock().getLocation().getBlockX());
          pli.getArenasConfig().getConfig().set("String_Node_Str" + arena + "String_Node_Str",event.getBlock().getLocation().getBlockY());
          pli.getArenasConfig().getConfig().set("String_Node_Str" + arena + "String_Node_Str",event.getBlock().getLocation().getBlockZ());
          pli.getArenasConfig().saveConfig();
          p.sendMessage(pli.getMessagesConfig().successfully_set.replaceAll("String_Node_Str","String_Node_Str"));
        }
 else {
          p.sendMessage(pli.getMessagesConfig().arena_invalid.replaceAll("String_Node_Str",arena));
          event.getBlock().breakNaturally();
        }
        Arena a=pli.getArenaByName(arena);
        if (a != null) {
          a.setSignLocation(event.getBlock().getLocation());
          Util.updateSign(plugin,a,event);
        }
 else {
        }
      }
    }
  }
}
Program: 86128
Project: 86128
Buggy source:
/** 
 * Sets a new spawn for a multi-spawn arena without the need of a given index
 * @param plugin
 * @param arenaname
 * @param l Location of the spawn
 */
public void autoSetSpawn(JavaPlugin plugin,String arenaname,Location l){
  int count=Util.getAllSpawns(plugin,arenaname).size();
  Util.saveComponentForArena(plugin,arenaname,"String_Node_Str" + Integer.toString(count),l);
}

Fixed version (ground truth):
/** 
 * Sets a new spawn for a multi-spawn arena without the need of a given index
 * @param plugin
 * @param arenaname
 * @param l Location of the spawn
 * @return the automatically used index
 */
public int autoSetSpawn(JavaPlugin plugin,String arenaname,Location l){
  int count=Util.getAllSpawns(plugin,arenaname).size();
  Util.saveComponentForArena(plugin,arenaname,"String_Node_Str" + Integer.toString(count),l);
  return count;
}
Program: 86129
Project: 86129
Buggy source:
public static void teleportAllPlayers(ArrayList<String> players,ArrayList<Location> locs){
  Util.teleportAllPlayers(players,locs.get(0));
}

Fixed version (ground truth):
public static void teleportAllPlayers(ArrayList<String> players,ArrayList<Location> locs){
  int currentid=0;
  int locslength=locs.size();
  for (  String p_ : players) {
    Player p=Bukkit.getPlayer(p_);
    Util.teleportPlayerFixed(p,locs.get(currentid));
    currentid++;
    if (currentid > locslength - 1) {
      currentid=0;
    }
  }
}
Program: 86130
Project: 86130
Buggy source:
/** 
 * Joins the waiting lobby of an arena
 * @param playername
 */
public void joinPlayerLobby(String playername){
  if (this.getArenaState() != ArenaState.JOIN && this.getArenaState() != ArenaState.STARTING) {
    return;
  }
  if (this.getAllPlayers().size() > this.max_players - 1) {
    return;
  }
  if (this.getAllPlayers().size() == this.max_players - 1) {
    if (currentlobbycount > 16) {
      currentlobbycount=16;
    }
  }
  MinigamesAPI.getAPI().global_players.put(playername,this);
  this.players.add(playername);
  if (Validator.isPlayerValid(playername,this)) {
    final Player p=Bukkit.getPlayer(playername);
    if (shouldClearInventoryOnJoin) {
      pinv.put(playername,p.getInventory().getContents());
      pinv_armor.put(playername,p.getInventory().getArmorContents());
      if (this.getArenaType() == ArenaType.JUMPNRUN) {
        Util.teleportPlayerFixed(p,this.spawns.get(0));
      }
 else {
        Util.teleportPlayerFixed(p,this.waitinglobby);
      }
      Bukkit.getScheduler().runTaskLater(MinigamesAPI.getAPI(),new Runnable(){
        public void run(){
          Util.clearInv(p);
          p.getInventory().addItem(new ItemStack(plugin.getConfig().getInt("String_Node_Str")));
          p.updateInventory();
          pgamemode.put(p.getName(),p.getGameMode());
          p.setGameMode(GameMode.SURVIVAL);
        }
      }
,10L);
      if (this.getAllPlayers().size() > this.min_players - 1) {
        this.startLobby();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Joins the waiting lobby of an arena
 * @param playername
 */
public void joinPlayerLobby(String playername){
  if (this.getArenaState() != ArenaState.JOIN && this.getArenaState() != ArenaState.STARTING) {
    return;
  }
  if (this.getAllPlayers().size() > this.max_players - 1) {
    return;
  }
  if (this.getAllPlayers().size() == this.max_players - 1) {
    if (currentlobbycount > 16 && this.getArenaState() == ArenaState.STARTING) {
      currentlobbycount=16;
    }
  }
  MinigamesAPI.getAPI().global_players.put(playername,this);
  this.players.add(playername);
  if (Validator.isPlayerValid(playername,this)) {
    final Player p=Bukkit.getPlayer(playername);
    if (shouldClearInventoryOnJoin) {
      pinv.put(playername,p.getInventory().getContents());
      pinv_armor.put(playername,p.getInventory().getArmorContents());
      if (this.getArenaType() == ArenaType.JUMPNRUN) {
        Util.teleportPlayerFixed(p,this.spawns.get(0));
      }
 else {
        Util.teleportPlayerFixed(p,this.waitinglobby);
      }
      Bukkit.getScheduler().runTaskLater(MinigamesAPI.getAPI(),new Runnable(){
        public void run(){
          Util.clearInv(p);
          p.getInventory().addItem(new ItemStack(plugin.getConfig().getInt("String_Node_Str")));
          p.updateInventory();
          pgamemode.put(p.getName(),p.getGameMode());
          p.setGameMode(GameMode.SURVIVAL);
        }
      }
,10L);
      if (this.getAllPlayers().size() > this.min_players - 1) {
        this.startLobby();
      }
    }
  }
}
Program: 86131
Project: 86131
Buggy source:
/** 
 * Leaves the current arena, won't do anything if not present in any arena
 * @param playername
 * @param fullLeave Determines if player left only minigame or the server
 */
public void leavePlayer(String playername,boolean fullLeave){
  if (!this.containsPlayer(playername)) {
    return;
  }
  this.players.remove(playername);
  MinigamesAPI.global_players.remove(playername);
  if (fullLeave) {
    return;
  }
  final Player p=Bukkit.getPlayer(playername);
  Util.clearInv(p);
  p.getInventory().setContents(pinv.get(playername));
  p.getInventory().setArmorContents(pinv_armor.get(playername));
  p.updateInventory();
  MinigamesAPI.getAPI().pinstances.get(plugin).getRewardsInstance().giveReward(playername);
  MinigamesAPI.global_players.remove(playername);
  final String arenaname=this.getName();
  Util.teleportPlayerFixed(p,this.mainlobby);
  Bukkit.getScheduler().runTaskLater(plugin,new Runnable(){
    public void run(){
      p.setFlying(false);
      if (!p.isOp()) {
        p.setAllowFlight(false);
      }
      if (pgamemode.containsKey(p.getName())) {
        p.setGameMode(pgamemode.get(p.getName()));
      }
      try {
        MinigamesAPI.getAPI().pinstances.get(plugin).scoreboardManager.removeScoreboard(arenaname,p);
      }
 catch (      Exception e) {
      }
    }
  }
,5L);
}

Fixed version (ground truth):
/** 
 * Leaves the current arena, won't do anything if not present in any arena
 * @param playername
 * @param fullLeave Determines if player left only minigame or the server
 */
public void leavePlayer(String playername,boolean fullLeave){
  if (!this.containsPlayer(playername)) {
    return;
  }
  this.players.remove(playername);
  MinigamesAPI.global_players.remove(playername);
  if (fullLeave) {
    return;
  }
  final Player p=Bukkit.getPlayer(playername);
  Util.clearInv(p);
  p.getInventory().setContents(pinv.get(playername));
  p.getInventory().setArmorContents(pinv_armor.get(playername));
  p.updateInventory();
  MinigamesAPI.getAPI().pinstances.get(plugin).getRewardsInstance().giveReward(playername);
  MinigamesAPI.global_players.remove(playername);
  final String arenaname=this.getName();
  Util.teleportPlayerFixed(p,this.mainlobby);
  Bukkit.getScheduler().runTaskLater(plugin,new Runnable(){
    public void run(){
      p.setFlying(false);
      if (!p.isOp()) {
        p.setAllowFlight(false);
      }
      if (pgamemode.containsKey(p.getName())) {
        p.setGameMode(pgamemode.get(p.getName()));
      }
      try {
        MinigamesAPI.getAPI().pinstances.get(plugin).scoreboardManager.removeScoreboard(arenaname,p);
      }
 catch (      Exception e) {
      }
    }
  }
,5L);
  if (this.getAllPlayers().size() < 1) {
    this.stop();
  }
}
Program: 86133
Project: 86133
Buggy source:
/** 
 * Stops the arena and teleports all players to the mainlobby
 */
public void stop(){
  this.setArenaState(ArenaState.RESTARTING);
  ArrayList<String> temp=new ArrayList<String>(this.getAllPlayers());
  for (  String p_ : temp) {
    leavePlayer(p_,false);
  }
  if (this.getArenaType() == ArenaType.REGENERATION) {
    reset();
  }
 else {
    this.setArenaState(ArenaState.JOIN);
  }
  players.clear();
  pinv.clear();
  pinv_armor.clear();
}

Fixed version (ground truth):
/** 
 * Stops the arena and teleports all players to the mainlobby
 */
public void stop(){
  try {
    Bukkit.getScheduler().cancelTask(currenttaskid);
  }
 catch (  Exception e) {
  }
  this.setArenaState(ArenaState.RESTARTING);
  ArrayList<String> temp=new ArrayList<String>(this.getAllPlayers());
  for (  String p_ : temp) {
    leavePlayer(p_,false);
  }
  if (this.getArenaType() == ArenaType.REGENERATION) {
    reset();
  }
 else {
    this.setArenaState(ArenaState.JOIN);
  }
  players.clear();
  pinv.clear();
  pinv_armor.clear();
}
Program: 86134
Project: 86134
Buggy source:
/** 
 * Starts the lobby countdown and the arena afterwards You can insta-start an arena by using Arena.start();
 */
public void startLobby(){
  if (currentstate != ArenaState.JOIN) {
    return;
  }
  this.setArenaState(ArenaState.STARTING);
  final Arena a=this;
  currenttaskid=Bukkit.getScheduler().runTaskTimer(MinigamesAPI.getAPI(),new Runnable(){
    public void run(){
      currentlobbycount++;
      if (currentlobbycount == 60 || currentlobbycount == 30 || currentlobbycount == 15 || currentlobbycount == 10 || currentlobbycount < 6) {
        for (        String p_ : a.getAllPlayers()) {
          if (Validator.isPlayerOnline(p_)) {
            Player p=Bukkit.getPlayer(p_);
            p.sendMessage(MinigamesAPI.getAPI().pinstances.get(plugin).getMessagesConfig().teleporting_to_arena_in.replaceAll("String_Node_Str",Integer.toString(currentlobbycount)));
          }
        }
      }
      if (currentlobbycount > MinigamesAPI.getAPI().lobby_countdown) {
        currentarena.getArena().start();
        try {
          Bukkit.getScheduler().cancelTask(currenttaskid);
        }
 catch (        Exception e) {
        }
      }
    }
  }
,5L,20).getTaskId();
}

Fixed version (ground truth):
/** 
 * Starts the lobby countdown and the arena afterwards You can insta-start an arena by using Arena.start();
 */
public void startLobby(){
  if (currentstate != ArenaState.JOIN) {
    return;
  }
  this.setArenaState(ArenaState.STARTING);
  currentlobbycount=MinigamesAPI.getAPI().lobby_countdown;
  final Arena a=this;
  currenttaskid=Bukkit.getScheduler().runTaskTimer(MinigamesAPI.getAPI(),new Runnable(){
    public void run(){
      currentlobbycount--;
      if (currentlobbycount == 60 || currentlobbycount == 30 || currentlobbycount == 15 || currentlobbycount == 10 || currentlobbycount < 6) {
        for (        String p_ : a.getAllPlayers()) {
          if (Validator.isPlayerOnline(p_)) {
            Player p=Bukkit.getPlayer(p_);
            p.sendMessage(MinigamesAPI.getAPI().pinstances.get(plugin).getMessagesConfig().teleporting_to_arena_in.replaceAll("String_Node_Str",Integer.toString(currentlobbycount)));
          }
        }
      }
      if (currentlobbycount < 0) {
        Bukkit.getScheduler().runTaskLater(plugin,new Runnable(){
          public void run(){
            currentarena.getArena().start();
          }
        }
,10L);
        try {
          Bukkit.getScheduler().cancelTask(currenttaskid);
        }
 catch (        Exception e) {
        }
      }
    }
  }
,5L,20).getTaskId();
}
Program: 86135
Project: 86135
Buggy source:
/** 
 * Saves a given arena if it was set up properly.
 * @return Arena or null if setup failed
 */
public Arena saveArena(JavaPlugin plugin,String arenaname){
  if (!Validator.isArenaValid(plugin,arenaname)) {
    Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "String_Node_Str" + arenaname+ "String_Node_Str");
    return null;
  }
  Arena a=Util.initArena(plugin,arenaname);
  this.setArenaVIP(plugin,arenaname,false);
  MinigamesAPI.getAPI().pinstances.get(plugin).addArena(a);
  return a;
}

Fixed version (ground truth):
/** 
 * Saves a given arena if it was set up properly.
 * @return Arena or null if setup failed
 */
public Arena saveArena(JavaPlugin plugin,String arenaname){
  if (!Validator.isArenaValid(plugin,arenaname)) {
    Bukkit.getConsoleSender().sendMessage(ChatColor.RED + "String_Node_Str" + arenaname+ "String_Node_Str");
    return null;
  }
  PluginInstance pli=MinigamesAPI.getAPI().pinstances.get(plugin);
  if (pli.getArenaByName(arenaname) != null) {
    pli.removeArenaByName(arenaname);
  }
  Arena a=Util.initArena(plugin,arenaname);
  this.setArenaVIP(plugin,arenaname,false);
  pli.addArena(a);
  return a;
}
Program: 86138
Project: 86138
Buggy source:
public static void loadClasses(JavaPlugin plugin){
  if (MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().isSet("String_Node_Str")) {
    for (    String aclass : MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().getConfigurationSection("String_Node_Str").getKeys(false)) {
      AClass n=new AClass(plugin,aclass,Util.parseItems(MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().getString("String_Node_Str" + aclass + "String_Node_Str")));
      MinigamesAPI.getAPI().pinstances.get(plugin).aclasses.put(aclass,n);
      if (!MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().isSet("String_Node_Str" + aclass + "String_Node_Str") || !MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().isSet("String_Node_Str" + aclass + "String_Node_Str")) {
        plugin.getLogger().warning("String_Node_Str" + aclass + "String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
public static void loadClasses(JavaPlugin plugin){
  if (MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().isSet("String_Node_Str")) {
    for (    String aclass : MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().getConfigurationSection("String_Node_Str").getKeys(false)) {
      AClass n=new AClass(plugin,aclass,Util.parseItems(MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().getString("String_Node_Str" + aclass + "String_Node_Str")));
      MinigamesAPI.getAPI().pinstances.get(plugin).addAClass(aclass,n);
      if (!MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().isSet("String_Node_Str" + aclass + "String_Node_Str") || !MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().isSet("String_Node_Str" + aclass + "String_Node_Str")) {
        plugin.getLogger().warning("String_Node_Str" + aclass + "String_Node_Str");
      }
    }
  }
}
Program: 86139
Project: 86139
Buggy source:
public static void getClass(JavaPlugin plugin,String player){
  AClass c=MinigamesAPI.getAPI().pinstances.get(plugin).pclass.get(player);
  Player p=Bukkit.getServer().getPlayer(player);
  p.getInventory().clear();
  p.getInventory().setHelmet(null);
  p.getInventory().setChestplate(null);
  p.getInventory().setLeggings(null);
  p.getInventory().setBoots(null);
  p.updateInventory();
  p.getInventory().setContents(c.getItems());
  p.updateInventory();
}

Fixed version (ground truth):
public static void getClass(JavaPlugin plugin,String player){
  AClass c=MinigamesAPI.getAPI().pinstances.get(plugin).getPClasses().get(player);
  Player p=Bukkit.getServer().getPlayer(player);
  p.getInventory().clear();
  p.getInventory().setHelmet(null);
  p.getInventory().setChestplate(null);
  p.getInventory().setLeggings(null);
  p.getInventory().setBoots(null);
  p.updateInventory();
  p.getInventory().setContents(c.getItems());
  p.updateInventory();
}
Program: 86140
Project: 86140
Buggy source:
public static void openGUI(final JavaPlugin plugin,String p){
  IconMenu iconm=new IconMenu("String_Node_Str",27,new IconMenu.OptionClickEventHandler(){
    @Override public void onOptionClick(    IconMenu.OptionClickEvent event){
      String d=event.getName();
      Player p=event.getPlayer();
      if (MinigamesAPI.getAPI().pinstances.get(plugin).aclasses.containsKey(d)) {
        Classes.setClass(plugin,d,p.getName());
      }
      event.setWillClose(true);
    }
  }
,plugin);
  int c=0;
  for (  String ac : MinigamesAPI.getAPI().pinstances.get(plugin).aclasses.keySet()) {
    iconm.setOption(c,new ItemStack(Material.SLIME_BALL),ac,MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().getString("String_Node_Str" + ac + "String_Node_Str"));
    c++;
  }
  iconm.open(Bukkit.getPlayerExact(p));
}

Fixed version (ground truth):
public static void openGUI(final JavaPlugin plugin,String p){
  IconMenu iconm=new IconMenu("String_Node_Str",27,new IconMenu.OptionClickEventHandler(){
    @Override public void onOptionClick(    IconMenu.OptionClickEvent event){
      String d=event.getName();
      Player p=event.getPlayer();
      if (MinigamesAPI.getAPI().pinstances.get(plugin).getAClasses().containsKey(d)) {
        Classes.setClass(plugin,d,p.getName());
      }
      event.setWillClose(true);
    }
  }
,plugin);
  int c=0;
  for (  String ac : MinigamesAPI.getAPI().pinstances.get(plugin).getAClasses().keySet()) {
    iconm.setOption(c,new ItemStack(Material.SLIME_BALL),ac,MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().getString("String_Node_Str" + ac + "String_Node_Str"));
    c++;
  }
  iconm.open(Bukkit.getPlayerExact(p));
}
Program: 86141
Project: 86141
Buggy source:
@Override public void onOptionClick(IconMenu.OptionClickEvent event){
  String d=event.getName();
  Player p=event.getPlayer();
  if (MinigamesAPI.getAPI().pinstances.get(plugin).aclasses.containsKey(d)) {
    Classes.setClass(plugin,d,p.getName());
  }
  event.setWillClose(true);
}

Fixed version (ground truth):
@Override public void onOptionClick(IconMenu.OptionClickEvent event){
  String d=event.getName();
  Player p=event.getPlayer();
  if (MinigamesAPI.getAPI().pinstances.get(plugin).getAClasses().containsKey(d)) {
    Classes.setClass(plugin,d,p.getName());
  }
  event.setWillClose(true);
}
Program: 86142
Project: 86142
Buggy source:
public static void setClass(JavaPlugin plugin,String classname,String player){
  if (!kitPlayerHasPermission(plugin,classname,Bukkit.getPlayer(player))) {
    Bukkit.getPlayer(player).sendMessage(MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().getString("String_Node_Str"));
    return;
  }
  if (kitRequiresMoney(plugin,classname)) {
    kitTakeMoney(plugin,Bukkit.getPlayer(player),classname.toLowerCase());
  }
  MinigamesAPI.getAPI().pinstances.get(plugin).pclass.put(player,MinigamesAPI.getAPI().pinstances.get(plugin).aclasses.get(classname));
}

Fixed version (ground truth):
public static void setClass(JavaPlugin plugin,String classname,String player){
  if (!kitPlayerHasPermission(plugin,classname,Bukkit.getPlayer(player))) {
    Bukkit.getPlayer(player).sendMessage(MinigamesAPI.getAPI().pinstances.get(plugin).getClassesConfig().getConfig().getString("String_Node_Str"));
    return;
  }
  if (kitRequiresMoney(plugin,classname)) {
    kitTakeMoney(plugin,Bukkit.getPlayer(player),classname.toLowerCase());
  }
  MinigamesAPI.getAPI().pinstances.get(plugin).setPClass(player,MinigamesAPI.getAPI().pinstances.get(plugin).getAClasses().get(classname));
}
Program: 86143
Project: 86143
Buggy source:
public static boolean hasClass(JavaPlugin plugin,String player){
  return MinigamesAPI.getAPI().pinstances.get(plugin).pclass.containsKey(player);
}

Fixed version (ground truth):
public static boolean hasClass(JavaPlugin plugin,String player){
  return MinigamesAPI.getAPI().pinstances.get(plugin).getPClasses().containsKey(player);
}
Program: 86144
Project: 86144
Buggy source:
public void spectate(String playername){
  if (Validator.isPlayerValid(playername,this)) {
    Player p=Bukkit.getPlayer(playername);
    MinigamesAPI.getAPI().global_lost.put(playername,this);
    p.setAllowFlight(true);
    p.setFlying(true);
    Util.teleportPlayerFixed(p,this.spawns.get(0).add(0D,30D,0D));
    MinigamesAPI.getAPI().pinstances.get(plugin).scoreboardManager.updateScoreboard(this);
  }
}

Fixed version (ground truth):
public void spectate(String playername){
  if (Validator.isPlayerValid(playername,this)) {
    Player p=Bukkit.getPlayer(playername);
    MinigamesAPI.getAPI().global_lost.put(playername,this);
    p.setAllowFlight(true);
    p.setFlying(true);
    Location temp=this.spawns.get(0);
    Util.teleportPlayerFixed(p,temp.clone().add(0D,30D,0D));
    MinigamesAPI.getAPI().pinstances.get(plugin).scoreboardManager.updateScoreboard(this);
  }
}
Program: 86145
Project: 86145
Buggy source:
/** 
 * Leaves the current arena, won't do anything if not present in any arena
 * @param playername
 * @param fullLeave Determines if player left only minigame or the server
 */
public void leavePlayer(String playername,boolean fullLeave){
  if (!this.containsPlayer(playername)) {
    return;
  }
  this.players.remove(playername);
  MinigamesAPI.global_players.remove(playername);
  if (fullLeave) {
    return;
  }
  final Player p=Bukkit.getPlayer(playername);
  Util.clearInv(p);
  p.getInventory().setContents(pinv.get(playername));
  p.getInventory().setArmorContents(pinv_armor.get(playername));
  p.updateInventory();
  Util.teleportPlayerFixed(p,this.waitinglobby);
  Bukkit.getScheduler().runTaskLater(plugin,new Runnable(){
    public void run(){
      p.setFlying(false);
      if (!p.isOp()) {
        p.setAllowFlight(false);
      }
    }
  }
,5L);
}

Fixed version (ground truth):
/** 
 * Leaves the current arena, won't do anything if not present in any arena
 * @param playername
 * @param fullLeave Determines if player left only minigame or the server
 */
public void leavePlayer(String playername,boolean fullLeave){
  if (!this.containsPlayer(playername)) {
    return;
  }
  this.players.remove(playername);
  MinigamesAPI.global_players.remove(playername);
  if (fullLeave) {
    return;
  }
  final Player p=Bukkit.getPlayer(playername);
  Util.clearInv(p);
  p.getInventory().setContents(pinv.get(playername));
  p.getInventory().setArmorContents(pinv_armor.get(playername));
  p.updateInventory();
  Util.teleportPlayerFixed(p,this.mainlobby);
  Bukkit.getScheduler().runTaskLater(plugin,new Runnable(){
    public void run(){
      p.setFlying(false);
      if (!p.isOp()) {
        p.setAllowFlight(false);
      }
    }
  }
,5L);
}
Program: 86147
Project: 86147
Buggy source:
@EventHandler public void onSignUse(PlayerInteractEvent event){
  if (event.hasBlock()) {
    if (event.getClickedBlock().getType() == Material.SIGN_POST || event.getClickedBlock().getType() == Material.WALL_SIGN) {
      final Sign s=(Sign)event.getClickedBlock().getState();
      Arena arena=Util.getArenaBySignLocation(plugin,event.getClickedBlock().getLocation());
      if (arena != null) {
        arena.joinPlayerLobby(event.getPlayer().getName());
      }
    }
  }
  if (event.hasItem()) {
    final Player p=event.getPlayer();
    if (!MinigamesAPI.global_players.containsKey(p.getName())) {
      return;
    }
    if (event.getItem().getTypeId() == plugin.getConfig().getInt("String_Node_Str")) {
      Classes.openGUI(plugin,p.getName());
    }
  }
}

Fixed version (ground truth):
@EventHandler public void onSignUse(PlayerInteractEvent event){
  if (event.hasBlock()) {
    if (event.getClickedBlock().getType() == Material.SIGN_POST || event.getClickedBlock().getType() == Material.WALL_SIGN) {
      if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
        return;
      }
      final Sign s=(Sign)event.getClickedBlock().getState();
      Arena arena=Util.getArenaBySignLocation(plugin,event.getClickedBlock().getLocation());
      if (arena != null) {
        arena.joinPlayerLobby(event.getPlayer().getName());
      }
    }
  }
  if (event.hasItem()) {
    final Player p=event.getPlayer();
    if (!MinigamesAPI.global_players.containsKey(p.getName())) {
      return;
    }
    if (event.getItem().getTypeId() == plugin.getConfig().getInt("String_Node_Str")) {
      Classes.openGUI(plugin,p.getName());
    }
  }
}
Program: 86148
Project: 86148
Buggy source:
/** 
 * Sets up the API, stuff won't work without that
 * @param plugin_
 * @return
 */
public static MinigamesAPI setupAPI(JavaPlugin plugin_){
  ArenasConfig arenasconfig=new ArenasConfig(plugin_);
  MessagesConfig messagesconfig=new MessagesConfig(plugin_);
  ClassesConfig classesconfig=new ClassesConfig(plugin_);
  DefaultConfig.init(plugin_);
  pinstances.put(plugin_,new PluginInstance(plugin_,arenasconfig,messagesconfig,classesconfig,Util.loadArenas(plugin_,arenasconfig)));
  Bukkit.getPluginManager().registerEvents(new ArenaListener(plugin_),plugin_);
  return instance;
}

Fixed version (ground truth):
/** 
 * Sets up the API, stuff won't work without that
 * @param plugin_
 * @return
 */
public static MinigamesAPI setupAPI(JavaPlugin plugin_){
  ArenasConfig arenasconfig=new ArenasConfig(plugin_);
  MessagesConfig messagesconfig=new MessagesConfig(plugin_);
  ClassesConfig classesconfig=new ClassesConfig(plugin_);
  DefaultConfig.init(plugin_);
  pinstances.put(plugin_,new PluginInstance(plugin_,arenasconfig,messagesconfig,classesconfig));
  pinstances.get(plugin_).addLoadedArenas(Util.loadArenas(plugin_,arenasconfig));
  Bukkit.getPluginManager().registerEvents(new ArenaListener(plugin_),plugin_);
  return instance;
}
Program: 86149
Project: 86149
Buggy source:
public PluginInstance(JavaPlugin plugin,ArenasConfig arenasconfig,MessagesConfig messagesconfig,ClassesConfig classesconfig,ArrayList<Arena> arenas){
  this.arenasconfig=arenasconfig;
  this.messagesconfig=messagesconfig;
  this.classesconfig=classesconfig;
  this.arenas=arenas;
  this.plugin=plugin;
}

Fixed version (ground truth):
public PluginInstance(JavaPlugin plugin,ArenasConfig arenasconfig,MessagesConfig messagesconfig,ClassesConfig classesconfig){
  this.arenasconfig=arenasconfig;
  this.messagesconfig=messagesconfig;
  this.classesconfig=classesconfig;
  this.arenas=new ArrayList<Arena>();
  this.plugin=plugin;
}
Program: 86151
Project: 86151
Buggy source:
public static void init(JavaPlugin plugin){
  FileConfiguration config=plugin.getConfig();
  config.addDefault("String_Node_Str",399);
  config.addDefault("String_Node_Str",4);
  config.addDefault("String_Node_Str",2);
  config.addDefault("String_Node_Str",30);
  config.addDefault("String_Node_Str",10);
  config.options().copyDefaults(false);
  plugin.saveConfig();
}

Fixed version (ground truth):
public static void init(JavaPlugin plugin){
  FileConfiguration config=plugin.getConfig();
  config.addDefault("String_Node_Str",399);
  config.addDefault("String_Node_Str",4);
  config.addDefault("String_Node_Str",2);
  config.addDefault("String_Node_Str",30);
  config.addDefault("String_Node_Str",10);
  config.options().copyDefaults(true);
  plugin.saveConfig();
}
Program: 86152
Project: 86152
Buggy source:
public static Sign getSignFromArena(JavaPlugin plugin,String arena){
  Location b_=new Location(Bukkit.getServer().getWorld(MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig().getString("String_Node_Str" + arena + "String_Node_Str")),MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig().getInt("String_Node_Str" + arena + "String_Node_Str"),MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig().getInt("String_Node_Str" + arena + "String_Node_Str"),MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig().getInt("String_Node_Str" + arena + "String_Node_Str"));
  BlockState bs=b_.getBlock().getState();
  Sign s_=null;
  if (bs instanceof Sign) {
    s_=(Sign)bs;
  }
 else {
  }
  return s_;
}

Fixed version (ground truth):
public static Sign getSignFromArena(JavaPlugin plugin,String arena){
  if (!MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig().isSet("String_Node_Str" + arena + "String_Node_Str")) {
    return null;
  }
  Location b_=new Location(Bukkit.getServer().getWorld(MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig().getString("String_Node_Str" + arena + "String_Node_Str")),MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig().getInt("String_Node_Str" + arena + "String_Node_Str"),MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig().getInt("String_Node_Str" + arena + "String_Node_Str"),MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig().getInt("String_Node_Str" + arena + "String_Node_Str"));
  System.out.println(b_);
  BlockState bs=b_.getBlock().getState();
  Sign s_=null;
  if (bs instanceof Sign) {
    s_=(Sign)bs;
  }
 else {
  }
  return s_;
}
Program: 86153
Project: 86153
Buggy source:
public static Arena getArenaBySignLocation(JavaPlugin plugin,Location sign){
  for (  Arena arena : MinigamesAPI.getAPI().pinstances.get(plugin).getArenas()) {
    if (sign.distance(arena.getArena().getSignLocation()) < 2) {
      return arena;
    }
  }
  return null;
}

Fixed version (ground truth):
public static Arena getArenaBySignLocation(JavaPlugin plugin,Location sign){
  for (  Arena arena : MinigamesAPI.getAPI().pinstances.get(plugin).getArenas()) {
    if (sign != null && arena.getArena().getSignLocation() != null) {
      if (sign.distance(arena.getArena().getSignLocation()) < 2) {
        return arena;
      }
    }
  }
  return null;
}
Program: 86154
Project: 86154
Buggy source:
public static ArrayList<Location> getAllSpawns(JavaPlugin plugin,String arena){
  FileConfiguration config=MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig();
  ArrayList<Location> ret=new ArrayList<Location>();
  if (!config.isSet("String_Node_Str" + arena + "String_Node_Str")) {
    return ret;
  }
  for (  String spawn : config.getConfigurationSection("String_Node_Str" + arena + "String_Node_Str").getKeys(false)) {
    ret.add(getComponentForArena(plugin,arena,spawn));
  }
  return ret;
}

Fixed version (ground truth):
public static ArrayList<Location> getAllSpawns(JavaPlugin plugin,String arena){
  FileConfiguration config=MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig();
  ArrayList<Location> ret=new ArrayList<Location>();
  if (!config.isSet("String_Node_Str" + arena + "String_Node_Str")) {
    return ret;
  }
  for (  String spawn : config.getConfigurationSection("String_Node_Str" + arena + "String_Node_Str").getKeys(false)) {
    ret.add(getComponentForArena(plugin,arena,"String_Node_Str" + spawn));
  }
  return ret;
}
Program: 86155
Project: 86155
Buggy source:
public static ArrayList<Arena> loadArenas(JavaPlugin plugin,ArenasConfig cf){
  ArrayList<Arena> ret=new ArrayList<Arena>();
  FileConfiguration config=cf.getConfig();
  if (!config.isSet("String_Node_Str")) {
    return ret;
  }
  for (  String arena : config.getConfigurationSection("String_Node_Str").getKeys(false)) {
    ret.add(initArena(plugin,arena));
  }
  return ret;
}

Fixed version (ground truth):
public static ArrayList<Arena> loadArenas(JavaPlugin plugin,ArenasConfig cf){
  ArrayList<Arena> ret=new ArrayList<Arena>();
  FileConfiguration config=cf.getConfig();
  if (!config.isSet("String_Node_Str")) {
    return ret;
  }
  for (  String arena : config.getConfigurationSection("String_Node_Str").getKeys(false)) {
    if (Validator.isArenaValid(plugin,arena,cf.getConfig())) {
      ret.add(initArena(plugin,arena));
    }
  }
  return ret;
}
Program: 86157
Project: 86157
Buggy source:
/** 
 * returns true if given arena was set up correctly
 * @param arena
 * @return
 */
public static boolean isArenaValid(JavaPlugin plugin,String arena){
  FileConfiguration config=MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig();
  if (!config.isSet("String_Node_Str" + arena + "String_Node_Str") || !config.isSet("String_Node_Str" + arena + "String_Node_Str")) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * returns true if given arena was set up correctly
 * @param arena
 * @return
 */
public static boolean isArenaValid(JavaPlugin plugin,String arena,FileConfiguration cf){
  FileConfiguration config=cf;
  if (!config.isSet("String_Node_Str" + arena + "String_Node_Str") || !config.isSet("String_Node_Str" + arena + "String_Node_Str")) {
    return false;
  }
  return true;
}
Program: 86158
Project: 86158
Buggy source:
/** 
 * Sets up the API, stuff won't work without that
 * @param plugin_
 * @return
 */
public static MinigamesAPI setupAPI(JavaPlugin plugin_){
  ArenasConfig arenasconfig=new ArenasConfig(plugin_);
  MessagesConfig messagesconfig=new MessagesConfig(plugin_);
  ClassesConfig classesconfig=new ClassesConfig(plugin_);
  pinstances.put(plugin_,new PluginInstance(plugin_,arenasconfig,messagesconfig,classesconfig,Util.loadArenas(plugin_)));
  Bukkit.getPluginManager().registerEvents(new ArenaListener(plugin_),plugin_);
  return instance;
}

Fixed version (ground truth):
/** 
 * Sets up the API, stuff won't work without that
 * @param plugin_
 * @return
 */
public static MinigamesAPI setupAPI(JavaPlugin plugin_){
  ArenasConfig arenasconfig=new ArenasConfig(plugin_);
  MessagesConfig messagesconfig=new MessagesConfig(plugin_);
  ClassesConfig classesconfig=new ClassesConfig(plugin_);
  pinstances.put(plugin_,new PluginInstance(plugin_,arenasconfig,messagesconfig,classesconfig,Util.loadArenas(plugin_,arenasconfig)));
  Bukkit.getPluginManager().registerEvents(new ArenaListener(plugin_),plugin_);
  return instance;
}
Program: 86160
Project: 86160
Buggy source:
public ArenasConfig(JavaPlugin plugin){
  this.plugin=plugin;
}

Fixed version (ground truth):
public ArenasConfig(JavaPlugin plugin){
  this.plugin=plugin;
  this.getConfig().options().copyDefaults(true);
  this.saveConfig();
}
Program: 86161
Project: 86161
Buggy source:
public static ArrayList<Arena> loadArenas(JavaPlugin plugin){
  ArrayList<Arena> ret=new ArrayList<Arena>();
  FileConfiguration config=MinigamesAPI.getAPI().pinstances.get(plugin).getArenasConfig().getConfig();
  if (!config.isSet("String_Node_Str")) {
    return ret;
  }
  for (  String arena : config.getConfigurationSection("String_Node_Str").getKeys(false)) {
    ret.add(initArena(plugin,arena));
  }
  return ret;
}

Fixed version (ground truth):
public static ArrayList<Arena> loadArenas(JavaPlugin plugin,ArenasConfig cf){
  ArrayList<Arena> ret=new ArrayList<Arena>();
  FileConfiguration config=cf.getConfig();
  if (!config.isSet("String_Node_Str")) {
    return ret;
  }
  for (  String arena : config.getConfigurationSection("String_Node_Str").getKeys(false)) {
    ret.add(initArena(plugin,arena));
  }
  return ret;
}
Program: 86163
Project: 86163
Buggy source:
/** 
 * @param path The path of the Firebase data to GET. Note: do not include '.json' at the end of this path!
 * @param context Application context for broadcasting the intent
 * @param action The action string which should be passed in the intent to be broadcast
 */
public static void GET(final String path,final Context context,final String action){
  String url=String.format("String_Node_Str",FIREBASE_URL,path);
  StringRequest request=new StringRequest(Request.Method.GET,url,new Response.Listener<String>(){
    @Override public void onResponse(    String response){
      Intent intent=new Intent(action);
      intent.putExtra(action,response);
      LocalBroadcastManager manager=LocalBroadcastManager.getInstance(context);
      manager.sendBroadcast(intent);
    }
  }
,new Response.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError error){
      Log.e(TAG,error.toString());
    }
  }
);
  NetworkManager.getRequestQueue().add(request);
}

Fixed version (ground truth):
/** 
 * @param path The path of the Firebase data to GET. Note: do not include '.json' at the end of this path!
 * @param context Application context for broadcasting the intent
 * @param action The action string which should be passed in the intent to be broadcast
 */
public static void GET(final String path,final Context context,final String action){
  final String cachedResponse=getCachedResponse(context,path);
  if (cachedResponse != null) {
    Intent intent=new Intent(action);
    intent.putExtra(action,cachedResponse);
    LocalBroadcastManager manager=LocalBroadcastManager.getInstance(context);
    manager.sendBroadcast(intent);
  }
  String url=String.format("String_Node_Str",FIREBASE_URL,path);
  StringRequest request=new StringRequest(Request.Method.GET,url,new Response.Listener<String>(){
    @Override public void onResponse(    String response){
      if (cachedResponse == null || !cachedResponse.equals(response)) {
        Intent intent=new Intent(action);
        intent.putExtra(action,response);
        LocalBroadcastManager manager=LocalBroadcastManager.getInstance(context);
        manager.sendBroadcast(intent);
        cacheResponse(context,path,response);
      }
    }
  }
,new Response.ErrorListener(){
    @Override public void onErrorResponse(    VolleyError error){
      Log.e(TAG,error.toString());
    }
  }
);
  NetworkManager.getRequestQueue().add(request);
}
Program: 86164
Project: 86164
Buggy source:
@Override public ArrayList<String> getTokens(){
  ArrayList<String> result=new ArrayList<String>(skills);
  result.add(organization);
  result.addAll(Arrays.asList(name.split("String_Node_Str")));
  return result;
}

Fixed version (ground truth):
@Override public ArrayList<String> getTokens(){
  ArrayList<String> result=new ArrayList<String>();
  if (skills != null) {
    result.addAll(skills);
  }
  result.add(organization);
  result.addAll(Arrays.asList(name.split("String_Node_Str")));
  return result;
}
Program: 86165
Project: 86165
Buggy source:
/** 
 * Sorts the list passed in the constructor.
 * @param queriesString
 */
public void query(String queriesString){
  String[] queries=queriesString.split("String_Node_Str");
  ArrayList<HashMap<String,Double>> tokenCostsList=new ArrayList<HashMap<String,Double>>(queries.length);
  for (  String query : queries) {
    HashMap<String,Double> tokenCosts=getTokenCosts(query);
    tokenCostsList.add(tokenCosts);
  }
  HashMap<T,Double> objectCosts=new HashMap<T,Double>(mObjects.size());
  for (  T object : mObjects) {
    objectCosts.put(object,0d);
  }
  for (  Map.Entry<String,HashSet<T>> entry : mTokensMap.entrySet()) {
    for (    T object : entry.getValue()) {
      double cost=objectCosts.get(object);
      for (      HashMap<String,Double> tokenCosts : tokenCostsList) {
        cost+=tokenCosts.get(entry.getKey());
      }
      objectCosts.put(object,cost);
    }
  }
  final HashMap<T,Double> costs=objectCosts;
  Collections.sort(mObjects,new Comparator<T>(){
    @Override public int compare(    T lhs,    T rhs){
      double ls=costs.get(lhs);
      double rs=costs.get(rhs);
      return ls == rs ? 0 : (ls < rs ? 1 : -1);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Sorts the list passed in the constructor.
 * @param queriesString
 */
public void query(String queriesString){
  String[] queries;
  if ("String_Node_Str".equals(queriesString)) {
    queries=new String[0];
  }
 else {
    queries=queriesString.split("String_Node_Str");
  }
  String print="String_Node_Str";
  for (  String query : queries) {
    print+=query + "String_Node_Str";
  }
  Log.i(TAG,"String_Node_Str" + print);
  if (queries.length == 0) {
    Collections.sort(mObjects);
  }
 else {
    ArrayList<HashMap<String,Double>> tokenCostsList=new ArrayList<HashMap<String,Double>>(queries.length);
    for (    String query : queries) {
      HashMap<String,Double> tokenCosts=getTokenCosts(query);
      tokenCostsList.add(tokenCosts);
    }
    HashMap<T,Double> objectCosts=new HashMap<T,Double>(mObjects.size());
    for (    T object : mObjects) {
      objectCosts.put(object,0d);
    }
    for (    Map.Entry<String,HashSet<T>> entry : mTokensMap.entrySet()) {
      for (      T object : entry.getValue()) {
        double cost=objectCosts.get(object);
        for (        HashMap<String,Double> tokenCosts : tokenCostsList) {
          cost+=tokenCosts.get(entry.getKey());
        }
        objectCosts.put(object,cost);
      }
    }
    final HashMap<T,Double> costs=objectCosts;
    Collections.sort(mObjects,new Comparator<T>(){
      @Override public int compare(      T lhs,      T rhs){
        double ls=costs.get(lhs);
        double rs=costs.get(rhs);
        return ls == rs ? 0 : (ls < rs ? 1 : -1);
      }
    }
);
  }
}