nus-yam/ex-repair huggingface dataset:
Program: 86683
Project: 86683
Buggy source:
/** 
 * Update a Kit
 * @param kit Update this kit instance to the database.
 */
public void updateKit(Kit kit){
  KitDataAccess data=new KitDataAccess();
  data.groups=new ArrayList<String>(Arrays.asList(kit.getGroups()));
  data.items=kit.getItemsAsStringList();
  data.name=kit.getName();
  data.owners=new ArrayList<String>(Arrays.asList(kit.getOwner()));
  data.useDelay=kit.getDelay();
  try {
    Database.get().update(data,new String[]{"String_Node_Str"},new Object[]{kit.getName()});
  }
 catch (  DatabaseWriteException e) {
    Canary.logStacktrace(e.getMessage(),e);
  }
}

Fixed version (ground truth):
/** 
 * Update a Kit
 * @param kit Update this kit instance to the database.
 */
public void updateKit(Kit kit){
  KitDataAccess data=new KitDataAccess();
  data.groups=kit.getGroups() != null ? new ArrayList<String>(Arrays.asList(kit.getGroups())) : new ArrayList<String>();
  data.items=kit.getItemsAsStringList();
  data.name=kit.getName();
  data.owners=kit.getOwner() != null ? new ArrayList<String>(Arrays.asList(kit.getOwner())) : new ArrayList<String>();
  data.useDelay=kit.getDelay();
  try {
    Database.get().update(data,new String[]{"String_Node_Str"},new Object[]{kit.getName()});
  }
 catch (  DatabaseWriteException e) {
    Canary.logStacktrace(e.getMessage(),e);
  }
}
Program: 86684
Project: 86684
Buggy source:
/** 
 * Load and return all kits
 * @return An ArrayList of all kits.
 */
