nus-yam/ex-repair huggingface dataset:
Program: 151269
Project: 151269
Buggy source:
protected final void fetchPermissions(){
  this.worldsOptions=new HashMap<String,Map<String,String>>();
  this.worldsPermissions=new HashMap<String,List<String>>();
  this.commonOptions=new HashMap<String,String>();
  this.commonPermissions=new LinkedList<String>();
  try {
    ResultSet results=this.db.selectQuery("String_Node_Str",this.getName(),this.type.ordinal());
    while (results.next()) {
      String permission=results.getString("String_Node_Str").trim();
      String world=results.getString("String_Node_Str").trim();
      String value=results.getString("String_Node_Str").trim();
      if (value.isEmpty()) {
        if (!world.isEmpty()) {
          List<String> worldPermissions=this.worldsPermissions.get(world);
          if (worldPermissions == null) {
            worldPermissions=new LinkedList<String>();
            this.worldsPermissions.put(world,worldPermissions);
          }
          worldPermissions.add(permission);
        }
 else {
          this.commonPermissions.add(permission);
        }
      }
 else {
        if (!world.isEmpty()) {
          Map<String,String> worldOptions=this.worldsOptions.get(world);
          if (worldOptions == null) {
            worldOptions=new HashMap<String,String>();
            worldsOptions.put(world,worldOptions);
          }
          worldOptions.put(permission,value);
        }
 else {
          commonOptions.put(permission,value);
        }
      }
    }
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
protected final void fetchPermissions(){
  this.worldsOptions=new HashMap<String,Map<String,String>>();
  this.worldsPermissions=new HashMap<String,List<String>>();
  this.commonOptions=new HashMap<String,String>();
  this.commonPermissions=new LinkedList<String>();
  try {
    ResultSet results=this.db.selectQuery("String_Node_Str",this.getName(),this.type.ordinal());
    while (results.next()) {
      String permission=results.getString("String_Node_Str").trim();
      String world=results.getString("String_Node_Str").trim();
      String value=results.getString("String_Node_Str").trim();
      if (value.isEmpty()) {
        if (!world.isEmpty()) {
          List<String> worldPermissions=this.worldsPermissions.get(world);
          if (worldPermissions == null) {
            worldPermissions=new LinkedList<String>();
            this.worldsPermissions.put(world,worldPermissions);
          }
          worldPermissions.add(permission);
        }
 else {
          this.commonPermissions.add(permission);
        }
      }
 else {
        if (!world.isEmpty()) {
          Map<String,String> worldOptions=this.worldsOptions.get(world);
          if (worldOptions == null) {
            worldOptions=new HashMap<String,String>();
            worldsOptions.put(world,worldOptions);
          }
          worldOptions.put(permission,value);
        }
 else {
          commonOptions.put(permission,value);
        }
      }
    }
    results.close();
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}
Program: 151270
Project: 151270
Buggy source:
protected final void fetchInfo(){
  try {
    ResultSet result=this.db.selectQuery("String_Node_Str",this.getName(),this.type.ordinal());
    if (result.next()) {
      this.prefix=result.getString("String_Node_Str");
      this.suffix=result.getString("String_Node_Str");
      this.setName(result.getString("String_Node_Str"));
      this.virtual=false;
    }
 else {
      this.prefix="String_Node_Str";
      this.suffix="String_Node_Str";
      this.virtual=true;
    }
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}

Fixed version (ground truth):
protected final void fetchInfo(){
  try {
    ResultSet result=this.db.selectQuery("String_Node_Str",this.getName(),this.type.ordinal());
    if (result.next()) {
      this.prefix=result.getString("String_Node_Str");
      this.suffix=result.getString("String_Node_Str");
      this.setName(result.getString("String_Node_Str"));
      this.virtual=false;
    }
 else {
      this.prefix="String_Node_Str";
      this.suffix="String_Node_Str";
      this.virtual=true;
    }
    result.close();
  }
 catch (  SQLException e) {
    throw new RuntimeException(e);
  }
}
Program: 151271
Project: 151271
Buggy source:
protected final ConfigurationSection getNode(String baseNode,String entityName){
  this.nodePath=FileBackend.buildPath(baseNode,entityName);
  ConfigurationSection entityNode=backend.permissions.getConfigurationSection(this.nodePath);
  if (entityNode != null) {
    this.virtual=false;
    return entityNode;
  }
  ConfigurationSection users=backend.permissions.getConfigurationSection(baseNode);
  if (users != null) {
    for (    Map.Entry<String,Object> entry : users.getValues(false).entrySet()) {
      if (entry.getKey().equalsIgnoreCase(entityName) && entry.getValue() instanceof ConfigurationSection) {
        this.setName(entry.getKey());
        this.nodePath=FileBackend.buildPath(baseNode,this.getName());
        this.virtual=false;
        return (ConfigurationSection)entry.getValue();
      }
    }
  }
  this.virtual=true;
  return backend.permissions.createSection(nodePath);
}

Fixed version (ground truth):
protected final ConfigurationSection getNode(String baseNode,String entityName){
  this.nodePath=FileBackend.buildPath(baseNode,entityName);
  ConfigurationSection entityNode=backend.permissions.getConfigurationSection(this.nodePath);
  if (entityNode != null) {
    this.virtual=false;
    return entityNode;
  }
  ConfigurationSection users=backend.permissions.getConfigurationSection(baseNode);
  if (users != null) {
    for (    Map.Entry<String,Object> entry : users.getValues(false).entrySet()) {
      if (entry.getKey().equalsIgnoreCase(entityName) && entry.getValue() instanceof ConfigurationSection) {
        this.setName(entry.getKey());
        this.nodePath=FileBackend.buildPath(baseNode,this.getName());
        this.virtual=false;
        return (ConfigurationSection)entry.getValue();
      }
    }
  }
  this.virtual=true;
  ConfigurationSection section=backend.permissions.createSection(nodePath);
  backend.permissions.set(nodePath,null);
  return section;
}
Program: 151272
Project: 151272
Buggy source:
public String getOwnOption(String option,String world){
  return this.getOwnOption(option,world,"String_Node_Str");
}

Fixed version (ground truth):
public String getOwnOption(String option,String world){
  return this.getOwnOption(option,world,null);
}
Program: 151273
Project: 151273
Buggy source:
/** 
 * Returns rank in ranking system. 0 if group is not ranked
 * @return 
 */
public int getRank(){
  return this.getOwnOptionInteger("String_Node_Str","String_Node_Str",0);
}

Fixed version (ground truth):
/** 
 * Returns rank in ranking system. 0 if group is not ranked
 * @return 
 */
public int getRank(){
  return this.getOwnOptionInteger("String_Node_Str",null,0);
}
Program: 151274
Project: 151274
Buggy source:
public String getOwnOption(String option,String world){
  return this.getOwnOption(option,world,"String_Node_Str");
}

Fixed version (ground truth):
public String getOwnOption(String option,String world){
  return this.getOwnOption(option,world,null);
}
Program: 151277
Project: 151277
Buggy source:
/** 
 * Reset in-memory object of specified user
 * @param userName user's name
 */
public void resetUser(String userName){
  this.users.remove(userName);
}

Fixed version (ground truth):
/** 
 * Reset in-memory object of specified user
 * @param userName user's name
 */
public void resetUser(String userName){
  this.users.remove(userName.toLowerCase());
}
Program: 151282
Project: 151282
Buggy source:
@Override public void setPermissions(String[] permissions,String world){
  if (world == null) {
    world="String_Node_Str";
  }
  this.db.updateQuery("String_Node_Str",this.getName(),this.type.ordinal(),world);
  for (  String permission : permissions) {
    this.db.updateQuery("String_Node_Str",this.getName(),permission,world,this.type.ordinal());
  }
  if (this.isVirtual()) {
    this.save();
  }
  this.fetchPermissions();
}

Fixed version (ground truth):
@Override public void setPermissions(String[] permissions,String world){
  if (world == null) {
    world="String_Node_Str";
  }
  this.db.updateQuery("String_Node_Str",this.getName(),this.type.ordinal(),world);
  for (int i=permissions.length - 1; i >= 0; i--) {
    this.db.updateQuery("String_Node_Str",this.getName(),permissions[i],world,this.type.ordinal());
  }
  if (this.isVirtual()) {
    this.save();
  }
  this.fetchPermissions();
}
Program: 151283
Project: 151283
Buggy source:
@Override public void onPluginEnable(PluginEnableEvent event){
  calculateParentPermissions();
}

Fixed version (ground truth):
@Override public void onPluginEnable(PluginEnableEvent event){
  List<Permission> pluginPermissions=event.getPlugin().getDescription().getPermissions();
  for (  Permission permission : pluginPermissions) {
    calculatePermissionChildren(permission);
  }
}
Program: 151284
Project: 151284
Buggy source:
public BukkitPermissions(Plugin plugin,ConfigurationNode config){
  this.plugin=plugin;
  if (!config.getBoolean("String_Node_Str",true)) {
    logger.info("String_Node_Str");
    return;
  }
  this.strictMode=config.getBoolean("String_Node_Str",strictMode);
  this.enableParentNodes=config.getBoolean("String_Node_Str",this.enableParentNodes);
  this.registerEvents();
  if (this.enableParentNodes) {
    this.calculateParentPermissions();
  }
  logger.info("String_Node_Str");
}

Fixed version (ground truth):
public BukkitPermissions(Plugin plugin,ConfigurationNode config){
  this.plugin=plugin;
  if (!config.getBoolean("String_Node_Str",true)) {
    logger.info("String_Node_Str");
    return;
  }
  this.strictMode=config.getBoolean("String_Node_Str",strictMode);
  this.enableParentNodes=config.getBoolean("String_Node_Str",this.enableParentNodes);
  this.registerEvents();
  if (this.enableParentNodes) {
    this.calculateAllParentPermissions();
  }
  logger.info("String_Node_Str");
}
Program: 151285
Project: 151285
Buggy source:
private void registerEvents(){
  PluginManager manager=plugin.getServer().getPluginManager();
  manager.registerEvent(Event.Type.PLAYER_JOIN,new PlayerEvents(),Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.CUSTOM_EVENT,new PEXEvents(),Event.Priority.Low,plugin);
  if (this.enableParentNodes) {
    ServerListener serverEvents=new ServerEvents();
    manager.registerEvent(Event.Type.PLUGIN_ENABLE,serverEvents,Event.Priority.Low,plugin);
    manager.registerEvent(Event.Type.PLUGIN_DISABLE,serverEvents,Event.Priority.Low,plugin);
  }
}

Fixed version (ground truth):
private void registerEvents(){
  PluginManager manager=plugin.getServer().getPluginManager();
  manager.registerEvent(Event.Type.PLAYER_JOIN,new PlayerEvents(),Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.CUSTOM_EVENT,new PEXEvents(),Event.Priority.Low,plugin);
  if (this.enableParentNodes) {
    ServerListener serverEvents=new ServerEvents();
    manager.registerEvent(Event.Type.PLUGIN_ENABLE,serverEvents,Event.Priority.Low,plugin);
  }
}
Program: 151286
Project: 151286
Buggy source:
public static PermissionManager getPermissionManager(){
  Plugin plugin=Bukkit.getServer().getPluginManager().getPlugin("String_Node_Str");
  if (plugin == null || !(plugin instanceof PermissionsEx) || ((PermissionsEx)plugin).permissionsManager == null) {
    throw new RuntimeException("String_Node_Str");
  }
  return ((PermissionsEx)plugin).permissionsManager;
}

Fixed version (ground truth):
public static PermissionManager getPermissionManager(){
  Plugin plugin=Bukkit.getServer().getPluginManager().getPlugin("String_Node_Str");
  if (!isAvailable()) {
    throw new RuntimeException("String_Node_Str");
  }
  return ((PermissionsEx)plugin).permissionsManager;
}
Program: 151287
Project: 151287
Buggy source:
public static void inject(Player player,boolean strictMode){
  if (player.hasPermission("String_Node_Str")) {
    return;
  }
  try {
    Permissible permissible=new PermissiblePEX(player,strictMode);
    if (player.getClass().getName().contains("String_Node_Str")) {
      Logger.getLogger("String_Node_Str").warning("String_Node_Str");
      injectSpout(player,permissible);
    }
 else {
      injectCraftBukkit(player,permissible);
    }
    permissible.recalculatePermissions();
    Logger.getLogger("String_Node_Str").info("String_Node_Str" + player.getName() + "String_Node_Str");
  }
 catch (  Throwable e) {
    Logger.getLogger("String_Node_Str").warning("String_Node_Str");
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void inject(Player player,boolean strictMode){
  if (player.hasPermission("String_Node_Str")) {
    return;
  }
  try {
    Permissible permissible=new PermissiblePEX(player,strictMode);
    if (player.getClass().getName().contains("String_Node_Str")) {
      injectSpout(player,permissible);
    }
 else {
      injectCraftBukkit(player,permissible);
    }
    permissible.recalculatePermissions();
    Logger.getLogger("String_Node_Str").info("String_Node_Str" + player.getName() + "String_Node_Str");
  }
 catch (  Throwable e) {
    Logger.getLogger("String_Node_Str").warning("String_Node_Str");
    e.printStackTrace();
  }
}
Program: 151288
Project: 151288
Buggy source:
private void registerEvents(){
  PluginManager manager=plugin.getServer().getPluginManager();
  PlayerEvents playerEventListener=new PlayerEvents();
  manager.registerEvent(Event.Type.PLAYER_JOIN,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.PLAYER_KICK,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.PLAYER_QUIT,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.PLAYER_RESPAWN,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.PLAYER_TELEPORT,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.PLAYER_PORTAL,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.CUSTOM_EVENT,new PEXEvents(),Event.Priority.Low,plugin);
}

Fixed version (ground truth):
private void registerEvents(){
  PluginManager manager=plugin.getServer().getPluginManager();
  PlayerEvents playerEventListener=new PlayerEvents();
  manager.registerEvent(Event.Type.PLAYER_JOIN,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.PLAYER_KICK,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.PLAYER_QUIT,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.PLAYER_RESPAWN,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.PLAYER_TELEPORT,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.PLAYER_PORTAL,playerEventListener,Event.Priority.Low,plugin);
  manager.registerEvent(Event.Type.PLAYER_CHANGED_WORLD,playerEventListener,Event.Priority.Low,plugin);
  ;
  manager.registerEvent(Event.Type.CUSTOM_EVENT,new PEXEvents(),Event.Priority.Low,plugin);
}
Program: 151290
Project: 151290
Buggy source:
public static void inject(Player player,boolean strictMode){
  if (player.hasPermission("String_Node_Str")) {
    Logger.getLogger("String_Node_Str").info("String_Node_Str");
    return;
  }
  try {
    Permissible permissible=new PermissiblePEX(player,strictMode);
    if (player.getClass().getName().contains("String_Node_Str")) {
      Logger.getLogger("String_Node_Str").warning("String_Node_Str");
      injectSpout(player,permissible);
    }
 else {
      injectCraftBukkit(player,permissible);
    }
    permissible.recalculatePermissions();
    Logger.getLogger("String_Node_Str").info("String_Node_Str" + player.getName() + "String_Node_Str");
  }
 catch (  Throwable e) {
    Logger.getLogger("String_Node_Str").warning("String_Node_Str");
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public static void inject(Player player,boolean strictMode){
  if (player.hasPermission("String_Node_Str")) {
    return;
  }
  try {
    Permissible permissible=new PermissiblePEX(player,strictMode);
    if (player.getClass().getName().contains("String_Node_Str")) {
      Logger.getLogger("String_Node_Str").warning("String_Node_Str");
      injectSpout(player,permissible);
    }
 else {
      injectCraftBukkit(player,permissible);
    }
    permissible.recalculatePermissions();
    Logger.getLogger("String_Node_Str").info("String_Node_Str" + player.getName() + "String_Node_Str");
  }
 catch (  Throwable e) {
    Logger.getLogger("String_Node_Str").warning("String_Node_Str");
    e.printStackTrace();
  }
}
Program: 151291
Project: 151291
Buggy source:
@Override public void onEnable(){
  this.commandsManager.register(new UtilityCommands());
  this.commandsManager.register(new UserCommands());
  this.commandsManager.register(new GroupCommands());
  this.commandsManager.register(new PromotionCommands());
  this.commandsManager.register(new WorldCommands());
  this.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_QUIT,new PlayerEventsListener(),Priority.Normal,this);
  this.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_RESPAWN,new PlayerEventsListener(),Priority.Lowest,this);
  this.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_TELEPORT,new PlayerEventsListener(),Priority.Lowest,this);
  this.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_PORTAL,new PlayerEventsListener(),Priority.Lowest,this);
  this.getServer().getServicesManager().register(PermissionManager.class,this.permissionsManager,this,ServicePriority.Normal);
  ConfigurationNode dinnerpermsConfig=this.config.getNode("String_Node_Str");
  if (dinnerpermsConfig == null) {
    dinnerpermsConfig=Configuration.getEmptyNode();
    this.config.setProperty("String_Node_Str",dinnerpermsConfig);
  }
  this.superms=new BukkitPermissions(this,dinnerpermsConfig);
  this.superms.updateAllPlayers();
  this.config.save();
  logger.log(Level.INFO,"String_Node_Str" + this.getDescription().getVersion() + "String_Node_Str");
}

Fixed version (ground truth):
@Override public void onEnable(){
  this.commandsManager.register(new UtilityCommands());
  this.commandsManager.register(new UserCommands());
  this.commandsManager.register(new GroupCommands());
  this.commandsManager.register(new PromotionCommands());
  this.commandsManager.register(new WorldCommands());
  this.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_QUIT,new PlayerEventsListener(),Priority.Normal,this);
  this.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_RESPAWN,new PlayerEventsListener(),Priority.Lowest,this);
  this.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_TELEPORT,new PlayerEventsListener(),Priority.Lowest,this);
  this.getServer().getPluginManager().registerEvent(Event.Type.PLAYER_PORTAL,new PlayerEventsListener(),Priority.Lowest,this);
  this.getServer().getServicesManager().register(PermissionManager.class,this.permissionsManager,this,ServicePriority.Normal);
  ConfigurationNode dinnerpermsConfig=this.config.getNode("String_Node_Str");
  if (dinnerpermsConfig == null) {
    this.config.setProperty("String_Node_Str",new HashMap<String,Object>());
    dinnerpermsConfig=this.config.getNode("String_Node_Str");
  }
  this.superms=new BukkitPermissions(this,dinnerpermsConfig);
  this.superms.updateAllPlayers();
  this.config.save();
  logger.log(Level.INFO,"String_Node_Str" + this.getDescription().getVersion() + "String_Node_Str");
}
Program: 151292
Project: 151292
Buggy source:
public static void inject(Player player,boolean strictMode){
  if (player.hasPermission("String_Node_Str")) {
    Logger.getLogger("String_Node_Str").warning("String_Node_Str");
    return;
  }
  try {
    Class humanEntity=Class.forName("String_Node_Str");
    if (player.getClass().isAssignableFrom(humanEntity)) {
      return;
    }
    Field permField=humanEntity.getDeclaredField("String_Node_Str");
    permField.setAccessible(true);
    PermissibleBase oldBase=(PermissibleBase)permField.get(player);
    PermissibleBase newBase=new PermissiblePEX(player,strictMode);
    Field attachmentField=PermissibleBase.class.getDeclaredField("String_Node_Str");
    attachmentField.setAccessible(true);
    attachmentField.set(newBase,attachmentField.get(oldBase));
    Field permissionsField=PermissibleBase.class.getDeclaredField("String_Node_Str");
    permissionsField.setAccessible(true);
    permissionsField.set(newBase,permissionsField.get(oldBase));
    permField.set(player,newBase);
  }
 catch (  Throwable e) {
    Logger.getLogger("String_Node_Str").warning("String_Node_Str");
  }
}

Fixed version (ground truth):
public static void inject(Player player,boolean strictMode){
  if (player.hasPermission("String_Node_Str")) {
    return;
  }
  try {
    Class humanEntity=Class.forName("String_Node_Str");
    if (player.getClass().isAssignableFrom(humanEntity)) {
      return;
    }
    Field permField=humanEntity.getDeclaredField("String_Node_Str");
    permField.setAccessible(true);
    PermissibleBase oldBase=(PermissibleBase)permField.get(player);
    PermissibleBase newBase=new PermissiblePEX(player,strictMode);
    Field attachmentField=PermissibleBase.class.getDeclaredField("String_Node_Str");
    attachmentField.setAccessible(true);
    attachmentField.set(newBase,attachmentField.get(oldBase));
    Field permissionsField=PermissibleBase.class.getDeclaredField("String_Node_Str");
    permissionsField.setAccessible(true);
    permissionsField.set(newBase,permissionsField.get(oldBase));
    permField.set(player,newBase);
    Logger.getLogger("String_Node_Str").info("String_Node_Str" + player.getName() + "String_Node_Str");
  }
 catch (  Throwable e) {
    Logger.getLogger("String_Node_Str").warning("String_Node_Str");
  }
}
Program: 151293
Project: 151293
Buggy source:
/** 
 * Saves the configuration to disk. All errors are clobbered.
 * @return true if it was successful saved
 */
public boolean save(){
  FileOutputStream stream=null;
  File parent=file.getParentFile();
  if (parent != null) {
    parent.mkdirs();
  }
  try {
    stream=new FileOutputStream(file);
    yaml.dump(root,new OutputStreamWriter(stream,"String_Node_Str"));
    return true;
  }
 catch (  IOException e) {
  }
 finally {
    try {
      if (stream != null) {
        stream.close();
      }
    }
 catch (    IOException e) {
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Saves the configuration to disk. All errors are clobbered.
 * @return true if it was successful saved
 */
public boolean save(){
  FileOutputStream stream=null;
  File parent=file.getParentFile();
  if (parent != null) {
    parent.mkdirs();
  }
  boolean success=true;
  try {
    stream=new FileOutputStream(file);
    yaml.dump(root,new OutputStreamWriter(stream,"String_Node_Str"));
    return true;
  }
 catch (  IOException e) {
    success=false;
  }
 finally {
    try {
      if (stream != null) {
        stream.close();
      }
    }
 catch (    IOException e) {
      success=false;
    }
  }
  return success;
}
Program: 151294
Project: 151294
Buggy source:
@Override public void initialize(){
  String permissionFilename=config.getString("String_Node_Str");
  if (permissionFilename == null) {
    permissionFilename="String_Node_Str";
    config.setProperty("String_Node_Str","String_Node_Str");
    config.save();
  }
  String baseDir=config.getString("String_Node_Str");
  if (baseDir.contains("String_Node_Str") && !"String_Node_Str".equals(File.separator)) {
    baseDir=baseDir.replace("String_Node_Str",File.separator);
  }
  File baseDirectory=new File(baseDir);
  if (!baseDirectory.exists()) {
    baseDirectory.mkdirs();
  }
  File permissionFile=new File(baseDir,permissionFilename);
  permissions=new Configuration(permissionFile);
  if (!permissionFile.exists()) {
    try {
      permissionFile.createNewFile();
      permissions.setProperty("String_Node_Str",true);
      List<String> defaultPermissions=new LinkedList<String>();
      defaultPermissions.add("String_Node_Str");
      permissions.setProperty("String_Node_Str",defaultPermissions);
      permissions.save();
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
  }
  permissions.load();
}

Fixed version (ground truth):
@Override public void initialize(){
  String permissionFilename=config.getString("String_Node_Str");
  if (permissionFilename == null) {
    permissionFilename="String_Node_Str";
    config.setProperty("String_Node_Str","String_Node_Str");
    config.save();
  }
  String baseDir=config.getString("String_Node_Str","String_Node_Str");
  if (baseDir.contains("String_Node_Str") && !"String_Node_Str".equals(File.separator)) {
    baseDir=baseDir.replace("String_Node_Str",File.separator);
  }
  File baseDirectory=new File(baseDir);
  if (!baseDirectory.exists()) {
    baseDirectory.mkdirs();
  }
  File permissionFile=new File(baseDir,permissionFilename);
  permissions=new Configuration(permissionFile);
  if (!permissionFile.exists()) {
    try {
      permissionFile.createNewFile();
      permissions.setProperty("String_Node_Str",true);
      List<String> defaultPermissions=new LinkedList<String>();
      defaultPermissions.add("String_Node_Str");
      permissions.setProperty("String_Node_Str",defaultPermissions);
      permissions.save();
    }
 catch (    IOException e) {
      throw new RuntimeException(e);
    }
  }
  permissions.load();
}
Program: 151295
Project: 151295
Buggy source:
protected String prepareQuery(String sql){
  Matcher match=placeholderPattern.matcher(sql);
  while (match.find()) {
    sql=sql.replace(match.group(0),"String_Node_Str" + this.getAlias(match.group(1)) + "String_Node_Str");
  }
  if (this.dbDriver.contains("String_Node_Str")) {
    sql=sql.replace("String_Node_Str","String_Node_Str");
  }
  return sql;
}

Fixed version (ground truth):
protected String prepareQuery(String sql){
  Matcher match=placeholderPattern.matcher(sql);
  while (match.find()) {
    sql=sql.replace(match.group(0),"String_Node_Str" + this.getAlias(match.group(1)) + "String_Node_Str");
  }
  return sql;
}
Program: 151296
Project: 151296
Buggy source:
protected PermissionGroup getDefaultGroup(String worldName,PermissionGroup fallback){
  PermissionGroup defaultGroup=this.backend.getDefaultGroup(worldName);
  if (defaultGroup == null && worldName == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (defaultGroup != null) {
    return defaultGroup;
  }
  if (worldName != null) {
    for (    String parentWorld : this.getWorldInheritance(worldName)) {
      defaultGroup=this.getDefaultGroup(parentWorld,null);
      if (defaultGroup != null) {
        return defaultGroup;
      }
    }
  }
  return fallback;
}

Fixed version (ground truth):
private PermissionGroup getDefaultGroup(String worldName,PermissionGroup fallback){
  PermissionGroup defaultGroup=this.backend.getDefaultGroup(worldName);
  if (defaultGroup == null && worldName == null) {
    throw new IllegalStateException("String_Node_Str");
  }
  if (defaultGroup != null) {
    return defaultGroup;
  }
  if (worldName != null) {
    for (    String parentWorld : this.getWorldInheritance(worldName)) {
      defaultGroup=this.getDefaultGroup(parentWorld,null);
      if (defaultGroup != null) {
        return defaultGroup;
      }
    }
  }
  return fallback;
}
Program: 151297
Project: 151297
Buggy source:
@Override public void onPlayerRespawn(PlayerRespawnEvent event){
  updatePermissions(event.getPlayer());
}

Fixed version (ground truth):
@Override public void onPlayerRespawn(PlayerRespawnEvent event){
  updatePermissions(event.getPlayer(),event.getRespawnLocation().getWorld().getName());
}
Program: 151298
Project: 151298
Buggy source:
@Override public void onPlayerTeleport(PlayerTeleportEvent event){
  if (!event.getFrom().getWorld().equals(event.getTo().getWorld())) {
    updatePermissions(event.getPlayer());
  }
}

Fixed version (ground truth):
@Override public void onPlayerTeleport(PlayerTeleportEvent event){
  if (!event.getFrom().getWorld().equals(event.getTo().getWorld())) {
    updatePermissions(event.getPlayer(),event.getTo().getWorld().getName());
  }
}
Program: 151299
Project: 151299
Buggy source:
@Override public void onPlayerPortal(PlayerPortalEvent event){
  updatePermissions(event.getPlayer());
}

Fixed version (ground truth):
@Override public void onPlayerPortal(PlayerPortalEvent event){
  updatePermissions(event.getPlayer(),event.getTo().getWorld().getName());
}
Program: 151301
Project: 151301
Buggy source:
@Override public void setOption(String permission,String value,String world){
  this.backendEntity.setOption(permission,value,world);
  this.callEvent(PermissionEntityEvent.Action.OPTIONS_CHANGED);
}

Fixed version (ground truth):
@Override public void setOption(String permission,String value,String world){
  this.backendEntity.setOption(permission,value,world);
  this.clearMembersCache();
  this.callEvent(PermissionEntityEvent.Action.OPTIONS_CHANGED);
}
Program: 151302
Project: 151302
Buggy source:
@Override public void setPermissions(String[] permissions,String world){
  this.backendEntity.setPermissions(permissions,world);
  this.callEvent(PermissionEntityEvent.Action.PERMISSIONS_CHANGED);
}

Fixed version (ground truth):
@Override public void setPermissions(String[] permissions,String world){
  this.backendEntity.setPermissions(permissions,world);
  this.clearMembersCache();
  this.callEvent(PermissionEntityEvent.Action.PERMISSIONS_CHANGED);
}
Program: 151303
Project: 151303
Buggy source:
@Override public void setPrefix(String prefix,String worldName){
  this.backendEntity.setPrefix(prefix,worldName);
  this.callEvent(PermissionEntityEvent.Action.INFO_CHANGED);
}

Fixed version (ground truth):
@Override public void setPrefix(String prefix,String worldName){
  this.backendEntity.setPrefix(prefix,worldName);
  this.clearMembersCache();
  this.callEvent(PermissionEntityEvent.Action.INFO_CHANGED);
}
Program: 151304
Project: 151304
Buggy source:
@Override public void setSuffix(String suffix,String worldName){
  this.backendEntity.setSuffix(suffix,worldName);
  this.callEvent(PermissionEntityEvent.Action.INFO_CHANGED);
}

Fixed version (ground truth):
@Override public void setSuffix(String suffix,String worldName){
  this.backendEntity.setSuffix(suffix,worldName);
  this.clearMembersCache();
  this.callEvent(PermissionEntityEvent.Action.INFO_CHANGED);
}
Program: 151305
Project: 151305
Buggy source:
@Override public void setOption(String permission,String value,String world){
  this.backendEntity.setOption(permission,value,world);
  this.callEvent(PermissionEntityEvent.Action.OPTIONS_CHANGED);
}

Fixed version (ground truth):
@Override public void setOption(String permission,String value,String world){
  this.backendEntity.setOption(permission,value,world);
  this.clearCache();
  this.callEvent(PermissionEntityEvent.Action.OPTIONS_CHANGED);
}
Program: 151306
Project: 151306
Buggy source:
@Override public void setPermissions(String[] permissions,String world){
  this.backendEntity.setPermissions(permissions,world);
  this.callEvent(PermissionEntityEvent.Action.PERMISSIONS_CHANGED);
}

Fixed version (ground truth):
@Override public void setPermissions(String[] permissions,String world){
  this.backendEntity.setPermissions(permissions,world);
  this.clearCache();
  this.callEvent(PermissionEntityEvent.Action.PERMISSIONS_CHANGED);
}
Program: 151307
Project: 151307
Buggy source:
@Override public void setPrefix(String prefix,String worldName){
  this.backendEntity.setPrefix(prefix,worldName);
}

Fixed version (ground truth):
@Override public void setPrefix(String prefix,String worldName){
  this.backendEntity.setPrefix(prefix,worldName);
  this.clearCache();
}
Program: 151308
Project: 151308
Buggy source:
@Override public void setSuffix(String suffix,String worldName){
  this.backendEntity.setSuffix(suffix,worldName);
}

Fixed version (ground truth):
@Override public void setSuffix(String suffix,String worldName){
  this.backendEntity.setSuffix(suffix,worldName);
  this.clearCache();
}
Program: 151309
Project: 151309
Buggy source:
@Override public String[] getWorldInheritance(String world){
  if (world == null || world.isEmpty()) {
    return new String[0];
  }
  if (!worldInheritanceCache.containsKey(world)) {
    try {
      ResultSet result=this.sql.selectQuery("String_Node_Str",world);
      LinkedList<String> worldParents=new LinkedList<String>();
      while (result.next()) {
        worldParents.add(result.getString(0));
      }
      this.worldInheritanceCache.put(world,worldParents.toArray(new String[0]));
    }
 catch (    SQLException e) {
      throw new RuntimeException(e);
    }
  }
  return worldInheritanceCache.get(world);
}

Fixed version (ground truth):
@Override public String[] getWorldInheritance(String world){
  if (world == null || world.isEmpty()) {
    return new String[0];
  }
  if (!worldInheritanceCache.containsKey(world)) {
    try {
      ResultSet result=this.sql.selectQuery("String_Node_Str",world);
      LinkedList<String> worldParents=new LinkedList<String>();
      while (result.next()) {
        worldParents.add(result.getString("String_Node_Str"));
      }
      this.worldInheritanceCache.put(world,worldParents.toArray(new String[0]));
    }
 catch (    SQLException e) {
      throw new RuntimeException(e);
    }
  }
  return worldInheritanceCache.get(world);
}
Program: 151310
Project: 151310
Buggy source:
/** 
 * Overriden methods
 */
@Override public String getPrefix(String worldName){
  String localPrefix=super.getPrefix();
  if (localPrefix == null || localPrefix.isEmpty()) {
    for (    PermissionGroup group : this.getParentGroups(worldName)) {
      localPrefix=group.getPrefix();
      if (localPrefix != null && !localPrefix.isEmpty()) {
        break;
      }
    }
  }
  if (localPrefix == null) {
    localPrefix="String_Node_Str";
  }
  return localPrefix;
}

Fixed version (ground truth):
/** 
 * Overriden methods
 */
@Override public String getPrefix(String worldName){
  String localPrefix=this.getOwnPrefix(worldName);
  if (localPrefix == null || localPrefix.isEmpty()) {
    for (    PermissionGroup group : this.getParentGroups(worldName)) {
      localPrefix=group.getPrefix();
      if (localPrefix != null && !localPrefix.isEmpty()) {
        break;
      }
    }
  }
  if (localPrefix == null) {
    localPrefix="String_Node_Str";
  }
  return localPrefix;
}
Program: 151311
Project: 151311
Buggy source:
@Override public String getSuffix(String worldName){
  String localSuffix=super.getSuffix();
  if (localSuffix == null || localSuffix.isEmpty()) {
    for (    PermissionGroup group : this.getParentGroups(worldName)) {
      localSuffix=group.getSuffix();
      if (localSuffix != null && !localSuffix.isEmpty()) {
        break;
      }
    }
  }
  if (localSuffix == null) {
    localSuffix="String_Node_Str";
  }
  return localSuffix;
}

Fixed version (ground truth):
@Override public String getSuffix(String worldName){
  String localSuffix=this.getOwnSuffix(worldName);
  if (localSuffix == null || localSuffix.isEmpty()) {
    for (    PermissionGroup group : this.getParentGroups(worldName)) {
      localSuffix=group.getSuffix();
      if (localSuffix != null && !localSuffix.isEmpty()) {
        break;
      }
    }
  }
  if (localSuffix == null) {
    localSuffix="String_Node_Str";
  }
  return localSuffix;
}
Program: 151312
Project: 151312
Buggy source:
@Override public String getPrefix(String worldName){
  if (this.cachedPrefix == null) {
    String localPrefix=super.getPrefix();
    if (localPrefix == null || localPrefix.isEmpty()) {
      for (      PermissionGroup group : this.getGroups(worldName)) {
        localPrefix=group.getPrefix();
        if (localPrefix != null && !localPrefix.isEmpty()) {
          break;
        }
      }
    }
    if (localPrefix == null) {
      localPrefix="String_Node_Str";
    }
    this.cachedPrefix=localPrefix;
  }
  return this.cachedPrefix;
}

Fixed version (ground truth):
@Override public String getPrefix(String worldName){
  if (this.cachedPrefix == null) {
    String localPrefix=this.getOwnPrefix(worldName);
    if (localPrefix == null || localPrefix.isEmpty()) {
      for (      PermissionGroup group : this.getGroups(worldName)) {
        localPrefix=group.getPrefix();
        if (localPrefix != null && !localPrefix.isEmpty()) {
          break;
        }
      }
    }
    if (localPrefix == null) {
      localPrefix="String_Node_Str";
    }
    this.cachedPrefix=localPrefix;
  }
  return this.cachedPrefix;
}
Program: 151313
Project: 151313
Buggy source:
@Override public String getSuffix(String worldName){
  if (this.cachedSuffix == null) {
    String localSuffix=super.getSuffix();
    if (localSuffix == null || localSuffix.isEmpty()) {
      for (      PermissionGroup group : this.getGroups(worldName)) {
        localSuffix=group.getSuffix();
        if (localSuffix != null && !localSuffix.isEmpty()) {
          break;
        }
      }
    }
    if (localSuffix == null) {
      localSuffix="String_Node_Str";
    }
    this.cachedSuffix=localSuffix;
  }
  return this.cachedSuffix;
}

Fixed version (ground truth):
@Override public String getSuffix(String worldName){
  if (this.cachedSuffix == null) {
    String localSuffix=this.getOwnSuffix(worldName);
    if (localSuffix == null || localSuffix.isEmpty()) {
      for (      PermissionGroup group : this.getGroups(worldName)) {
        localSuffix=group.getSuffix();
        if (localSuffix != null && !localSuffix.isEmpty()) {
          break;
        }
      }
    }
    if (localSuffix == null) {
      localSuffix="String_Node_Str";
    }
    this.cachedSuffix=localSuffix;
  }
  return this.cachedSuffix;
}
Program: 151314
Project: 151314
Buggy source:
/** 
 * Promotes user in specified ladder. If user is not member of the ladder RankingException will be thrown If promoter is not null and he is member of the ladder and  his rank is lower then user's RankingException will be thrown too. If there is no group to promote the user to RankingException would be thrown
 * @param promoter null if action is performed from console or by a plugin
 * @param ladderName ladder's name
 * @throws RankingException 
 */
public void promote(PermissionUser promoter,String ladderName) throws RankingException {
  if (ladderName == null || ladderName.isEmpty()) {
    ladderName="String_Node_Str";
  }
  int promoterRank=getPromoterRankAndCheck(promoter,ladderName);
  int rank=this.getRank(ladderName);
  PermissionGroup sourceGroup=this.getRankLadders().get(ladderName);
  PermissionGroup targetGroup=null;
  for (  Map.Entry<Integer,PermissionGroup> entry : this.manager.getRankLadder(ladderName).entrySet()) {
    int groupRank=entry.getValue().getRank();
    if (groupRank >= rank) {
      continue;
    }
    if (groupRank <= promoterRank) {
      continue;
    }
    if (targetGroup != null && groupRank <= targetGroup.getRank()) {
      continue;
    }
    targetGroup=entry.getValue();
  }
  if (targetGroup == null) {
    throw new RankingException("String_Node_Str",this,promoter);
  }
  this.swapGroups(sourceGroup,targetGroup);
  this.callEvent(PermissionEntityEvent.Action.RANK_CHANGED);
}

Fixed version (ground truth):
/** 
 * Promotes user in specified ladder. If user is not member of the ladder RankingException will be thrown If promoter is not null and he is member of the ladder and  his rank is lower then user's RankingException will be thrown too. If there is no group to promote the user to RankingException would be thrown
 * @param promoter null if action is performed from console or by a plugin
 * @param ladderName ladder's name
 * @throws RankingException 
 */
public PermissionGroup promote(PermissionUser promoter,String ladderName) throws RankingException {
  if (ladderName == null || ladderName.isEmpty()) {
    ladderName="String_Node_Str";
  }
  int promoterRank=getPromoterRankAndCheck(promoter,ladderName);
  int rank=this.getRank(ladderName);
  PermissionGroup sourceGroup=this.getRankLadders().get(ladderName);
  PermissionGroup targetGroup=null;
  for (  Map.Entry<Integer,PermissionGroup> entry : this.manager.getRankLadder(ladderName).entrySet()) {
    int groupRank=entry.getValue().getRank();
    if (groupRank >= rank) {
      continue;
    }
    if (groupRank <= promoterRank) {
      continue;
    }
    if (targetGroup != null && groupRank <= targetGroup.getRank()) {
      continue;
    }
    targetGroup=entry.getValue();
  }
  if (targetGroup == null) {
    throw new RankingException("String_Node_Str",this,promoter);
  }
  this.swapGroups(sourceGroup,targetGroup);
  this.callEvent(PermissionEntityEvent.Action.RANK_CHANGED);
  return targetGroup;
}
Program: 151315
Project: 151315
Buggy source:
/** 
 * Demotes user in specified ladder. If user is not member of the ladder RankingException will be thrown If demoter is not null and he is member of the ladder and  his rank is lower then user's RankingException will be thrown too. If there is no group to demote the user to RankingException would be thrown
 * @param promoter Specify null if action performed from console or by plugin
 * @param ladderName
 * @throws RankingException 
 */
public void demote(PermissionUser demoter,String ladderName) throws RankingException {
  if (ladderName == null || ladderName.isEmpty()) {
    ladderName="String_Node_Str";
  }
  int promoterRank=getPromoterRankAndCheck(demoter,ladderName);
  int rank=this.getRank(ladderName);
  PermissionGroup sourceGroup=this.getRankLadders().get(ladderName);
  PermissionGroup targetGroup=null;
  for (  Map.Entry<Integer,PermissionGroup> entry : this.manager.getRankLadder(ladderName).entrySet()) {
    int groupRank=entry.getValue().getRank();
    if (groupRank <= rank) {
      continue;
    }
    if (groupRank <= promoterRank) {
      continue;
    }
    if (targetGroup != null && groupRank >= targetGroup.getRank()) {
      continue;
    }
    targetGroup=entry.getValue();
  }
  if (targetGroup == null) {
    throw new RankingException("String_Node_Str",this,demoter);
  }
  this.swapGroups(sourceGroup,targetGroup);
  this.callEvent(PermissionEntityEvent.Action.RANK_CHANGED);
}

Fixed version (ground truth):
/** 
 * Demotes user in specified ladder. If user is not member of the ladder RankingException will be thrown If demoter is not null and he is member of the ladder and  his rank is lower then user's RankingException will be thrown too. If there is no group to demote the user to RankingException would be thrown
 * @param promoter Specify null if action performed from console or by plugin
 * @param ladderName
 * @throws RankingException 
 */
public PermissionGroup demote(PermissionUser demoter,String ladderName) throws RankingException {
  if (ladderName == null || ladderName.isEmpty()) {
    ladderName="String_Node_Str";
  }
  int promoterRank=getPromoterRankAndCheck(demoter,ladderName);
  int rank=this.getRank(ladderName);
  PermissionGroup sourceGroup=this.getRankLadders().get(ladderName);
  PermissionGroup targetGroup=null;
  for (  Map.Entry<Integer,PermissionGroup> entry : this.manager.getRankLadder(ladderName).entrySet()) {
    int groupRank=entry.getValue().getRank();
    if (groupRank <= rank) {
      continue;
    }
    if (groupRank <= promoterRank) {
      continue;
    }
    if (targetGroup != null && groupRank >= targetGroup.getRank()) {
      continue;
    }
    targetGroup=entry.getValue();
  }
  if (targetGroup == null) {
    throw new RankingException("String_Node_Str",this,demoter);
  }
  this.swapGroups(sourceGroup,targetGroup);
  this.callEvent(PermissionEntityEvent.Action.RANK_CHANGED);
  return targetGroup;
}
Program: 151318
Project: 151318
Buggy source:
@Override public void addPermission(String permission,String world){
  if (world == null) {
    world="String_Node_Str";
  }
  this.db.updateQuery("String_Node_Str",this.getName(),permission,world,this.type.ordinal());
}

Fixed version (ground truth):
@Override public void addPermission(String permission,String world){
  if (world == null) {
    world="String_Node_Str";
  }
  this.db.updateQuery("String_Node_Str",this.getName(),permission,world,this.type.ordinal());
  this.fetchPermissions();
}
Program: 151319
Project: 151319
Buggy source:
@Override public void removePermission(String permission,String world){
  if (world == null) {
    world="String_Node_Str";
  }
  this.db.updateQuery("String_Node_Str",this.getName(),permission,this.type.ordinal(),world);
}

Fixed version (ground truth):
@Override public void removePermission(String permission,String world){
  if (world == null) {
    world="String_Node_Str";
  }
  this.db.updateQuery("String_Node_Str",this.getName(),permission,this.type.ordinal(),world);
  this.fetchPermissions();
}
Program: 151320
Project: 151320
Buggy source:
@Override public void addPermission(String permission,String world){
  this.backendEntity.addPermission(permission,world);
}

Fixed version (ground truth):
@Override public void addPermission(String permission,String world){
  this.backendEntity.addPermission(permission,world);
  this.clearCache();
}
Program: 151321
Project: 151321
Buggy source:
@Override public void removePermission(String permission,String world){
  this.backendEntity.removePermission(permission,world);
}

Fixed version (ground truth):
@Override public void removePermission(String permission,String world){
  this.backendEntity.removePermission(permission,world);
  this.clearCache();
}
Program: 151322
Project: 151322
Buggy source:
@Override public void addPermission(String permission,String world){
  String nodePath="String_Node_Str";
  if (world != null && !world.isEmpty()) {
    nodePath="String_Node_Str" + world + "String_Node_Str"+ nodePath;
  }
  List<String> permissions=this.node.getStringList(nodePath,new LinkedList<String>());
  if (!permissions.contains(permission)) {
    permissions.add(0,permission);
  }
  this.node.setProperty(nodePath,permissions);
  this.save();
}

Fixed version (ground truth):
@Override public void addPermission(String permission,String world){
  String permissionsNode="String_Node_Str";
  if (world != null && !world.isEmpty()) {
    permissionsNode="String_Node_Str" + world + "String_Node_Str"+ permissionsNode;
  }
  List<String> permissions=this.node.getStringList(permissionsNode,new LinkedList<String>());
  if (!permissions.contains(permission)) {
    permissions.add(0,permission);
  }
  this.node.setProperty(permissionsNode,permissions);
  this.save();
}