nus-yam/ex-repair huggingface dataset:
Program: 89811
Project: 89811
Buggy source:
/** 
 * This should creates a batch job for retrieving the checksum of the  wanted files.
 * @param replyChannel The channel where the reply should be sent.
 * @param filename The name of the file to retrieve the checksum from.
 * @return The message when it has been sent.
 * @throws NotImplementedException Always, since it has not yet been implemented.
 * @throws ArgumentNotValid If the replyChannel is null or the filename either is null or empty.
 */
public GetChecksumMessage getChecksum(ChannelID replyChannel,String filename) throws NotImplementedException, ArgumentNotValid {
  ArgumentNotValid.checkNotNull(replyChannel,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(filename,"String_Node_Str");
  throw new NotImplementedException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Method for retrieving the checksum of a specific arcfile within the archive.
 * @param replyChannel The channel where the reply should be sent.
 * @param filename The GetChecksumMessage which has been sent to the checksum archive though the jms connection.
 * @return The GetChecksumMessage which is sent.
 * @throws ArgumentNotValid If the reply channel is null or if the filenameis either null or the empty string.
 */
public GetChecksumMessage getChecksum(ChannelID replyChannel,String filename) throws ArgumentNotValid {
  ArgumentNotValid.checkNotNull(replyChannel,"String_Node_Str");
  ArgumentNotValid.checkNotNullOrEmpty(filename,"String_Node_Str");
  GetChecksumMessage msg=new GetChecksumMessage(theBamon,replyChannel,filename,"String_Node_Str" + "String_Node_Str");
  jmsCon.send(msg);
  log.debug("String_Node_Str" + msg.toString() + "String_Node_Str");
  return msg;
}
Program: 89812
Project: 89812
Buggy source:
/** 
 * Submit an already constructed getfile message to the archive.
 * @param msg get file message to retrieve.
 */
public void getFile(GetFileMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  log.debug("String_Node_Str" + msg + "String_Node_Str");
  con.resend(msg,this.allBa);
}

Fixed version (ground truth):
/** 
 * Submit an already constructed getfile message to the archive.
 * @param msg get file message to retrieve.
 */
public void getFile(GetFileMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  log.debug("String_Node_Str" + msg + "String_Node_Str");
  jmsCon.resend(msg,this.allBa);
}
Program: 89813
Project: 89813
Buggy source:
/** 
 * Submit an already constructed batch message to the archive. The reply goes directly back to whoever sent the message.
 * @param msg the message to be processed by the get command.
 */
public void get(GetMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  log.debug("String_Node_Str" + msg + "String_Node_Str");
  try {
    con.resend(msg,Channels.getAllBa());
  }
 catch (  Throwable e) {
    log.warn("String_Node_Str" + msg,e);
    try {
      msg.setNotOk(e);
      con.reply(msg);
    }
 catch (    Throwable e1) {
      log.warn("String_Node_Str",e1);
    }
  }
}

Fixed version (ground truth):
/** 
 * Submit an already constructed batch message to the archive. The reply goes directly back to whoever sent the message.
 * @param msg the message to be processed by the get command.
 */
public void get(GetMessage msg){
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  log.debug("String_Node_Str" + msg + "String_Node_Str");
  try {
    jmsCon.resend(msg,Channels.getAllBa());
  }
 catch (  Throwable e) {
    log.warn("String_Node_Str" + msg,e);
    try {
      msg.setNotOk(e);
      jmsCon.reply(msg);
    }
 catch (    Throwable e1) {
      log.warn("String_Node_Str",e1);
    }
  }
}
Program: 89814
Project: 89814
Buggy source:
/** 
 * This should creates a batch job for retrieving the checksum of all the  files.
 * @param msg The message.
 * @throws NotImplementedException Always, since this method has not yet been implemented.
 * @throws ArgumentNotValid If the GetAllChecksumMessage is null.
 */
public void getAllChecksums(GetAllChecksumsMessage msg) throws NotImplementedException, ArgumentNotValid {
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  throw new NotImplementedException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Method for sending the GetAllChecksumMessage to the ChecksumReplica.
 * @param msg The GetAllChecksumMessage, which will be sent through the jmsconnection to the checksum archive.
 * @throws ArgumentnotValid If the GetAllChecksumsMessage is null.
 */
public void getAllChecksums(GetAllChecksumsMessage msg) throws ArgumentNotValid {
  ArgumentNotValid.checkNotNull(msg,"String_Node_Str");
  jmsCon.resend(msg,theBamon);
  log.debug("String_Node_Str" + msg.toString() + "String_Node_Str");
}
Program: 89815
Project: 89815
Buggy source:
/** 
 * The constructor.
 * @param configSource The source configuration file.
 */
public CreateTestInstance(File configSource){
  ArgumentNotValid.checkNotNull(configSource,"String_Node_Str");
  source=configSource;
  deployConfiguration=new XmlStructure(source);
  offsetPaths=new OffsetSystem[0];
  offsetVal=new String();
}

Fixed version (ground truth):
/** 
 * The constructor.
 * @param configSource The source configuration file.
 */
public CreateTestInstance(File configSource){
  ArgumentNotValid.checkNotNull(configSource,"String_Node_Str");
  source=configSource;
  deployConfiguration=new XmlStructure(source);
  offsetPaths=new OffsetSystem[0];
  offsetVal="String_Node_Str";
}
Program: 89817
Project: 89817
Buggy source:
/** 
 * Creates a the log property file for every application. This is done by taking the inherited log file and changing  "APPID" in the file into the identification of the application.
 * @param directory The local directory for this machine
 */
protected void createLogPropertyFiles(File directory){
  ArgumentNotValid.checkNotNull(directory,"String_Node_Str");
  for (  Application app : applications) {
    try {
      File logProp=new File(directory,Constants.LOG_PROP_APPLICATION_PREFIX + app.getIdentification() + Constants.LOG_PROP_APPLICATION_SUFFIX);
      FileWriter logfw=new FileWriter(logProp);
      String prop=FileUtils.readFile(inheritedLogPropFile);
      prop=prop.replace(Constants.LOG_PROPERTY_APPLICATION_ID_TAG,app.getIdentification());
      try {
        logfw.write(prop);
      }
  finally {
        if (logfw != null) {
          logfw.close();
        }
      }
    }
 catch (    IOException e) {
      String errMsg="String_Node_Str";
      log.warn(errMsg,e);
      throw new IOFailure(errMsg,e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Creates a the log property file for every application. This is done by taking the inherited log file and changing  "APPID" in the file into the identification of the application.
 * @param directory The local directory for this machine
 */
protected void createLogPropertyFiles(File directory){
  ArgumentNotValid.checkNotNull(directory,"String_Node_Str");
  for (  Application app : applications) {
    File logProp=new File(directory,Constants.LOG_PROP_APPLICATION_PREFIX + app.getIdentification() + Constants.LOG_PROP_APPLICATION_SUFFIX);
    try {
      PrintWriter logPrinter=new PrintWriter(logProp);
      try {
        String prop=FileUtils.readFile(inheritedLogPropFile);
        prop=prop.replace(Constants.LOG_PROPERTY_APPLICATION_ID_TAG,app.getIdentification());
        logPrinter.write(prop);
      }
  finally {
        logPrinter.close();
      }
    }
 catch (    IOException e) {
      String errMsg="String_Node_Str";
      log.warn(errMsg,e);
      throw new IOFailure(errMsg,e);
    }
  }
}
Program: 89821
Project: 89821
Buggy source:
/** 
 * For acquiring all the values of the leafs at the end of the path.
 * @param path The path to the branches.
 * @return The values of the leafs.
 */
public String[] getSettingsValues(String[] path){
  ArgumentNotValid.checkNotNull(path,"String_Node_Str");
  ArgumentNotValid.checkNotNegative(path.length,"String_Node_Str");
  return settings.getLeafValues(path);
}

Fixed version (ground truth):
/** 
 * For acquiring all the values of the leafs at the end of the path.
 * @param path The path to the branches.
 * @return The values of the leafs. If no values were found, then an emptycollection of strings are returned.
 */
public String[] getSettingsValues(String[] path){
  ArgumentNotValid.checkNotNull(path,"String_Node_Str");
  ArgumentNotValid.checkNotNegative(path.length,"String_Node_Str");
  return settings.getLeafValues(path);
}
Program: 89827
Project: 89827
Buggy source:
/** 
 * Function to create the script which installs the new directories. This is only used for windows machines!
 * @param directory The directory to put the file
 */
@Override protected void createInstallDirScript(File directory){
  File dirScript=new File(directory,getMakeDirectoryName());
  try {
    PrintWriter dirPrint=new PrintWriter(dirScript);
    try {
      dirPrint.print(ScriptConstants.CD + Constants.SPACE);
      dirPrint.print(getInstallDirPath());
      dirPrint.print(Constants.NEWLINE);
      String dir;
      dir=settings.getLeafValue(Constants.SETTINGS_ARCHIVE_BP_BASEDIR_LEAF);
      if (dir != null && !dir.isEmpty() && !dir.equalsIgnoreCase(Constants.DOT)) {
        dirPrint.print(createPathToDir(dir));
        dirPrint.print(scriptCreateDir(dir,false));
      }
      dir=settings.getLeafValue(Constants.SETTINGS_ARCHIVE_ARC_BASEDIR_LEAF);
      if (dir != null && !dir.isEmpty() && !dir.equalsIgnoreCase(Constants.DOT)) {
        dirPrint.print(createPathToDir(dir));
        dirPrint.print(scriptCreateDir(dir,false));
      }
      dirPrint.print(getAppDirectories());
      dir=settings.getLeafValue(Constants.SETTINGS_TEMPDIR_LEAF);
      if (dir != null && !dir.isEmpty() && !dir.equalsIgnoreCase(Constants.DOT)) {
        dirPrint.print(createPathToDir(dir));
        dirPrint.print(scriptCreateDir(dir,resetTempDir));
      }
    }
  finally {
      dirPrint.close();
    }
  }
 catch (  IOException e) {
    String msg="String_Node_Str" + e;
    log.trace(msg);
    throw new IOFailure(msg);
  }
}

Fixed version (ground truth):
/** 
 * Function to create the script which installs the new directories. This is only used for windows machines!
 * @param directory The directory to put the file
 */
@Override protected void createInstallDirScript(File directory){
  File dirScript=new File(directory,getMakeDirectoryName());
  try {
    PrintWriter dirPrint=new PrintWriter(dirScript);
    try {
      dirPrint.print(ScriptConstants.CD + Constants.SPACE);
      dirPrint.print(getInstallDirPath());
      dirPrint.print(Constants.NEWLINE);
      String dir;
      dir=settings.getLeafValue(Constants.SETTINGS_ARCHIVE_BP_BASEDIR_LEAF);
      if (dir != null && !dir.isEmpty() && !dir.equalsIgnoreCase(Constants.DOT)) {
        dirPrint.print(createPathToDir(dir));
        dirPrint.print(scriptCreateDir(dir,false));
      }
      dir=settings.getLeafValue(Constants.SETTINGS_ARCHIVE_ARC_BASEDIR_LEAF);
      if (dir != null && !dir.isEmpty() && !dir.equalsIgnoreCase(Constants.DOT)) {
        dirPrint.print(createPathToDir(dir));
        dirPrint.print(scriptCreateDir(dir,false));
      }
      dirPrint.print(getAppDirectories());
      dir=settings.getLeafValue(Constants.SETTINGS_TEMPDIR_LEAF);
      if (dir != null && !dir.isEmpty() && !dir.equalsIgnoreCase(Constants.DOT)) {
        dirPrint.print(createPathToDir(dir));
        dirPrint.print(scriptCreateDir(dir,resetTempDir));
      }
    }
  finally {
      dirPrint.close();
    }
  }
 catch (  IOException e) {
    String msg="String_Node_Str";
    log.trace(msg,e);
    throw new IOFailure(msg,e);
  }
}
Program: 89828
Project: 89828
Buggy source:
/** 
 * Retrieves the content of a the leafs deep in the tree structure. It only retrieves branches at the first path.
 * @param path Specifies the path in the tree (e.g. in HTML: GetSubChildValue("HTML", "HEAD", "TITLE") to get the title of  a HTML document)
 * @return The content of the leaf. If it is not a leaf, return null.Returns 'null' if the path to the branch cannot be found.   
 */
public String[] getLeafValues(String... path){
  ArgumentNotValid.checkNotNull(path,"String_Node_Str");
  List<Element> elemList=getAllChildrenAlongPath(root,path);
  if (elemList.isEmpty()) {
    return new String[0];
  }
  String[] res=new String[elemList.size()];
  for (int i=0; i < elemList.size(); i++) {
    res[i]=elemList.get(i).getText();
  }
  return res;
}

Fixed version (ground truth):
/** 
 * Retrieves the content of a the leafs deep in the tree structure. It only retrieves branches at the first path.
 * @param path Specifies the path in the tree (e.g. in HTML: GetSubChildValue("HTML", "HEAD", "TITLE") to get the title of  a HTML document)
 * @return The content of the leaf. If no leafs are found then an emptycollection of strings are returned (new String[0]).   
 */
public String[] getLeafValues(String... path){
  ArgumentNotValid.checkNotNull(path,"String_Node_Str");
  List<Element> elemList=getAllChildrenAlongPath(root,path);
  if (elemList.isEmpty()) {
    return new String[0];
  }
  String[] res=new String[elemList.size()];
  for (int i=0; i < elemList.size(); i++) {
    res[i]=elemList.get(i).getText();
  }
  return res;
}
Program: 89829
Project: 89829
Buggy source:
/** 
 * Increment the number of upload retries.
 * @param replicaChannelName The name of the identification channelfor the replica.
 * @param arcfileName The name of a given ARC file.
 */
private void incRetry(String replicaChannelName,String arcfileName){
  Map<String,Integer> replicaRetries=uploadRetries.get(replicaChannelName);
  if (replicaRetries == null) {
    replicaRetries=new HashMap<String,Integer>();
    uploadRetries.put(replicaChannelName,replicaRetries);
  }
  Integer retryCount=replicaRetries.get(arcfileName);
  if (retryCount == null) {
    replicaRetries.put(arcfileName,new Integer(1));
    return;
  }
  replicaRetries.put(arcfileName,new Integer(retryCount + 1));
}

Fixed version (ground truth):
/** 
 * Increment the number of upload retries.
 * @param replicaChannelName The name of the identification channelfor the replica.
 * @param arcfileName The name of a given ARC file.
 */
private void incRetry(String replicaChannelName,String arcfileName){
  Map<String,Integer> replicaRetries=uploadRetries.get(replicaChannelName);
  if (replicaRetries == null) {
    replicaRetries=new HashMap<String,Integer>();
    uploadRetries.put(replicaChannelName,replicaRetries);
  }
  Integer retryCount=replicaRetries.get(arcfileName);
  if (retryCount == null) {
    replicaRetries.put(arcfileName,Integer.valueOf(1));
    return;
  }
  replicaRetries.put(arcfileName,Integer.valueOf(retryCount + 1));
}
Program: 89831
Project: 89831
Buggy source:
/** 
 * Return files with filelist_status CORRUPT for the replica, but not  present in the last missing files job. This is done by querying the database for files with different checksum from the checksum in the last known update date for bitarchive, but which are present from admin data.
 * @param replica The replica to check for.
 */
Iterable<String> getWrongFilesInLastUpdate(Replica replica);

Fixed version (ground truth):
/** 
 * Return files with filelist_status CORRUPT for the replica, but not  present in the last missing files job. This is done by querying the database for files with different checksum  from the checksum in the last known update date for bitarchive, but  which are present from admin data.
 * @param replica The replica to check for.
 * @return The list of wrong files for the replica in the last update.
 */
Iterable<String> getWrongFilesInLastUpdate(Replica replica);
Program: 89832
Project: 89832
Buggy source:
/** 
 * Return the count of corrupt files for replica.
 * @param replica The replica to get the count for.
 */
long getNumberOfWrongFilesInLastUpdate(Replica replica);

Fixed version (ground truth):
/** 
 * Return the count of corrupt files for replica.
 * @param replica The replica to get the count for.
 * @return The number of wrong files for a replica.
 */
long getNumberOfWrongFilesInLastUpdate(Replica replica);
Program: 89833
Project: 89833
Buggy source:
/** 
 * Get the date for the last file list job.
 * @param replica The replica to get the date for.
 */
Date getDateOfLastWrongFilesUpdate(Replica replica);

Fixed version (ground truth):
/** 
 * Get the date for the last file list job.
 * @param replica The replica to get the date for.
 * @return The date of the last wrong file update for the replica.
 */
Date getDateOfLastWrongFilesUpdate(Replica replica);
Program: 89834
Project: 89834
Buggy source:
/** 
 * Return the count of missing files for replica.
 * @param replica The replica to get the count for.
 */
long getNumberOfMissingFilesInLastUpdate(Replica replica);

Fixed version (ground truth):
/** 
 * Return the count of missing files for replica.
 * @param replica The replica to get the count for.
 * @return The count of missing files for a replica.
 */
long getNumberOfMissingFilesInLastUpdate(Replica replica);
Program: 89835
Project: 89835
Buggy source:
/** 
 * Return files with upload_status = COMPLETE for the replica, but the filelist_status = MISSING. This is done by querying the database for files with no or different update date from the last known update date for bitarchive, but which are present from admin data.
 * @param replica The replica to check for.
 */
Iterable<String> getMissingFilesInLastUpdate(Replica replica);

Fixed version (ground truth):
/** 
 * Return files with upload_status = COMPLETE for the replica, but the filelist_status = MISSING. This is done by querying the database for files with no or different  update date from the last known update date for bitarchive, but which  are present from admin data.
 * @param replica The replica to check for.
 * @return The list of missing files for a specific replica.
 */
Iterable<String> getMissingFilesInLastUpdate(Replica replica);
Program: 89836
Project: 89836
Buggy source:
/** 
 * Get the date for the last file list job.
 * @param replica The replica to get the date for.
 */
Date getDateOfLastMissingFilesUpdate(Replica replica);

Fixed version (ground truth):
/** 
 * Get the date for the last file list job.
 * @param replica The replica to get the date for.
 * @return The date of the last missing files update for the replica.
 */
Date getDateOfLastMissingFilesUpdate(Replica replica);
Program: 89837
Project: 89837
Buggy source:
/** 
 * Method for testing whether a ChecksumEntry is identical to another ChecksumEntry. 
 * @param o The object to evaluate whether it is identical to this ChecksumEntry.
 * @return Whether the argument has the same values as this ChecksumEntry.It returns false if the argument is not of type ChecksumEntry, or if it has either different filename or different checksum.
 */
public boolean equals(Object o){
  ChecksumEntry ce;
  try {
    ce=(ChecksumEntry)o;
  }
 catch (  Throwable e) {
    return false;
  }
  if (!ce.getFilename().equals(filename)) {
    return false;
  }
  if (!ce.getChecksum().equals(checksum)) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Method for testing whether a ChecksumEntry is identical to another ChecksumEntry. 
 * @param o The object to evaluate whether it is identical to this ChecksumEntry.
 * @return Whether the argument has the same values as this ChecksumEntry.It returns false if the argument is not of type ChecksumEntry, or if it has either different filename or different checksum.
 */
public boolean equals(Object obj){
  if (this == obj)   return true;
  if (obj == null)   return false;
  if (getClass() != obj.getClass())   return false;
  ChecksumEntry other=(ChecksumEntry)obj;
  if (checksum == null) {
    if (other.checksum != null)     return false;
  }
 else   if (!checksum.equals(other.checksum))   return false;
  if (filename == null) {
    if (other.filename != null)     return false;
  }
 else   if (!filename.equals(other.filename))   return false;
  return true;
}
Program: 89838
Project: 89838
Buggy source:
/** 
 * Invoke default method for serializing object.
 * @param s the OutputStream
 */
private void writeObject(ObjectOutputStream s){
  try {
    s.defaultWriteObject();
  }
 catch (  Exception e) {
    throw new IOFailure("String_Node_Str",e);
  }
}

Fixed version (ground truth):
/** 
 * Invoke default method for serializing object.
 * @param s the OutputStream
 * @throws IOFailure If an exception is caught during writing of the object.
 */
private void writeObject(ObjectOutputStream s) throws IOFailure {
  try {
    s.defaultWriteObject();
  }
 catch (  Exception e) {
    throw new IOFailure("String_Node_Str",e);
  }
}
Program: 89839
Project: 89839
Buggy source:
public ChecksumJob(){
  batchJobTimeout=15 * Constants.ONE_MIN_IN_MILLIES;
}

Fixed version (ground truth):
/** 
 * The constructor.
 */
public ChecksumJob(){
  batchJobTimeout=CHECKSUM_JOB_TIME;
}
Program: 89840
Project: 89840
Buggy source:
/** 
 * Finishing the job requires nothing particular.
 * @see FileBatchJob#finish(OutputStream)
 */
public void finish(OutputStream os){
}

Fixed version (ground truth):
/** 
 * Finishing the job requires nothing particular.
 * @param os The output stream where the output data is written.
 * @see FileBatchJob#finish(OutputStream)
 */
public void finish(OutputStream os){
}
Program: 89841
Project: 89841
Buggy source:
/** 
 * Initialization of a ChecksumJob: a new structure for storing files failed is created.
 * @see FileBatchJob#initialize(OutputStream)
 */
public void initialize(OutputStream os){
}

Fixed version (ground truth):
/** 
 * Initialization of a ChecksumJob: a new structure for storing files failed is created.
 * @param os The output stream where the output data is written.
 * @see FileBatchJob#initialize(OutputStream)
 */
public void initialize(OutputStream os){
}
Program: 89842
Project: 89842
Buggy source:
/** 
 * Parse a line of output into a key-value pair.
 * @param line The line to parse, of the form<filename>##<checksum>
 * @return The filename->checksum mapping.
 * @throws ArgumentNotValid if the line is not on the correct form.
 */
public static KeyValuePair<String,String> parseLine(String line){
  ArgumentNotValid.checkNotNull(line,"String_Node_Str");
  String[] parts=line.split(Constants.STRING_FILENAME_SEPARATOR);
  if (parts.length != 2) {
    throw new ArgumentNotValid("String_Node_Str" + line + "String_Node_Str"+ "String_Node_Str");
  }
  return new KeyValuePair<String,String>(parts[0],parts[1]);
}

Fixed version (ground truth):
/** 
 * Parse a line of output into a key-value pair.
 * @param line The line to parse, of the form<b>filename</b>##<b>checksum</b>
 * @return The filename->checksum mapping.
 * @throws ArgumentNotValid if the line is not on the correct form.
 */
public static KeyValuePair<String,String> parseLine(String line) throws ArgumentNotValid {
  ArgumentNotValid.checkNotNull(line,"String_Node_Str");
  String[] parts=line.split(Constants.STRING_FILENAME_SEPARATOR);
  if (parts.length != 2) {
    throw new ArgumentNotValid("String_Node_Str" + line + "String_Node_Str"+ "String_Node_Str");
  }
  return new KeyValuePair<String,String>(parts[0],parts[1]);
}
Program: 89843
Project: 89843
Buggy source:
/** 
 * This should replace the current 'GetAndRemoveFile' followed by 'Upload'.
 * @param msg The message.
 * @throws NotImplementedException Always, since this method has not yet been implemented.
 */
public void correct(RemoteFile arcfile,String checksum){
  throw new NotImplementedException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * This should replace the current 'GetAndRemoveFile' followed by 'Upload'.
 * @param arcfile The arcfile to replace the current bad entry
 * @param checksum The checksum of the bad entry to verify that the entry is still bad
 * @throws NotImplementedException Always, since this method has not yet been implemented.
 */
public void correct(RemoteFile arcfile,String checksum){
  throw new NotImplementedException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
}
Program: 89844
Project: 89844
Buggy source:
/** 
 * Method for removing a bad entry from the archive. This finds the record and removes it if it has the incorrect checksum. The incorrect record is not deleted, but instead put into a backup file for all the incorrect records.
 * @param filename The name of the file whose record should be removed.
 * @param correctFile The correct remote file to replace the bad one in the archive.
 * @param incorrectChecksum The checksum of the bad entry.
 * @throws ArgumentNotValid If one of the arguments are not valid.
 * @throws IOFailure If the entry cannot be corrected.
 * @throws IllegalState If no such entry exists to be corrected, or if the entry has a different checksum than the incorrectChecksum.
 */
public abstract void correct(String filename,File correctFile) throws IOFailure, ArgumentNotValid, IllegalState ;

Fixed version (ground truth):
/** 
 * Method for removing a bad entry from the archive. This finds the record and removes it if it has the incorrect checksum. The incorrect record is not deleted, but instead put into a backup file for all the incorrect records.
 * @param filename The name of the file whose record should be removed.
 * @param correctFile The correct remote file to replace the bad one in the archive.
 * @throws ArgumentNotValid If one of the arguments are not valid.
 * @throws IOFailure If the entry cannot be corrected.
 * @throws IllegalState If no such entry exists to be corrected, or if the entry has a different checksum than the incorrectChecksum.
 */
public abstract void correct(String filename,File correctFile) throws IOFailure, ArgumentNotValid, IllegalState ;
Program: 89846
Project: 89846
Buggy source:
/** 
 * Method for copying the NetarchiveSuite file to output directory. This handles the following three scenarios:  <ol> <li> outputDir == directory of zip file </li>  Do nothing.  <br> <li> outputDir != directory of zip file, but another zip file with same  name exists in the directory </li>  Remove the existing file before copy of the given file. <br> <li> outputDir != directory of zip file and no other zip file </li> Copy file to output directory.
 */
private void copyNetarchiveSuiteFile(){
  try {
    File newNetarchiveSuiteFile=new File(outputDir,netarchiveSuiteFile.getName());
    if (newNetarchiveSuiteFile.getCanonicalPath().equals(netarchiveSuiteFile.getCanonicalPath())) {
      return;
    }
    if (newNetarchiveSuiteFile.exists()) {
      System.out.println(Constants.MSG_WARN_ZIPFILE_ALREADY_EXISTS + newNetarchiveSuiteFile.getCanonicalPath());
      newNetarchiveSuiteFile.delete();
    }
    FileUtils.copyFile(netarchiveSuiteFile,newNetarchiveSuiteFile);
  }
 catch (  IOException e) {
    System.out.println(Constants.MSG_ERROR_ZIP_CANNONICAL_PATH + netarchiveSuiteFile.getAbsolutePath());
    e.printStackTrace();
    System.exit(1);
  }
}

Fixed version (ground truth):
/** 
 * Method for copying the NetarchiveSuite file to output directory. This handles the following three scenarios:  <ol> <li> outputDir == directory of zip file </li>  Do nothing.  <br> <li> outputDir != directory of zip file, but another zip file with same  name exists in the directory </li>  Remove the existing file before copy of the given file. <br> <li> outputDir != directory of zip file and no other zip file </li> Copy file to output directory. </ol>
 */
private void copyNetarchiveSuiteFile(){
  try {
    File newNetarchiveSuiteFile=new File(outputDir,netarchiveSuiteFile.getName());
    if (newNetarchiveSuiteFile.getCanonicalPath().equals(netarchiveSuiteFile.getCanonicalPath())) {
      return;
    }
    if (newNetarchiveSuiteFile.exists()) {
      System.out.println(Constants.MSG_WARN_ZIPFILE_ALREADY_EXISTS + newNetarchiveSuiteFile.getCanonicalPath());
      newNetarchiveSuiteFile.delete();
    }
    FileUtils.copyFile(netarchiveSuiteFile,newNetarchiveSuiteFile);
  }
 catch (  IOException e) {
    System.out.println(Constants.MSG_ERROR_ZIP_CANNONICAL_PATH + netarchiveSuiteFile.getAbsolutePath());
    e.printStackTrace();
    System.exit(1);
  }
}
Program: 89847
Project: 89847
Buggy source:
/** 
 * The constructor.  Starts by initialising the parent abstract class, then sets the  operating system dependent variables.
 * @param subTreeRoot The XML root element.
 * @param parentSettings The Settings to be inherited from the PhysicalLocation, where this machine is placed.
 * @param param The machine parameters to be inherited from the PhysicalLocation.
 * @param netarchiveSuiteSource The name of the NetarchiveSuite package file. Must end with '.zip'.
 * @param logProp The logging property file, to be copied into machine directory.
 * @param securityPolicy The security policy file, to be copied intomachine directory.
 * @param dbFile The name of the database file.
 * @param resetDir Whether the temporary directory should be reset.
 */
public LinuxMachine(Element subTreeRoot,XmlStructure parentSettings,Parameters param,String netarchiveSuiteSource,File logProp,File securityPolicy,File dbFile,boolean resetDir){
  super(subTreeRoot,parentSettings,param,netarchiveSuiteSource,logProp,securityPolicy,dbFile,resetDir);
  OS=Constants.OPERATING_SYSTEM_LINUX_ATTRIBUTE;
  scriptExtension=Constants.SCRIPT_EXTENSION_LINUX;
}

Fixed version (ground truth):
/** 
 * The constructor.  Starts by initialising the parent abstract class, then sets the  operating system dependent variables.
 * @param subTreeRoot The XML root element.
 * @param parentSettings The Settings to be inherited from the PhysicalLocation, where this machine is placed.
 * @param param The machine parameters to be inherited from the PhysicalLocation.
 * @param netarchiveSuiteSource The name of the NetarchiveSuite package file. Must end with '.zip'.
 * @param logProp The logging property file, to be copied into machine directory.
 * @param securityPolicy The security policy file, to be copied intomachine directory.
 * @param dbFile The name of the database file.
 * @param resetDir Whether the temporary directory should be reset.
 */
public LinuxMachine(Element subTreeRoot,XmlStructure parentSettings,Parameters param,String netarchiveSuiteSource,File logProp,File securityPolicy,File dbFile,boolean resetDir){
  super(subTreeRoot,parentSettings,param,netarchiveSuiteSource,logProp,securityPolicy,dbFile,resetDir);
  operatingSystem=Constants.OPERATING_SYSTEM_LINUX_ATTRIBUTE;
  scriptExtension=Constants.SCRIPT_EXTENSION_LINUX;
}
Program: 89849
Project: 89849
Buggy source:
/** 
 * The constructor.  Starts by initialising the parent abstract class, then sets the  operating system dependent variables.
 * @param e The XML root element.
 * @param parentSettings The Settings to be inherited from the PhysicalLocation, where this machine is placed.
 * @param param The machine parameters to be inherited from the PhysicalLocation.
 * @param netarchiveSuiteSource The name of the NetarchiveSuite package file. Must be '.zip'.
 * @param logProp The logging property file, to be copied into machine directory.
 * @param securityPolicy The security policy file, to be copied intomachine directory.
 * @param dbFile The name of the database file.
 * @param resetDir Whether the temporary directory should be reset.
 */
public WindowsMachine(Element e,XmlStructure parentSettings,Parameters param,String netarchiveSuiteSource,File logProp,File securityPolicy,File dbFile,boolean resetDir){
  super(e,parentSettings,param,netarchiveSuiteSource,logProp,securityPolicy,dbFile,resetDir);
  OS=Constants.OPERATING_SYSTEM_WINDOWS_ATTRIBUTE;
  scriptExtension=Constants.SCRIPT_EXTENSION_WINDOWS;
}

Fixed version (ground truth):
/** 
 * The constructor.  Starts by initializing the parent abstract class, then sets the  operating system dependent variables.
 * @param e The XML root element.
 * @param parentSettings The Settings to be inherited from the PhysicalLocation, where this machine is placed.
 * @param param The machine parameters to be inherited from the PhysicalLocation.
 * @param netarchiveSuiteSource The name of the NetarchiveSuite package file. Must be '.zip'.
 * @param logProp The logging property file, to be copied into machine directory.
 * @param securityPolicy The security policy file, to be copied intomachine directory.
 * @param dbFile The name of the database file.
 * @param resetDir Whether the temporary directory should be reset.
 */
public WindowsMachine(Element e,XmlStructure parentSettings,Parameters param,String netarchiveSuiteSource,File logProp,File securityPolicy,File dbFile,boolean resetDir){
  super(e,parentSettings,param,netarchiveSuiteSource,logProp,securityPolicy,dbFile,resetDir);
  operatingSystem=Constants.OPERATING_SYSTEM_WINDOWS_ATTRIBUTE;
  scriptExtension=Constants.SCRIPT_EXTENSION_WINDOWS;
}
Program: 89850
Project: 89850
Buggy source:
/** 
 * Applies the environment name on the name of the file-directories. Thus: fileDir -> fileDir/environmentName
 * @param app The application where this has to be applied.
 */
private void applyEnvironmentNameOnBaseFileDir(Element app){
  ArgumentNotValid.checkNotNull(app,"String_Node_Str");
  List<Element> elems=XmlStructure.getAllChildrenAlongPath(app.element(Constants.COMPLETE_SETTINGS_BRANCH),Constants.SETTINGS_BITARCHIVE_BASEFILEDIR_LEAF);
  for (  Element el : elems) {
    String content=el.getText();
    if (content.contains(Constants.BACKSLASH)) {
      content+=Constants.BACKSLASH + environmentNameVal;
    }
 else {
      content+=Constants.SLASH + environmentNameVal;
    }
    el.setText(content);
  }
}

Fixed version (ground truth):
/** 
 * Applies the environment name on the name of the file-directories. Thus: fileDir -> fileDir/environmentName
 * @param app The application where this has to be applied.
 */
private void applyEnvironmentNameOnBaseFileDir(Element app){
  ArgumentNotValid.checkNotNull(app,"String_Node_Str");
  List<Element> elems=XmlStructure.getAllChildrenAlongPath(app.element(Constants.COMPLETE_SETTINGS_BRANCH),Constants.SETTINGS_BITARCHIVE_BASEFILEDIR_LEAF);
  for (  Element el : elems) {
    StringBuilder content=new StringBuilder(el.getText());
    if (content.indexOf(Constants.BACKSLASH) > -1) {
      content.append(Constants.BACKSLASH + environmentNameVal);
    }
 else {
      content.append(Constants.SLASH + environmentNameVal);
    }
    el.setText(content.toString());
  }
}
Program: 89852
Project: 89852
Buggy source:
/** 
 * Creates a file containing the new configuration instance.
 * @param filename The name of the file to be written.
 * @throws IOException If anything goes wrong.
 */
public void createConfigurationFile(String filename) throws IOException {
  ArgumentNotValid.checkNotNullOrEmpty(filename,"String_Node_Str");
  File f=new File(filename);
  FileWriter fw=new FileWriter(f);
  fw.write(deployConfiguration.getXML());
  fw.close();
}

Fixed version (ground truth):
/** 
 * Creates a file containing the new configuration instance.
 * @param filename The name of the file to be written.
 * @throws IOException If anything goes wrong.
 */
public void createConfigurationFile(String filename) throws IOException {
  ArgumentNotValid.checkNotNullOrEmpty(filename,"String_Node_Str");
  File f=new File(filename);
  FileWriter fw=new FileWriter(f);
  try {
    fw.write(deployConfiguration.getXML());
  }
  finally {
    if (fw != null) {
      fw.close();
    }
  }
}
Program: 89853
Project: 89853
Buggy source:
/** 
 * The constructor.
 * @param configSource The source configuration file.
 */
public CreateTestInstance(File configSource){
  ArgumentNotValid.checkNotNull(configSource,"String_Node_Str");
  source=configSource;
  deployConfiguration=new XmlStructure(source);
}

Fixed version (ground truth):
/** 
 * The constructor.
 * @param configSource The source configuration file.
 */
public CreateTestInstance(File configSource){
  ArgumentNotValid.checkNotNull(configSource,"String_Node_Str");
  source=configSource;
  deployConfiguration=new XmlStructure(source);
  offsetPaths=new OffsetSystem[0];
  offsetVal=new String();
}
Program: 89856
Project: 89856
Buggy source:
/** 
 * Function for creating the directories along the path until the end directory. Does not create the end directory.
 * @param dir The path to the directory.
 * @return The script for creating the directory.
 */
protected String createPathToDir(String dir){
  StringBuilder res=new StringBuilder();
  String[] pathDirs=dir.split(Constants.REGEX_SLASH_CHARACTER);
  String path="String_Node_Str";
  for (int i=0; i < pathDirs.length - 1; i++) {
    if (!pathDirs[i].isEmpty()) {
      path+=pathDirs[i];
      res.append(scriptCreateDir(path,false));
    }
    path+=Constants.SLASH;
  }
  return res.toString();
}

Fixed version (ground truth):
/** 
 * Function for creating the directories along the path until the end directory. Does not create the end directory.
 * @param dir The path to the directory.
 * @return The script for creating the directory.
 */
protected String createPathToDir(String dir){
  StringBuilder res=new StringBuilder();
  String[] pathDirs=dir.split(Constants.REGEX_SLASH_CHARACTER);
  StringBuilder path=new StringBuilder();
  for (int i=0; i < pathDirs.length - 1; i++) {
    if (!pathDirs[i].isEmpty()) {
      path.append(pathDirs[i]);
      res.append(scriptCreateDir(path.toString(),false));
    }
    path.append(Constants.SLASH);
  }
  return res.toString();
}
Program: 89857
Project: 89857
Buggy source:
/** 
 * Creates a the log property file for every application. This is done by taking the inherited log file and changing  "APPID" in the file into the identification of the application.
 * @param directory The local directory for this machine
 */
protected void createLogPropertyFiles(File directory){
  ArgumentNotValid.checkNotNull(directory,"String_Node_Str");
  for (  Application app : applications) {
    try {
      File logProp=new File(directory,Constants.LOG_PROP_APPLICATION_PREFIX + app.getIdentification() + Constants.LOG_PROP_APPLICATION_SUFFIX);
      FileWriter logfw=new FileWriter(logProp);
      String prop=FileUtils.readFile(inheritedLogPropFile);
      prop=prop.replace(Constants.LOG_PROPERTY_APPLICATION_ID_TAG,app.getIdentification());
      logfw.write(prop);
      logfw.close();
    }
 catch (    IOException e) {
      log.warn("String_Node_Str" + e);
    }
  }
}

Fixed version (ground truth):
/** 
 * Creates a the log property file for every application. This is done by taking the inherited log file and changing  "APPID" in the file into the identification of the application.
 * @param directory The local directory for this machine
 */
protected void createLogPropertyFiles(File directory){
  ArgumentNotValid.checkNotNull(directory,"String_Node_Str");
  for (  Application app : applications) {
    try {
      File logProp=new File(directory,Constants.LOG_PROP_APPLICATION_PREFIX + app.getIdentification() + Constants.LOG_PROP_APPLICATION_SUFFIX);
      FileWriter logfw=new FileWriter(logProp);
      String prop=FileUtils.readFile(inheritedLogPropFile);
      prop=prop.replace(Constants.LOG_PROPERTY_APPLICATION_ID_TAG,app.getIdentification());
      try {
        logfw.write(prop);
      }
  finally {
        if (logfw != null) {
          logfw.close();
        }
      }
    }
 catch (    IOException e) {
      log.warn("String_Node_Str" + e);
    }
  }
}
Program: 89860
Project: 89860
Buggy source:
/** 
 * Method for updating the filelist of a replicafileinfo instance. Updates the following fields for the entry in the replicafileinfo: <br/> filelist_status = OK. <br/> filelist_checkdatetime = current time. 
 * @param replicafileinfoId The id of the replicafileinfo.
 */
private void updateReplicaFileInfoFilelist(long replicafileinfoId){
  try {
    String sql="String_Node_Str" + "String_Node_Str";
    PreparedStatement statement=null;
    dbConnection.setAutoCommit(false);
    Date now=new Date(Calendar.getInstance().getTimeInMillis());
    statement=DBUtils.prepareStatement(dbConnection,sql,FileListStatus.OK.ordinal(),now,replicafileinfoId);
    statement.executeUpdate();
    dbConnection.commit();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    log.warn(msg);
    throw new IOFailure(msg,e);
  }
}

Fixed version (ground truth):
/** 
 * Method for updating the filelist of a replicafileinfo instance. Updates the following fields for the entry in the replicafileinfo: <br/> filelist_status = OK. <br/> filelist_checkdatetime = current time. 
 * @param replicafileinfoId The id of the replicafileinfo.
 */
private void updateReplicaFileInfoFilelist(long replicafileinfoId){
  try {
    String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
    PreparedStatement statement=null;
    dbConnection.setAutoCommit(false);
    Date now=new Date(Calendar.getInstance().getTimeInMillis());
    statement=DBUtils.prepareStatement(dbConnection,sql,FileListStatus.OK.ordinal(),now,replicafileinfoId);
    statement.executeUpdate();
    dbConnection.commit();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    log.warn(msg);
    throw new IOFailure(msg,e);
  }
}
Program: 89861
Project: 89861
Buggy source:
/** 
 * Method for updating the filelist of a replicafileinfo instance. Updates the following fields for the entry in the replicafileinfo: <br/> filelist_status = missing. <br/> filelist_checkdatetime = current time.  The replicafileinfo is in the filelist.
 * @param replicafileinfoId The id of the replicafileinfo.
 */
private void updateReplicaFileInfoMissingFromFilelist(long replicafileinfoId){
  try {
    String sql="String_Node_Str" + "String_Node_Str";
    PreparedStatement statement=null;
    dbConnection.setAutoCommit(false);
    Date now=new Date(Calendar.getInstance().getTimeInMillis());
    statement=DBUtils.prepareStatement(dbConnection,sql,FileListStatus.MISSING.ordinal(),now,replicafileinfoId);
    statement.executeUpdate();
    dbConnection.commit();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    log.warn(msg);
    throw new IOFailure(msg,e);
  }
}

Fixed version (ground truth):
/** 
 * Method for updating the filelist of a replicafileinfo instance. Updates the following fields for the entry in the replicafileinfo: <br/> filelist_status = missing. <br/> filelist_checkdatetime = current time.  The replicafileinfo is in the filelist.
 * @param replicafileinfoId The id of the replicafileinfo.
 */
private void updateReplicaFileInfoMissingFromFilelist(long replicafileinfoId){
  try {
    String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
    PreparedStatement statement=null;
    dbConnection.setAutoCommit(false);
    Date now=new Date(Calendar.getInstance().getTimeInMillis());
    statement=DBUtils.prepareStatement(dbConnection,sql,FileListStatus.MISSING.ordinal(),now,replicafileinfoId);
    statement.executeUpdate();
    dbConnection.commit();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    log.warn(msg);
    throw new IOFailure(msg,e);
  }
}
Program: 89862
Project: 89862
Buggy source:
/** 
 * Method for finding a replica with a valid version of a file. This method is used in order to find a replica from which a file should be retrieved, during the process of restoring a corrupt file on another replica. This replica must of the type bitarchive, since a file cannot be  retrieved from a checksum replica.
 * @param filename The name of the file which needs to have a valid versionin a bitarchive.
 * @return A bitarchive which contains a valid version of the file, or nullif no such bitarchive exists.
 */
@Override public Replica getBitarchiveWithGoodFile(String filename,Replica badReplica){
  long fileId=retrieveIdForFile(filename);
  List<String> replicaIds=retrieveReplicaIdsWithOKChecksumStatus(fileId);
  replicaIds.remove(badReplica.getId());
  for (  String repId : replicaIds) {
    ReplicaType repType=ReplicaType.fromOrdinal(retrieveReplicaType(repId));
    if (repType.equals(ReplicaType.BITARCHIVE)) {
      log.trace("String_Node_Str" + repId + "String_Node_Str"+ "String_Node_Str"+ filename+ "String_Node_Str");
      return Replica.getReplicaFromId(repId);
    }
  }
  log.warn("String_Node_Str" + filename + "String_Node_Str");
  return null;
}

Fixed version (ground truth):
/** 
 * Method for finding a replica with a valid version of a file. This method is used in order to find a replica from which a file should be retrieved, during the process of restoring a corrupt file on another replica. This replica must of the type bitarchive, since a file cannot be  retrieved from a checksum replica.
 * @param filename The name of the file which needs to have a valid versionin a bitarchive.
 * @param badReplica The Replica which has a bad copy of the given file
 * @return A bitarchive which contains a valid version of the file, or nullif no such bitarchive exists.
 */
@Override public Replica getBitarchiveWithGoodFile(String filename,Replica badReplica){
  long fileId=retrieveIdForFile(filename);
  List<String> replicaIds=retrieveReplicaIdsWithOKChecksumStatus(fileId);
  replicaIds.remove(badReplica.getId());
  for (  String repId : replicaIds) {
    ReplicaType repType=ReplicaType.fromOrdinal(retrieveReplicaType(repId));
    if (repType.equals(ReplicaType.BITARCHIVE)) {
      log.trace("String_Node_Str" + repId + "String_Node_Str"+ "String_Node_Str"+ filename+ "String_Node_Str");
      return Replica.getReplicaFromId(repId);
    }
  }
  log.warn("String_Node_Str" + filename + "String_Node_Str");
  return null;
}
Program: 89863
Project: 89863
Buggy source:
/** 
 * Method for updating the checksum status of a replicafileinfo instance. Updates the following fields for the entry in the replicafileinfo: <br/> checksum_status = OK. <br/> checksum_checkdatetime = current time.  The replicafileinfo is in the filelist.
 * @param replicafileinfoId The id of the replicafileinfo.
 */
private void updateReplicaFileInfoChecksumOk(long replicafileinfoId){
  try {
    String sql="String_Node_Str" + "String_Node_Str";
    PreparedStatement statement=null;
    dbConnection.setAutoCommit(false);
    Date now=new Date(Calendar.getInstance().getTimeInMillis());
    statement=DBUtils.prepareStatement(dbConnection,sql,ChecksumStatus.OK.ordinal(),now,replicafileinfoId);
    statement.executeUpdate();
    dbConnection.commit();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    log.warn(msg);
    throw new IOFailure(msg,e);
  }
}

Fixed version (ground truth):
/** 
 * Method for updating the checksum status of a replicafileinfo instance. Updates the following fields for the entry in the replicafileinfo: <br/> checksum_status = OK. <br/> checksum_checkdatetime = current time.  The replicafileinfo is in the filelist.
 * @param replicafileinfoId The id of the replicafileinfo.
 */
private void updateReplicaFileInfoChecksumOk(long replicafileinfoId){
  try {
    String sql="String_Node_Str" + "String_Node_Str" + "String_Node_Str";
    PreparedStatement statement=null;
    dbConnection.setAutoCommit(false);
    Date now=new Date(Calendar.getInstance().getTimeInMillis());
    statement=DBUtils.prepareStatement(dbConnection,sql,ChecksumStatus.OK.ordinal(),now,replicafileinfoId);
    statement.executeUpdate();
    dbConnection.commit();
  }
 catch (  Exception e) {
    String msg="String_Node_Str";
    log.warn(msg);
    throw new IOFailure(msg,e);
  }
}