public ArrayList<Kit> loadKits(){
  ArrayList<DataAccess> dataList=new ArrayList<DataAccess>();
  ArrayList<Kit> kits=new ArrayList<Kit>();
  try {
    Database.get().loadAll(new KitDataAccess(),dataList,new String[]{},new Object[]{});
    for (    DataAccess da : dataList) {
      KitDataAccess data=(KitDataAccess)da;
      Kit kit=new Kit();
      kit.setContentFromStrings(data.items);
      kit.setDelay(data.useDelay);
      kit.setGroups((String[])data.groups.toArray());
      kit.setName(data.name);
      kit.setOwner((String[])data.groups.toArray());
      kit.setId(data.id);
      kits.add(kit);
    }
    return kits;
  }
 catch (  DatabaseReadException e) {
    Canary.logStacktrace(e.getMessage(),e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Load and return all kits
 * @return An ArrayList of all kits.
 */
public ArrayList<Kit> loadKits(){
  ArrayList<DataAccess> dataList=new ArrayList<DataAccess>();
  ArrayList<Kit> kits=new ArrayList<Kit>();
  try {
    Database.get().loadAll(new KitDataAccess(),dataList,new String[]{},new Object[]{});
    for (    DataAccess da : dataList) {
      KitDataAccess data=(KitDataAccess)da;
      Kit kit=new Kit();
      kit.setContentFromStrings(data.items);
      kit.setDelay(data.useDelay);
      kit.setGroups(data.groups.toArray(new String[0]));
      kit.setName(data.name);
      kit.setOwner(data.groups.toArray(new String[0]));
      kit.setId(data.id);
      kits.add(kit);
    }
    return kits;
  }
 catch (  DatabaseReadException e) {
    Canary.logStacktrace(e.getMessage(),e);
  }
  return null;
}
Program: 86685
Project: 86685
Buggy source:
/** 
 * Mostly used for adding the items into the database
 * @return
 */
public ArrayList<String> getItemsAsStringList(){
  ArrayList<String> list=new ArrayList<String>();
  for (  Item i : content) {
    list.add(Canary.serialize(i));
  }
  return list;
}

Fixed version (ground truth):
/** 
 * Mostly used for adding the items into the database
 * @return
 */
public ArrayList<String> getItemsAsStringList(){
  ArrayList<String> list=new ArrayList<String>();
  for (  Item i : content) {
    if (i != null) {
      list.add(Canary.serialize(i));
    }
  }
  return list;
}
Program: 86686
Project: 86686
Buggy source:
/** 
 * Get the URL to the database. This is a combination of host, port and database
 * @return
 */
public String getDatabaseUrl(){
  int port=getDatabasePort();
  return "String_Node_Str" + getDatabaseHost() + ((port == 0) ? "String_Node_Str" : ("String_Node_Str" + port))+ "String_Node_Str"+ getDatabaseName();
}

Fixed version (ground truth):
/** 
 * Get the URL to the database. This is a combination of host, port and database
 * @return
 */
public String getDatabaseUrl(String driver){
  int port=getDatabasePort();
  return "String_Node_Str" + driver + "String_Node_Str"+ getDatabaseHost()+ ((port == 0) ? "String_Node_Str" : ("String_Node_Str" + port))+ "String_Node_Str"+ getDatabaseName();
}
Program: 86687
Project: 86687
Buggy source:
/** 
 * Adds a new Connection to the pool.
 */
private void addNewConnectionToPool(){
  Connection connection=null;
  try {
    Class.forName("String_Node_Str").newInstance();
    connection=DriverManager.getConnection(config.getDatabaseUrl(),config.getDatabaseUser(),config.getDatabasePassword());
    if (connection.isValid(5)) {
      connectionPool.addLast(connection);
    }
  }
 catch (  SQLException sqle) {
    Canary.logStacktrace("String_Node_Str",sqle);
  }
catch (  ClassNotFoundException cnfe) {
    Canary.logStacktrace("String_Node_Str",cnfe);
  }
catch (  InstantiationException ie) {
    Canary.logStacktrace("String_Node_Str",ie);
  }
catch (  IllegalAccessException iae) {
    Canary.logStacktrace("String_Node_Str",iae);
  }
}

Fixed version (ground truth):
/** 
 * Adds a new Connection to the pool.
 */
private void addNewConnectionToPool(){
  Connection connection=null;
  try {
    Class.forName("String_Node_Str").newInstance();
    connection=DriverManager.getConnection(config.getDatabaseUrl("String_Node_Str"),config.getDatabaseUser(),config.getDatabasePassword());
    if (connection.isValid(5)) {
      connectionPool.addLast(connection);
    }
  }
 catch (  SQLException sqle) {
    Canary.logStacktrace("String_Node_Str",sqle);
  }
catch (  ClassNotFoundException cnfe) {
    Canary.logStacktrace("String_Node_Str",cnfe);
  }
catch (  InstantiationException ie) {
    Canary.logStacktrace("String_Node_Str",ie);
  }
catch (  IllegalAccessException iae) {
    Canary.logStacktrace("String_Node_Str",iae);
  }
}
Program: 86688
Project: 86688
Buggy source:
@Override public void update(DataAccess data,String[] fieldNames,Object[] fieldValues) throws DatabaseWriteException {
  if (!doesEntryExist(data)) {
    return;
  }
  ResultSet rs=null;
  try {
    rs=this.getResultSet(conn,data,fieldNames,fieldValues,true);
    if (rs != null) {
      if (rs.next()) {
        HashMap<Column,Object> columns=data.toDatabaseEntryList();
        Iterator<Column> it=columns.keySet().iterator();
        Column column=null;
        while (it.hasNext()) {
          column=it.next();
          if (column.isList()) {
            rs.updateObject(column.columnName(),getString((List<?>)columns.get(column)));
          }
 else {
            rs.updateObject(column.columnName(),columns.get(column));
          }
        }
        rs.updateRow();
      }
 else {
        throw new DatabaseWriteException("String_Node_Str" + data.toString());
      }
    }
  }
 catch (  SQLException ex) {
    Canary.logStacktrace(ex.getMessage(),ex);
  }
catch (  DatabaseTableInconsistencyException dtie) {
    Canary.logStacktrace(dtie.getMessage(),dtie);
  }
catch (  DatabaseReadException ex) {
    Logger.getLogger(SQLiteDatabase.class.getName()).log(Level.SEVERE,null,ex);
  }
 finally {
    try {
      PreparedStatement st=rs.getStatement() instanceof PreparedStatement ? (PreparedStatement)rs.getStatement() : null;
      closeRS(rs);
      closePS(st);
    }
 catch (    SQLException ex) {
      Canary.logStacktrace(ex.getMessage(),ex);
    }
  }
}

Fixed version (ground truth):
@Override public void update(DataAccess data,String[] fieldNames,Object[] fieldValues) throws DatabaseWriteException {
  if (!doesEntryExist(data)) {
    return;
  }
  PreparedStatement ps=null;
  try {
    String updateClause="String_Node_Str" + data.getName() + "String_Node_Str";
    StringBuilder set=new StringBuilder();
    StringBuilder where=new StringBuilder();
    HashMap<Column,Object> columns=data.toDatabaseEntryList();
    Iterator<Column> it=columns.keySet().iterator();
    Column column=null;
    while (it.hasNext()) {
      column=it.next();
      if (where.length() > 0) {
        where.append("String_Node_Str").append(column.columnName());
      }
 else {
        where.append(column.columnName());
      }
      set.append("String_Node_Str");
      set.append(convert(columns.get(column)));
    }
    for (int index=0; index < fieldNames.length && index < fieldValues.length; index++) {
      if (where.length() > 0) {
        where.append("String_Node_Str").append(fieldNames[index]);
      }
 else {
        where.append(fieldNames[index]);
      }
      where.append("String_Node_Str");
      where.append(fieldValues[index]);
    }
    ps=conn.prepareStatement(String.format(updateClause,set.toString(),where.toString()));
    ps.execute();
  }
 catch (  SQLException ex) {
    Canary.logStacktrace(ex.getMessage(),ex);
  }
catch (  DatabaseTableInconsistencyException dbtiex) {
    Canary.logStacktrace(dbtiex.getMessage(),dbtiex);
  }
 finally {
    closePS(ps);
  }
}
Program: 86689
Project: 86689
Buggy source:
@Override public void remove(String tableName,String[] fieldNames,Object[] fieldValues) throws DatabaseWriteException {
  PreparedStatement ps=null;
  try {
    StringBuilder buildState=new StringBuilder("String_Node_Str" + tableName + "String_Node_Str");
    for (int index=0; index < fieldNames.length; index++) {
      buildState.append(fieldNames[index]);
      buildState.append("String_Node_Str");
    }
    ps=conn.prepareStatement(buildState.toString());
    for (int index=0; index < fieldValues.length; index++) {
      ps.setObject(index + 1,fieldValues[index]);
    }
    ps.execute();
  }
 catch (  SQLException ex) {
    Canary.logStacktrace(ex.getMessage(),ex);
  }
 finally {
    try {
      ps.close();
    }
 catch (    SQLException ex) {
      Canary.logStacktrace(ex.getMessage(),ex);
    }
  }
}

Fixed version (ground truth):
@Override public void remove(String tableName,String[] fieldNames,Object[] fieldValues) throws DatabaseWriteException {
  PreparedStatement ps=null;
  try {
    StringBuilder buildState=new StringBuilder("String_Node_Str" + tableName + "String_Node_Str");
    for (int index=0; index < fieldNames.length && index < fieldValues.length; index++) {
      if (buildState.length() > ("String_Node_Str" + tableName + "String_Node_Str").length()) {
        buildState.append("String_Node_Str").append(fieldNames[index]);
      }
 else {
        buildState.append(fieldNames[index]);
      }
      buildState.append("String_Node_Str");
      buildState.append(fieldValues[index]);
    }
    ps=conn.prepareStatement(buildState.toString());
    ps.execute();
  }
 catch (  SQLException ex) {
    Canary.logStacktrace(ex.getMessage(),ex);
  }
 finally {
    closePS(ps);
  }
}
Program: 86690
Project: 86690
Buggy source:
private SQLiteDatabase(){
  File path=new File("String_Node_Str");
  if (!path.exists()) {
    path.mkdirs();
  }
  try {
    conn=DriverManager.getConnection("String_Node_Str");
  }
 catch (  Exception ex) {
    Canary.logStacktrace("String_Node_Str",ex);
  }
}

Fixed version (ground truth):
private SQLiteDatabase(){
  File path=new File("String_Node_Str");
  if (!path.exists()) {
    path.mkdirs();
  }
  database=Configuration.getDbConfig().getDatabaseName();
  try {
    conn=DriverManager.getConnection("String_Node_Str" + database + "String_Node_Str");
  }
 catch (  Exception ex) {
    Canary.logStacktrace("String_Node_Str",ex);
  }
}
Program: 86691
Project: 86691
Buggy source:
/** 
 * Removes all enchantments from the book
 * @param book the book to remove enchantments from
 * @return true if successful; false if not
 */
public boolean removeAllEnchantments(Item book){
  if (book == null) {
    return false;
  }
  if (book.getType() != ItemType.EnchantedBook) {
    return false;
  }
  if (!book.hasDataTag()) {
    return false;
  }
  if (!book.getDataTag().containsKey("String_Node_Str")) {
    return false;
  }
  book.getDataTag().remove("String_Node_Str");
  book.setId(ItemType.Book.getId());
  return true;
}

Fixed version (ground truth):
/** 
 * Removes all enchantments from the book
 * @param book the book to remove enchantments from
 * @return true if successful; false if not
 */
public static boolean removeAllEnchantments(Item book){
  if (book == null) {
    return false;
  }
  if (book.getType() != ItemType.EnchantedBook) {
    return false;
  }
  if (!book.hasDataTag()) {
    return false;
  }
  if (!book.getDataTag().containsKey("String_Node_Str")) {
    return false;
  }
  book.getDataTag().remove("String_Node_Str");
  book.setId(ItemType.Book.getId());
  return true;
}
Program: 86692
Project: 86692
Buggy source:
/** 
 * Removes the give enchantments from the book
 * @param book the book to remove enchantments from
 * @param enchantments the enchantments to be removed
 * @return true if successful; false if not
 */
public boolean removeEnchantments(Item book,Enchantment... enchantments){
  if (book == null || enchantments == null || enchantments.length == 0) {
    return false;
  }
  if (book.getType() != ItemType.EnchantedBook) {
    return false;
  }
  if (!book.hasDataTag()) {
    return false;
  }
  if (!book.getDataTag().containsKey("String_Node_Str")) {
    return false;
  }
  boolean success=true;
  ListTag<CompoundTag> sto_enchs=book.getDataTag().getListTag("String_Node_Str");
  List<Enchantment> enchs=Arrays.asList(enchantments);
  for (int index=0; index < sto_enchs.size(); ) {
    CompoundTag sto_ench=sto_enchs.get(index);
    for (    Enchantment ench : enchs) {
      if (sto_ench.getShort("String_Node_Str") == ench.getType().getId() && sto_ench.getShort("String_Node_Str") == ench.getLevel()) {
        success&=sto_enchs.remove(index) != null;
      }
    }
  }
  return success;
}

Fixed version (ground truth):
/** 
 * Removes the give enchantments from the book
 * @param book the book to remove enchantments from
 * @param enchantments the enchantments to be removed
 * @return true if successful; false if not
 */
public static boolean removeEnchantments(Item book,Enchantment... enchantments){
  if (book == null || enchantments == null || enchantments.length == 0) {
    return false;
  }
  if (book.getType() != ItemType.EnchantedBook) {
    return false;
  }
  if (!book.hasDataTag()) {
    return false;
  }
  if (!book.getDataTag().containsKey("String_Node_Str")) {
    return false;
  }
  boolean success=true;
  ListTag<CompoundTag> sto_enchs=book.getDataTag().getListTag("String_Node_Str");
  Iterator<CompoundTag> tagItr=sto_enchs.iterator();
  while (tagItr.hasNext()) {
    CompoundTag sto_ench=tagItr.next();
    boolean found=false;
    for (    Enchantment ench : enchantments) {
      if (sto_ench.getShort("String_Node_Str") == ench.getType().getId() && sto_ench.getShort("String_Node_Str") == ench.getLevel()) {
        tagItr.remove();
        found=true;
      }
    }
    success&=found;
  }
  return success;
}
Program: 86693
Project: 86693
Buggy source:
/** 
 * Disables all plugins, used when shutting down the server.
 */
public void disableAllPlugins(){
  for (  Plugin plugin : plugins.keySet()) {
    disablePlugin(plugin,false);
  }
}

Fixed version (ground truth):
/** 
 * Disables all plugins, used when shutting down the server.
 */
public void disableAllPlugins(){
  for (  Plugin plugin : plugins.keySet()) {
    disablePlugin(plugin,true);
  }
}
Program: 86694
Project: 86694
Buggy source:
private boolean enablePlugin(Plugin plugin){
  if (plugin == null) {
    return false;
  }
  if (plugins.get(plugin) == true) {
    return true;
  }
  boolean enabled=false;
  if (plugins.containsKey(plugin)) {
    try {
      enabled=plugin.enable();
    }
 catch (    Throwable t) {
      Canary.logStackTrace("String_Node_Str" + plugin.getName(),t);
    }
  }
 else {
    try {
      File file=new File("String_Node_Str" + plugin.getJarName());
      CanaryClassLoader loader=new CanaryClassLoader(new URL[]{file.toURI().toURL()},Thread.currentThread().getContextClassLoader());
      String pluginName=plugin.getJarName();
      PropertiesFile manifesto=new PropertiesFile(file.getAbsolutePath(),"String_Node_Str");
      Class<?> cls=loader.loadClass(plugin.getClass().getName());
      plugin=(Plugin)cls.newInstance();
      plugin.setLoader(loader,manifesto,pluginName);
      enabled=plugin.enable();
    }
 catch (    Throwable t) {
      Canary.logStackTrace("String_Node_Str" + plugin.getName(),t);
    }
  }
  if (!enabled) {
    plugins.put(plugin,enabled);
    disablePlugin(plugin,true);
  }
 else {
    Canary.logInfo("String_Node_Str" + plugin.getName() + "String_Node_Str"+ plugin.getVersion());
  }
  plugins.put(plugin,enabled);
  return enabled;
}

Fixed version (ground truth):
private boolean enablePlugin(Plugin plugin){
  if (plugin == null) {
    return false;
  }
  if (plugins.get(plugin) == true) {
    return true;
  }
  boolean enabled=false;
  boolean needNewInstance=false;
  if (plugins.containsKey(plugin)) {
    try {
      if (plugin.isClosed()) {
        needNewInstance=true;
      }
 else {
        enabled=plugin.enable();
      }
    }
 catch (    Throwable t) {
      Canary.logStackTrace("String_Node_Str" + plugin.getName(),t);
    }
  }
  if (needNewInstance) {
    try {
      File file=new File("String_Node_Str" + plugin.getJarName());
      CanaryClassLoader loader=new CanaryClassLoader(new URL[]{file.toURI().toURL()},Thread.currentThread().getContextClassLoader());
      String pluginName=plugin.getJarName();
      PropertiesFile manifesto=new PropertiesFile(file.getAbsolutePath(),"String_Node_Str");
      Class<?> cls=loader.loadClass(plugin.getClass().getName());
      plugin=(Plugin)cls.newInstance();
      plugin.setLoader(loader,manifesto,pluginName);
      enabled=plugin.enable();
    }
 catch (    Throwable t) {
      Canary.logStackTrace("String_Node_Str" + plugin.getName(),t);
    }
  }
  if (!enabled) {
    plugins.put(plugin,enabled);
    disablePlugin(plugin,true);
  }
 else {
    Canary.logInfo("String_Node_Str" + plugin.getName() + "String_Node_Str"+ plugin.getVersion());
  }
  plugins.put(plugin,enabled);
  return enabled;
}
Program: 86695
Project: 86695
Buggy source:
private boolean disablePlugin(Plugin plugin,boolean force){
  if (plugin == null) {
    return false;
  }
  if (plugins.get(plugin) == false && !force) {
    return true;
  }
  plugins.put(plugin,false);
  try {
    plugin.disable();
    Canary.logInfo("String_Node_Str" + plugin.getName() + "String_Node_Str"+ plugin.getVersion());
  }
 catch (  Throwable t) {
    Canary.logStackTrace("String_Node_Str" + plugin.getName(),t);
  }
  Canary.hooks().unregisterPluginListeners(plugin);
  Canary.help().unregisterCommands(plugin);
  Canary.commands().unregisterCommands(plugin);
  plugin.getLoader().close();
  return true;
}

Fixed version (ground truth):
private boolean disablePlugin(Plugin plugin,boolean force){
  if (plugin == null) {
    return false;
  }
  if (plugins.get(plugin) == false && !force) {
    return true;
  }
  plugins.put(plugin,false);
  try {
    plugin.disable();
    Canary.logInfo("String_Node_Str" + plugin.getName() + "String_Node_Str"+ plugin.getVersion());
  }
 catch (  Throwable t) {
    Canary.logStackTrace("String_Node_Str" + plugin.getName(),t);
  }
  Canary.hooks().unregisterPluginListeners(plugin);
  Canary.help().unregisterCommands(plugin);
  Canary.commands().unregisterCommands(plugin);
  plugin.markClosed();
  plugin.getLoader().close();
  return true;
}
Program: 86698
Project: 86698
Buggy source:
/** 
 * Disables water routes on this path.
 */
public void disableWaterPathing();

Fixed version (ground truth):
/** 
 * Disables water routes on this path.
 */
@Deprecated public void disableWaterPathing();
Program: 86699
Project: 86699
Buggy source:
/** 
 * Enables water routes on this path.
 */
public void enableWaterPathing();

Fixed version (ground truth):
/** 
 * Enables water routes on this path.
 */
@Deprecated public void enableWaterPathing();
Program: 86701
Project: 86701
Buggy source:
@Override public void updateSchema(DataAccess data) throws DatabaseWriteException {
  File file=new File("String_Node_Str" + data.getName() + "String_Node_Str");
  if (!file.exists()) {
    try {
      file.createNewFile();
      initFile(file,data.getName());
    }
 catch (    IOException e) {
      throw new DatabaseWriteException(e.getMessage());
    }
  }
  try {
    FileInputStream in=new FileInputStream(file);
    Document table=fileBuilder.build(in);
    in.close();
    HashSet<Column> tableLayout=data.getTableLayout();
    for (    Element element : table.getRootElement().getChildren()) {
      addFields(element,tableLayout);
      removeFields(element,tableLayout);
    }
    file.setWritable(true);
    RandomAccessFile f=new RandomAccessFile(file,"String_Node_Str");
    f.getChannel().lock();
    OutputStream out=new FileOutputStream(file,false);
    xmlSerializer.output(table,out);
    f.close();
  }
 catch (  JDOMException e) {
    throw new DatabaseWriteException(e.getMessage());
  }
catch (  IOException e) {
    throw new DatabaseWriteException(e.getMessage());
  }
catch (  DatabaseTableInconsistencyException e) {
    throw new DatabaseWriteException(e.getMessage());
  }
}

Fixed version (ground truth):
@Override public void updateSchema(DataAccess data) throws DatabaseWriteException {
  File file=new File("String_Node_Str" + data.getName() + "String_Node_Str");
  if (!file.exists()) {
    try {
      file.createNewFile();
      initFile(file,data.getName());
    }
 catch (    IOException e) {
      throw new DatabaseWriteException(e.getMessage());
    }
  }
  try {
    FileInputStream in=new FileInputStream(file);
    Document table=fileBuilder.build(in);
    in.close();
    HashSet<Column> tableLayout=data.getTableLayout();
    for (    Element element : table.getRootElement().getChildren()) {
      addFields(element,tableLayout);
      removeFields(element,tableLayout);
    }
    file.setWritable(true);
    RandomAccessFile f=new RandomAccessFile(file,"String_Node_Str");
    f.getChannel().lock();
    FileWriter out=new FileWriter(f.getFD());
    xmlSerializer.output(table,out);
    f.close();
  }
 catch (  JDOMException e) {
    throw new DatabaseWriteException(e.getMessage());
  }
catch (  IOException e) {
    throw new DatabaseWriteException(e.getMessage());
  }
catch (  DatabaseTableInconsistencyException e) {
    throw new DatabaseWriteException(e.getMessage());
  }
}
Program: 86702
Project: 86702
Buggy source:
/** 
 * Inserts data into the XML file. This does NOT update data. It will create a new entry if there isn't the exact same already present
 * @param file
 * @param data
 * @param dbTable
 * @throws IOException
 * @throws DatabaseTableInconsistencyException
 */
private void insertData(File file,DataAccess data,Document dbTable) throws IOException, DatabaseTableInconsistencyException {
  HashMap<Column,Object> entry=data.toDatabaseEntryList();
  if (data.isInconsistent()) {
    throw new DatabaseTableInconsistencyException("String_Node_Str");
  }
  Element set=new Element("String_Node_Str");
  for (  Column column : entry.keySet()) {
    Element col=new Element(column.columnName());
    col.setAttribute("String_Node_Str",String.valueOf(column.autoIncrement()));
    col.setAttribute("String_Node_Str",column.dataType().name());
    col.setAttribute("String_Node_Str",column.columnType().name());
    col.setAttribute("String_Node_Str",String.valueOf(column.isList()));
    addToElement(dbTable,col,entry.get(column),column);
    set.addContent(col);
    boolean foundDupe=false;
    for (    Element c : dbTable.getRootElement().getChildren()) {
      if (elementEquals(set,c)) {
        foundDupe=true;
      }
    }
    if (!foundDupe) {
    }
  }
  dbTable.getRootElement().addContent(set);
  file.setWritable(true);
  RandomAccessFile f=new RandomAccessFile(file,"String_Node_Str");
  f.getChannel().lock();
  OutputStream out=new FileOutputStream(file,false);
  xmlSerializer.output(dbTable,out);
  f.close();
  out.close();
}

Fixed version (ground truth):
/** 
 * Inserts data into the XML file. This does NOT update data. It will create a new entry if there isn't the exact same already present
 * @param file
 * @param data
 * @param dbTable
 * @throws IOException
 * @throws DatabaseTableInconsistencyException
 */
private void insertData(File file,DataAccess data,Document dbTable) throws IOException, DatabaseTableInconsistencyException {
  HashMap<Column,Object> entry=data.toDatabaseEntryList();
  if (data.isInconsistent()) {
    throw new DatabaseTableInconsistencyException("String_Node_Str");
  }
  Element set=new Element("String_Node_Str");
  for (  Column column : entry.keySet()) {
    Element col=new Element(column.columnName());
    col.setAttribute("String_Node_Str",String.valueOf(column.autoIncrement()));
    col.setAttribute("String_Node_Str",column.dataType().name());
    col.setAttribute("String_Node_Str",column.columnType().name());
    col.setAttribute("String_Node_Str",String.valueOf(column.isList()));
    addToElement(dbTable,col,entry.get(column),column);
    set.addContent(col);
    boolean foundDupe=false;
    for (    Element c : dbTable.getRootElement().getChildren()) {
      if (elementEquals(set,c)) {
        foundDupe=true;
      }
    }
    if (!foundDupe) {
    }
  }
  dbTable.getRootElement().addContent(set);
  file.setWritable(true);
  RandomAccessFile f=new RandomAccessFile(file,"String_Node_Str");
  f.getChannel().lock();
  f.setLength(0);
  FileWriter writer=new FileWriter(f.getFD());
  xmlSerializer.output(dbTable,writer);
  f.close();
}
Program: 86703
Project: 86703
Buggy source:
private void initFile(File file,String rootName) throws IOException {
  Document doc=new Document();
  doc.setRootElement(new Element(rootName));
  file.setWritable(true);
  RandomAccessFile f=new RandomAccessFile(file,"String_Node_Str");
  f.getChannel().lock();
  OutputStream out=new FileOutputStream(file,false);
  xmlSerializer.output(doc,out);
  f.close();
  out.close();
}

Fixed version (ground truth):
private void initFile(File file,String rootName) throws IOException {
  Document doc=new Document();
  doc.setRootElement(new Element(rootName));
  file.setWritable(true);
  RandomAccessFile f=new RandomAccessFile(file,"String_Node_Str");
  f.getChannel().lock();
  f.setLength(0);
  FileWriter writer=new FileWriter(f.getFD());
  xmlSerializer.output(doc,writer);
  f.close();
}
Program: 86704
Project: 86704
Buggy source:
private void removeData(File file,Document table,String[] fields,Object[] values) throws IOException, DatabaseTableInconsistencyException {
  for (  Element element : table.getRootElement().getChildren()) {
    int equalFields=0;
    for (int i=0; i < fields.length; ++i) {
      Element child=element.getChild(fields[i]);
      if (child != null) {
        if (child.getText().equals(String.valueOf(values[i]))) {
          equalFields++;
        }
      }
    }
    if (equalFields != fields.length) {
      continue;
    }
    table.getRootElement().removeContent(element);
    element.detach();
  }
  file.setWritable(true);
  RandomAccessFile f=new RandomAccessFile(file.getPath(),"String_Node_Str");
  f.getChannel().lock();
  OutputStream out=new FileOutputStream(file,false);
  xmlSerializer.output(table,out);
  out.close();
  f.close();
}

Fixed version (ground truth):
private void removeData(File file,Document table,String[] fields,Object[] values) throws IOException, DatabaseTableInconsistencyException {
  for (  Element element : table.getRootElement().getChildren()) {
    int equalFields=0;
    for (int i=0; i < fields.length; ++i) {
      Element child=element.getChild(fields[i]);
      if (child != null) {
        if (child.getText().equals(String.valueOf(values[i]))) {
          equalFields++;
        }
      }
    }
    if (equalFields != fields.length) {
      continue;
    }
    table.getRootElement().removeContent(element);
    element.detach();
  }
  file.setWritable(true);
  RandomAccessFile f=new RandomAccessFile(file.getPath(),"String_Node_Str");
  f.getChannel().lock();
  f.setLength(0);
  FileWriter writer=new FileWriter(f.getFD());
  xmlSerializer.output(table,writer);
  f.close();
}
Program: 86705
Project: 86705
Buggy source:
/** 
 * Creates a recursively created list of all subcommands and their subcommands etc etc
 * @param list
 * @return
 */
public ArrayList<CanaryCommand> getSubCommands(ArrayList<CanaryCommand> list){
  if (parent != null) {
    list.add(this);
  }
  for (  CanaryCommand cmd : subcommands) {
    cmd.getSubCommands(list);
  }
  return list;
}

Fixed version (ground truth):
/** 
 * Returns the list of subcommands.
 * @return
 */
public ArrayList<CanaryCommand> getSubCommands(){
  return subcommands;
}
Program: 86706
Project: 86706
Buggy source:
@Command(aliases={"String_Node_Str","String_Node_Str"},description="String_Node_Str",permissions={"String_Node_Str"},toolTip="String_Node_Str",min=2) public void emoteCommand(MessageReceiver caller,String[] parameters){
  new EmoteChat().execute(caller,parameters);
}

Fixed version (ground truth):
@Command(aliases={"String_Node_Str"},description="String_Node_Str",permissions={"String_Node_Str","String_Node_Str"},toolTip="String_Node_Str",min=2) public void emoteCommand(MessageReceiver caller,String[] parameters){
  new EmoteChat().execute(caller,parameters);
}
Program: 86708
Project: 86708
Buggy source:
private void console(MessageReceiver caller,String[] cmd){
  if (cmd.length < 2) {
    caller.notice(Translator.translateAndFormat("String_Node_Str","String_Node_Str"));
    return;
  }
  Ban ban=new Ban();
  Player p=Canary.getServer().matchPlayer(cmd[1]);
  String reason="String_Node_Str";
  long timestamp=-1L;
  if (cmd.length >= 3) {
    try {
      timestamp=Canary.parseTime(Long.parseLong(cmd[cmd.length - 2]),cmd[cmd.length - 1]);
      reason=StringUtils.joinString(cmd,"String_Node_Str",2,cmd.length - 2);
    }
 catch (    NumberFormatException e) {
      reason=StringUtils.joinString(cmd,"String_Node_Str",2);
      timestamp=-1L;
    }
  }
  ban.setReason(reason);
  ban.setTimestamp(timestamp);
  ban.setBanningPlayer(caller.getName());
  if (p != null) {
    ban.setSubject(p.getName());
    Canary.bans().issueBan(ban);
    Canary.hooks().callHook(new BanHook(p,p.getIP(),null,reason,timestamp));
    caller.notice(Translator.translateAndFormat("String_Node_Str",p.getName()));
    p.kick(reason);
  }
 else {
    ban.setSubject(cmd[1]);
    Canary.bans().issueBan(ban);
    Canary.hooks().callHook(new BanHook(null,"String_Node_Str",null,reason,timestamp));
    caller.notice(Translator.translateAndFormat("String_Node_Str",cmd[1]));
  }
}

Fixed version (ground truth):
private void console(MessageReceiver caller,String[] cmd){
  if (cmd.length < 2) {
    Canary.help().getHelp(caller,"String_Node_Str");
    return;
  }
  Ban ban=new Ban();
  Player p=Canary.getServer().matchPlayer(cmd[1]);
  String reason="String_Node_Str";
  long timestamp=-1L;
  if (cmd.length >= 3) {
    try {
      timestamp=Canary.parseTime(Long.parseLong(cmd[cmd.length - 2]),cmd[cmd.length - 1]);
      reason=StringUtils.joinString(cmd,"String_Node_Str",2,cmd.length - 2);
    }
 catch (    NumberFormatException e) {
      reason=StringUtils.joinString(cmd,"String_Node_Str",2);
      timestamp=-1L;
    }
  }
  ban.setReason(reason);
  ban.setTimestamp(timestamp);
  ban.setBanningPlayer(caller.getName());
  if (p != null) {
    ban.setSubject(p.getName());
    Canary.bans().issueBan(ban);
    Canary.hooks().callHook(new BanHook(p,p.getIP(),null,reason,timestamp));
    caller.notice(Translator.translateAndFormat("String_Node_Str",p.getName()));
    p.kick(reason);
  }
 else {
    ban.setSubject(cmd[1]);
    Canary.bans().issueBan(ban);
    Canary.hooks().callHook(new BanHook(null,"String_Node_Str",null,reason,timestamp));
    caller.notice(Translator.translateAndFormat("String_Node_Str",cmd[1]));
  }
}
Program: 86709
Project: 86709
Buggy source:
private void player(Player caller,String[] cmd){
  if (cmd.length < 2) {
    caller.notice(Translator.translateAndFormat("String_Node_Str","String_Node_Str"));
    return;
  }
  Ban ban=new Ban();
  Player p=Canary.getServer().matchPlayer(cmd[1]);
  String reason="String_Node_Str";
  long timestamp=-1L;
  if (cmd.length >= 3) {
    try {
      timestamp=Canary.parseTime(Long.parseLong(cmd[cmd.length - 2]),cmd[cmd.length - 1]);
      reason=StringUtils.joinString(cmd,"String_Node_Str",2,cmd.length - 2);
    }
 catch (    NumberFormatException e) {
      reason=StringUtils.joinString(cmd,"String_Node_Str",2);
      timestamp=-1L;
    }
  }
  ban.setReason(reason);
  ban.setTimestamp(timestamp);
  ban.setBanningPlayer(caller.getName());
  if (p != null) {
    ban.setSubject(p.getName());
    Canary.bans().issueBan(ban);
    Canary.hooks().callHook(new BanHook(p,p.getIP(),caller,reason,timestamp));
    caller.notice(Translator.translateAndFormat("String_Node_Str",p.getName()));
    p.kick(reason);
  }
 else {
    ban.setSubject(cmd[1]);
    Canary.bans().issueBan(ban);
    Canary.hooks().callHook(new BanHook(null,"String_Node_Str",caller,reason,timestamp));
    caller.notice(Translator.translateAndFormat("String_Node_Str",cmd[1]));
  }
}

Fixed version (ground truth):
private void player(Player caller,String[] cmd){
  if (cmd.length < 2) {
    Canary.help().getHelp(caller,"String_Node_Str");
    return;
  }
  Ban ban=new Ban();
  Player p=Canary.getServer().matchPlayer(cmd[1]);
  String reason="String_Node_Str";
  long timestamp=-1L;
  if (cmd.length >= 3) {
    try {
      timestamp=Canary.parseTime(Long.parseLong(cmd[cmd.length - 2]),cmd[cmd.length - 1]);
      reason=StringUtils.joinString(cmd,"String_Node_Str",2,cmd.length - 2);
    }
 catch (    NumberFormatException e) {
      reason=StringUtils.joinString(cmd,"String_Node_Str",2);
      timestamp=-1L;
    }
  }
  ban.setReason(reason);
  ban.setTimestamp(timestamp);
  ban.setBanningPlayer(caller.getName());
  if (p != null) {
    ban.setSubject(p.getName());
    Canary.bans().issueBan(ban);
    Canary.hooks().callHook(new BanHook(p,p.getIP(),caller,reason,timestamp));
    caller.notice(Translator.translateAndFormat("String_Node_Str",p.getName()));
    p.kick(reason);
  }
 else {
    ban.setSubject(cmd[1]);
    Canary.bans().issueBan(ban);
    Canary.hooks().callHook(new BanHook(null,"String_Node_Str",caller,reason,timestamp));
    caller.notice(Translator.translateAndFormat("String_Node_Str",cmd[1]));
  }
}
Program: 86710
Project: 86710
Buggy source:
private void console(MessageReceiver caller,String[] args){
  if (args.length < 3) {
    caller.notice(Translator.translateAndFormat("String_Node_Str","String_Node_Str"));
    return;
  }
  int amount=1;
  if (args[args.length - 2].matches("String_Node_Str")) {
    amount=Integer.parseInt(args[args.length - 2]);
  }
  Item item=Canary.factory().getItemFactory().newItem(args[1]);
  if (item == null) {
    caller.notice(Translator.translateAndFormat("String_Node_Str",args[1]));
    return;
  }
  item.setAmount(amount);
  Player target=Canary.getServer().matchPlayer(args[args.length - 1]);
  if (target == null) {
    caller.notice(Translator.translateAndFormat("String_Node_Str",args[args.length - 1]));
    return;
  }
  target.giveItem(item);
  target.sendMessage(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",item.getType().getDisplayName()));
  caller.notice(Translator.translateAndFormat("String_Node_Str",target.getName()));
}

Fixed version (ground truth):
private void console(MessageReceiver caller,String[] args){
  if (args.length < 3) {
    Canary.help().getHelp(caller,"String_Node_Str");
    return;
  }
  int amount=1;
  if (args[args.length - 2].matches("String_Node_Str")) {
    amount=Integer.parseInt(args[args.length - 2]);
  }
  Item item=Canary.factory().getItemFactory().newItem(args[1]);
  if (item == null) {
    caller.notice(Translator.translateAndFormat("String_Node_Str",args[1]));
    return;
  }
  item.setAmount(amount);
  Player target=Canary.getServer().matchPlayer(args[args.length - 1]);
  if (target == null) {
    caller.notice(Translator.translateAndFormat("String_Node_Str",args[args.length - 1]));
    return;
  }
  target.giveItem(item);
  target.sendMessage(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",item.getType().getDisplayName()));
  caller.notice(Translator.translateAndFormat("String_Node_Str",target.getName()));
}
Program: 86711
Project: 86711
Buggy source:
private void console(MessageReceiver caller,String[] cmd){
  if (cmd.length < 2) {
    caller.notice(Translator.translateAndFormat("String_Node_Str","String_Node_Str"));
    return;
  }
  Player p=Canary.getServer().matchPlayer(cmd[1]);
  if (p == null) {
    caller.notice(Translator.translate("String_Node_Str") + "String_Node_Str" + Translator.translateAndFormat("String_Node_Str",cmd[1]));
    return;
  }
  Ban ban=new Ban();
  String reason="String_Node_Str";
  long timestamp=-1L;
  if (cmd.length >= 3) {
    try {
      timestamp=Canary.parseTime(Long.parseLong(cmd[cmd.length - 2]),cmd[cmd.length - 1]);
      reason=StringUtils.joinString(cmd,"String_Node_Str",2,cmd.length - 2);
    }
 catch (    NumberFormatException e) {
      reason=StringUtils.joinString(cmd,"String_Node_Str",2);
      timestamp=-1L;
    }
  }
  ban.setReason(reason);
  ban.setTimestamp(timestamp);
  ban.setBanningPlayer(caller.getName());
  ban.setSubject(p.getName());
  ban.setIp(p.getIP());
  ban.setIsIpBan(true);
  Canary.bans().issueBan(ban);
  Canary.hooks().callHook(new BanHook(p,p.getIP(),null,reason,timestamp));
  caller.notice(Translator.translateAndFormat("String_Node_Str",cmd[1]));
  p.kick(reason);
}

Fixed version (ground truth):
private void console(MessageReceiver caller,String[] cmd){
  if (cmd.length < 2) {
    Canary.help().getHelp(caller,"String_Node_Str");
    return;
  }
  Player p=Canary.getServer().matchPlayer(cmd[1]);
  if (p == null) {
    caller.notice(Translator.translate("String_Node_Str") + "String_Node_Str" + Translator.translateAndFormat("String_Node_Str",cmd[1]));
    return;
  }
  Ban ban=new Ban();
  String reason="String_Node_Str";
  long timestamp=-1L;
  if (cmd.length >= 3) {
    try {
      timestamp=Canary.parseTime(Long.parseLong(cmd[cmd.length - 2]),cmd[cmd.length - 1]);
      reason=StringUtils.joinString(cmd,"String_Node_Str",2,cmd.length - 2);
    }
 catch (    NumberFormatException e) {
      reason=StringUtils.joinString(cmd,"String_Node_Str",2);
      timestamp=-1L;
    }
  }
  ban.setReason(reason);
  ban.setTimestamp(timestamp);
  ban.setBanningPlayer(caller.getName());
  ban.setSubject(p.getName());
  ban.setIp(p.getIP());
  ban.setIsIpBan(true);
  Canary.bans().issueBan(ban);
  Canary.hooks().callHook(new BanHook(p,p.getIP(),null,reason,timestamp));
  caller.notice(Translator.translateAndFormat("String_Node_Str",cmd[1]));
  p.kick(reason);
}
Program: 86712
Project: 86712
Buggy source:
private void player(Player caller,String[] cmd){
  if (cmd.length < 2) {
    caller.notice(Translator.translateAndFormat("String_Node_Str","String_Node_Str"));
    return;
  }
  Player p=Canary.getServer().matchPlayer(cmd[1]);
  if (p == null) {
    caller.notice(Translator.translate("String_Node_Str") + "String_Node_Str" + Translator.translateAndFormat("String_Node_Str",cmd[1]));
    return;
  }
  Ban ban=new Ban();
  String reason="String_Node_Str";
  long timestamp=-1L;
  if (cmd.length >= 3) {
    try {
      timestamp=Canary.parseTime(Long.parseLong(cmd[cmd.length - 2]),cmd[cmd.length - 1]);
      reason=StringUtils.joinString(cmd,"String_Node_Str",2,cmd.length - 2);
    }
 catch (    NumberFormatException e) {
      reason=StringUtils.joinString(cmd,"String_Node_Str",2);
      timestamp=-1L;
    }
  }
  ban.setReason(reason);
  ban.setTimestamp(timestamp);
  ban.setBanningPlayer(caller.getName());
  ban.setSubject(p.getName());
  ban.setIp(p.getIP());
  ban.setIsIpBan(true);
  Canary.bans().issueBan(ban);
  Canary.hooks().callHook(new BanHook(p,p.getIP(),caller,reason,timestamp));
  caller.notice(Translator.translateAndFormat("String_Node_Str",cmd[1]));
  p.kick(reason);
}

Fixed version (ground truth):
private void player(Player caller,String[] cmd){
  if (cmd.length < 2) {
    Canary.help().getHelp(caller,"String_Node_Str");
    return;
  }
  Player p=Canary.getServer().matchPlayer(cmd[1]);
  if (p == null) {
    caller.notice(Translator.translate("String_Node_Str") + "String_Node_Str" + Translator.translateAndFormat("String_Node_Str",cmd[1]));
    return;
  }
  Ban ban=new Ban();
  String reason="String_Node_Str";
  long timestamp=-1L;
  if (cmd.length >= 3) {
    try {
      timestamp=Canary.parseTime(Long.parseLong(cmd[cmd.length - 2]),cmd[cmd.length - 1]);
      reason=StringUtils.joinString(cmd,"String_Node_Str",2,cmd.length - 2);
    }
 catch (    NumberFormatException e) {
      reason=StringUtils.joinString(cmd,"String_Node_Str",2);
      timestamp=-1L;
    }
  }
  ban.setReason(reason);
  ban.setTimestamp(timestamp);
  ban.setBanningPlayer(caller.getName());
  ban.setSubject(p.getName());
  ban.setIp(p.getIP());
  ban.setIsIpBan(true);
  Canary.bans().issueBan(ban);
  Canary.hooks().callHook(new BanHook(p,p.getIP(),caller,reason,timestamp));
  caller.notice(Translator.translateAndFormat("String_Node_Str",cmd[1]));
  p.kick(reason);
}
Program: 86715
Project: 86715
Buggy source:
private void player(Player player,String[] args){
  World dim=player.getWorld();
  if (args[0].equals("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    player.sendMessage(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",dim.getRelativeTime(),dim.getRawTime()));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    player.sendMessage(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",dim.getRelativeTime(),dim.getRawTime()));
  }
 else   if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(0L);
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else   if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(13000L);
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else   if (args[1].matches("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(Long.parseLong(args[1]));
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else {
    player.notice(Translator.translateAndFormat("String_Node_Str","String_Node_Str"));
  }
}

Fixed version (ground truth):
private void player(Player player,String[] args){
  World dim=player.getWorld();
  if (args[0].equals("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    player.sendMessage(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",dim.getRelativeTime(),dim.getRawTime()));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    player.sendMessage(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",dim.getRelativeTime(),dim.getRawTime()));
  }
 else   if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(0L);
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else   if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(13000L);
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else   if (args[1].matches("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setTime(Long.parseLong(args[1]));
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else {
    Canary.help().getHelp(player,"String_Node_Str");
  }
}
Program: 86716
Project: 86716
Buggy source:
private void player(Player player,String[] args){
  World dim=player.getWorld();
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    String weather=dim.isRaining() ? "String_Node_Str" : "String_Node_Str";
    weather=dim.isThundering() ? "String_Node_Str" : "String_Node_Str";
    player.sendMessage(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",weather));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setRaining(true);
    dim.setRainTime(new Random().nextInt(15000));
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setThundering(true);
    dim.setThunderTime(new Random().nextInt(15000));
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
  if (args[1].matches("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setRaining(false);
    dim.setRainTime(0);
    dim.setThundering(false);
    dim.setThunderTime(0);
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else {
    player.notice(Translator.translateAndFormat("String_Node_Str","String_Node_Str"));
  }
}

Fixed version (ground truth):
private void player(Player player,String[] args){
  World dim=player.getWorld();
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    String weather=dim.isRaining() ? "String_Node_Str" : "String_Node_Str";
    weather=dim.isThundering() ? "String_Node_Str" : "String_Node_Str";
    player.sendMessage(Colors.YELLOW + Translator.translateAndFormat("String_Node_Str",weather));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setRaining(true);
    dim.setRainTime(new Random().nextInt(15000));
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
  if (args[1].equalsIgnoreCase("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setThundering(true);
    dim.setThunderTime(new Random().nextInt(15000));
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
  if (args[1].matches("String_Node_Str")) {
    if (!player.hasPermission("String_Node_Str")) {
      return;
    }
    dim.setRaining(false);
    dim.setRainTime(0);
    dim.setThundering(false);
    dim.setThunderTime(0);
    player.sendMessage(Colors.YELLOW + Translator.translate("String_Node_Str"));
    return;
  }
 else {
    Canary.help().getHelp(player,"String_Node_Str");
  }
}