nus-yam/ex-repair huggingface dataset:
Program: 64273
Project: 64273
Buggy source:
/** 
 * Test removeLeadingPath.
 */
public void testRemoveLeadingPath(){
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals(fu.normalize("String_Node_Str").getAbsolutePath(),fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
}

Fixed version (ground truth):
/** 
 * Test removeLeadingPath.
 */
public void testRemoveLeadingPath(){
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals("String_Node_Str",fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals(fu.normalize("String_Node_Str").getAbsolutePath(),fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
  assertEquals(fu.normalize("String_Node_Str").getAbsolutePath(),fu.removeLeadingPath(new File("String_Node_Str"),new File("String_Node_Str")));
}
Program: 64274
Project: 64274
Buggy source:
/** 
 * Set the generated manifest file.  For each EJB that is processed an entry is created in this file. This can then be used to create a jar file for dploying the beans.
 * @param manfestFilename the name of the manifest file to be generated.
 */
public void setManifest(String manifestFilename){
  generatedManifestFile=new File(manifestFilename);
}

Fixed version (ground truth):
/** 
 * Set the generated manifest file. For each EJB that is processed an entry is created in this file. This can then be used to create a jar file for dploying the beans.
 * @param manifestFilename the name of the manifest file to be generated.
 */
public void setManifest(String manifestFilename){
  generatedManifestFile=new File(manifestFilename);
}
Program: 64278
Project: 64278
Buggy source:
/** 
 * Returns a copy of the properties table.
 * @return a hashtable containing all properties(including user properties).
 */
public Hashtable getProperties(){
  Hashtable propsCopy=new Hashtable();
  Map contextProps=m_context.getProperties();
  Iterator propNames=contextProps.keySet().iterator();
  while (propNames.hasNext()) {
    String name=(String)propNames.next();
    String value=getProperty(name);
    if (value != null) {
      propsCopy.put(name,value);
    }
  }
  return propsCopy;
}

Fixed version (ground truth):
/** 
 * Returns a copy of the properties table.
 * @return a hashtable containing all properties(including user properties).
 */
public Hashtable getProperties(){
  final Hashtable propsCopy=new Hashtable();
  final Map contextProps;
  try {
    contextProps=m_context.getProperties();
  }
 catch (  final TaskException e) {
    throw new BuildException(e);
  }
  final Iterator propNames=contextProps.keySet().iterator();
  while (propNames.hasNext()) {
    final String name=(String)propNames.next();
    final String value=getProperty(name);
    if (value != null) {
      propsCopy.put(name,value);
    }
  }
  return propsCopy;
}
Program: 64279
Project: 64279
Buggy source:
/** 
 * Returns the file location where the error occurred.
 * @return the file location where the error occurred.
 */
public Location getLocation(){
  return location;
}

Fixed version (ground truth):
/** 
 * Returns the file location where the error occurred.
 * @return the file location where the error occurred.
 */
public Location getLocation(){
  return m_location;
}
Program: 64280
Project: 64280
Buggy source:
/** 
 * Returns the nested exception, if any.
 * @return the nested exception, or <code>null</code> if noexception is associated with this one
 */
public Throwable getException(){
  return cause;
}

Fixed version (ground truth):
/** 
 * Returns the nested exception, if any.
 * @return the nested exception, or <code>null</code> if noexception is associated with this one
 */
public Throwable getException(){
  return m_cause;
}
Program: 64281
Project: 64281
Buggy source:
/** 
 * Prints the stack trace of this exception and any nested exception to the specified PrintWriter.
 * @param pw The PrintWriter to print the stack trace to.Must not be <code>null</code>.
 */
public void printStackTrace(PrintWriter pw){
synchronized (pw) {
    super.printStackTrace(pw);
    if (cause != null) {
      pw.println("String_Node_Str");
      cause.printStackTrace(pw);
    }
  }
}

Fixed version (ground truth):
/** 
 * Prints the stack trace of this exception and any nested exception to the specified PrintWriter.
 * @param pw The PrintWriter to print the stack trace to.Must not be <code>null</code>.
 */
public void printStackTrace(PrintWriter pw){
synchronized (pw) {
    super.printStackTrace(pw);
    if (m_cause != null) {
      pw.println("String_Node_Str");
      m_cause.printStackTrace(pw);
    }
  }
}
Program: 64282
Project: 64282
Buggy source:
/** 
 * Sets the file location where the error occurred.
 * @param location The file location where the error occurred.Must not be <code>null</code>.
 */
public void setLocation(Location location){
  this.location=location;
}

Fixed version (ground truth):
/** 
 * Sets the file location where the error occurred.
 * @param location The file location where the error occurred.Must not be <code>null</code>.
 */
public void setLocation(final Location location){
  m_location=location;
}
Program: 64283
Project: 64283
Buggy source:
/** 
 * Returns the location of the error and the error message.
 * @return the location of the error and the error message
 */
public String toString(){
  return location.toString() + getMessage();
}

Fixed version (ground truth):
/** 
 * Returns the location of the error and the error message.
 * @return the location of the error and the error message
 */
public String toString(){
  return m_location.toString() + getMessage();
}
Program: 64284
Project: 64284
Buggy source:
/** 
 * Constructs an exception with the given exception as a root cause and a location in a file.
 * @param cause The exception that might have caused this one.Should not be <code>null</code>.
 * @param location The location in the project file where the error occurred. Must not be <code>null</code>.
 */
public BuildException(Throwable cause,Location location){
  this(cause);
  this.location=location;
}

Fixed version (ground truth):
/** 
 * Constructs an exception with the given exception as a root cause and a location in a file.
 * @param cause The exception that might have caused this one.Should not be <code>null</code>.
 * @param location The location in the project file where the error occurred. Must not be <code>null</code>.
 */
public BuildException(final Throwable cause,final Location location){
  this(cause);
  m_location=location;
}
Program: 64285
Project: 64285
Buggy source:
/** 
 * Myrmidon-friendly cascading exception method.
 * @return the cascading cause of this exception.
 */
public Throwable getCause(){
  return cause;
}

Fixed version (ground truth):
/** 
 * Myrmidon-friendly cascading exception method.
 * @return the cascading cause of this exception.
 */
public Throwable getCause(){
  return m_cause;
}
Program: 64286
Project: 64286
Buggy source:
/** 
 * Process a line while in "GET_PREVIOUS_REVISION" state.
 * @param line the line
 */
private void processGetPreviousRevision(final String line){
  if (!line.startsWith("String_Node_Str")) {
    final String message=REZ.getString("String_Node_Str",line);
    throw new IllegalStateException(message);
  }
  m_previousRevision=line.substring(9);
  saveEntry();
  m_revision=m_previousRevision;
  m_status=GET_COMMENT;
}

Fixed version (ground truth):
/** 
 * Process a line while in "GET_PREVIOUS_REVISION" state.
 * @param line the line
 */
private void processGetPreviousRevision(final String line){
  if (!line.startsWith("String_Node_Str")) {
    final String message=REZ.getString("String_Node_Str",line);
    throw new IllegalStateException(message);
  }
  m_previousRevision=line.substring(9);
  saveEntry();
  m_revision=m_previousRevision;
  m_status=GET_DATE;
}
Program: 64287
Project: 64287
Buggy source:
/** 
 * Process a line while in "GET_COMMENT" state.
 * @param line the line
 */
private void processComment(final String line){
  final String lineSeparator=System.getProperty("String_Node_Str");
  if (line.startsWith("String_Node_Str")) {
    final int end=m_comment.length() - lineSeparator.length();
    m_comment=m_comment.substring(0,end);
    m_comment="String_Node_Str" + m_comment + "String_Node_Str";
    saveEntry();
    m_status=GET_FILE;
  }
 else   if (line.startsWith("String_Node_Str")) {
    final int end=m_comment.length() - lineSeparator.length();
    m_comment=m_comment.substring(0,end);
    m_comment="String_Node_Str" + m_comment + "String_Node_Str";
    m_status=GET_PREVIOUS_REV;
  }
 else {
    m_comment+=line + lineSeparator;
  }
}

Fixed version (ground truth):
/** 
 * Process a line while in "GET_COMMENT" state.
 * @param line the line
 */
private void processComment(final String line){
  final String lineSeparator=System.getProperty("String_Node_Str");
  if (line.startsWith("String_Node_Str")) {
    final int end=m_comment.length() - lineSeparator.length();
    m_comment=m_comment.substring(0,end);
    saveEntry();
    m_status=GET_FILE;
  }
 else   if (line.startsWith("String_Node_Str")) {
    final int end=m_comment.length() - lineSeparator.length();
    m_comment=m_comment.substring(0,end);
    m_status=GET_PREVIOUS_REV;
  }
 else {
    m_comment+=line + lineSeparator;
  }
}
Program: 64288
Project: 64288
Buggy source:
/** 
 * Process a line while in "DATE" state.
 * @param line the line
 */
private void processDate(final String line){
  if (line.startsWith("String_Node_Str")) {
    m_date=line.substring(6,16);
    String lineData=line.substring(line.indexOf("String_Node_Str") + 1);
    m_author=lineData.substring(10,lineData.indexOf("String_Node_Str"));
    if (m_userList.containsKey(m_author)) {
      m_author="String_Node_Str" + m_userList.getProperty(m_author) + "String_Node_Str";
    }
    m_status=GET_COMMENT;
    m_comment="String_Node_Str";
  }
}

Fixed version (ground truth):
/** 
 * Process a line while in "DATE" state.
 * @param line the line
 */
private void processDate(final String line){
  if (line.startsWith("String_Node_Str")) {
    m_date=line.substring(6,16);
    String lineData=line.substring(line.indexOf("String_Node_Str") + 1);
    m_author=lineData.substring(10,lineData.indexOf("String_Node_Str"));
    if (m_userList.containsKey(m_author)) {
      m_author=m_userList.getProperty(m_author);
    }
    m_status=GET_COMMENT;
    m_comment="String_Node_Str";
  }
}
Program: 64289
Project: 64289
Buggy source:
/** 
 * Process a line while in "GET_PREVIOUS_REVISION" state.
 * @param line the line
 */
private void processGetPreviousRevision(final String line){
  if (!line.startsWith("String_Node_Str")) {
    throw new IllegalStateException("String_Node_Str" + line);
  }
  m_previousRevision=line.substring(9);
  saveEntry();
  m_revision=m_previousRevision;
  m_status=GET_COMMENT;
}

Fixed version (ground truth):
/** 
 * Process a line while in "GET_PREVIOUS_REVISION" state.
 * @param line the line
 */
private void processGetPreviousRevision(final String line){
  if (!line.startsWith("String_Node_Str")) {
    throw new IllegalStateException("String_Node_Str" + line);
  }
  m_previousRevision=line.substring(9);
  saveEntry();
  m_revision=m_previousRevision;
  m_status=GET_DATE;
}
Program: 64290
Project: 64290
Buggy source:
/** 
 * Process a line while in "GET_PREVIOUS_REVISION" state.
 * @param line the line
 */
private void processGetPreviousRevision(final String line){
  final String entryKey=m_date + m_author + m_comment;
  if (line.startsWith("String_Node_Str")) {
    m_previousRevision=line.substring(9);
    m_status=GET_FILE;
    CVSEntry entry;
    if (!m_entries.containsKey(entryKey)) {
      entry=new CVSEntry(parseDate(m_date),m_author,m_comment);
      m_entries.put(entryKey,entry);
    }
 else {
      entry=(CVSEntry)m_entries.get(entryKey);
    }
    entry.addFile(m_file,m_revision,m_previousRevision);
  }
 else   if (line.startsWith("String_Node_Str")) {
    m_status=GET_FILE;
    CVSEntry entry;
    if (!m_entries.containsKey(entryKey)) {
      entry=new CVSEntry(parseDate(m_date),m_author,m_comment);
      m_entries.put(entryKey,entry);
    }
 else {
      entry=(CVSEntry)m_entries.get(entryKey);
    }
    entry.addFile(m_file,m_revision);
  }
}

Fixed version (ground truth):
/** 
 * Process a line while in "GET_PREVIOUS_REVISION" state.
 * @param line the line
 */
private void processGetPreviousRevision(final String line){
  if (!line.startsWith("String_Node_Str")) {
    throw new IllegalStateException("String_Node_Str" + line);
  }
  m_previousRevision=line.substring(9);
  saveEntry();
  m_revision=m_previousRevision;
  m_status=GET_COMMENT;
}
Program: 64291
Project: 64291
Buggy source:
/** 
 * Receive notification about the process writing to standard output.
 */
public void stdout(final String line){
switch (m_status) {
case GET_FILE:
    processFile(line);
  break;
case GET_REVISION:
processRevision(line);
case GET_DATE:
processDate(line);
break;
case GET_COMMENT:
processComment(line);
break;
case GET_PREVIOUS_REV:
processGetPreviousRevision(line);
break;
}
}

Fixed version (ground truth):
/** 
 * Receive notification about the process writing to standard output.
 */
public void stdout(final String line){
switch (m_status) {
case GET_FILE:
    processFile(line);
  break;
case GET_REVISION:
processRevision(line);
break;
case GET_DATE:
processDate(line);
break;
case GET_COMMENT:
processComment(line);
break;
case GET_PREVIOUS_REV:
processGetPreviousRevision(line);
break;
}
}
Program: 64292
Project: 64292
Buggy source:
/** 
 * Process a line while in "GET_COMMENT" state.
 * @param line the line
 */
private void processComment(final String line){
  final String lineSeparator=System.getProperty("String_Node_Str");
  if (line.startsWith("String_Node_Str") || line.startsWith("String_Node_Str")) {
    final int end=m_comment.length() - lineSeparator.length();
    m_comment=m_comment.substring(0,end);
    m_comment="String_Node_Str" + m_comment + "String_Node_Str";
    m_status=GET_PREVIOUS_REV;
  }
 else {
    m_comment+=line + lineSeparator;
  }
}

Fixed version (ground truth):
/** 
 * Process a line while in "GET_COMMENT" state.
 * @param line the line
 */
private void processComment(final String line){
  final String lineSeparator=System.getProperty("String_Node_Str");
  if (line.startsWith("String_Node_Str")) {
    final int end=m_comment.length() - lineSeparator.length();
    m_comment=m_comment.substring(0,end);
    m_comment="String_Node_Str" + m_comment + "String_Node_Str";
    saveEntry();
    m_status=GET_FILE;
  }
 else   if (line.startsWith("String_Node_Str")) {
    final int end=m_comment.length() - lineSeparator.length();
    m_comment=m_comment.substring(0,end);
    m_comment="String_Node_Str" + m_comment + "String_Node_Str";
    m_status=GET_PREVIOUS_REV;
  }
 else {
    m_comment+=line + lineSeparator;
  }
}
Program: 64293
Project: 64293
Buggy source:
/** 
 * test for compilation needed. true means yes, false means our tests do not indicate this, but as the TLDs are not used for dependency checking this is not guaranteed. The current tests are <ol> <li>no dest file <li>dest file out of date w.r.t source <li>dest file zero bytes long </ol>
 * @param srcFile JSP source file
 * @param javaFile JSP dest file
 * @return true if a compile is definately needed.
 */
private boolean isCompileNeeded(File srcFile,File javaFile){
  boolean shouldCompile=false;
  if (!javaFile.exists()) {
    shouldCompile=true;
    log("String_Node_Str" + srcFile.getPath() + "String_Node_Str"+ javaFile.getPath()+ "String_Node_Str",Project.MSG_VERBOSE);
  }
 else {
    if (srcFile.lastModified() > javaFile.lastModified()) {
      shouldCompile=true;
      log("String_Node_Str" + srcFile.getPath() + "String_Node_Str"+ javaFile.getPath(),Project.MSG_VERBOSE);
    }
 else {
      if (javaFile.length() == 0) {
        shouldCompile=true;
        log("String_Node_Str" + srcFile.getPath() + "String_Node_Str"+ javaFile.getPath()+ "String_Node_Str",Project.MSG_VERBOSE);
      }
    }
  }
  return shouldCompile;
}

Fixed version (ground truth):
/** 
 * Test whether or not compilation is needed. A return value of  <code>true<code> means yes, <code>false</code> means our tests do not indicate this, but as the TLDs are not used for dependency checking this is not guaranteed. The current tests are <ol> <li>no dest file <li>dest file out of date w.r.t source <li>dest file zero bytes long </ol>
 * @param srcFile JSP source file
 * @param javaFile JSP dest file
 * @return true if a compile is definately needed.
 */
private boolean isCompileNeeded(File srcFile,File javaFile){
  boolean shouldCompile=false;
  if (!javaFile.exists()) {
    shouldCompile=true;
    log("String_Node_Str" + srcFile.getPath() + "String_Node_Str"+ javaFile.getPath()+ "String_Node_Str",Project.MSG_VERBOSE);
  }
 else {
    if (srcFile.lastModified() > javaFile.lastModified()) {
      shouldCompile=true;
      log("String_Node_Str" + srcFile.getPath() + "String_Node_Str"+ javaFile.getPath(),Project.MSG_VERBOSE);
    }
 else {
      if (javaFile.length() == 0) {
        shouldCompile=true;
        log("String_Node_Str" + srcFile.getPath() + "String_Node_Str"+ javaFile.getPath()+ "String_Node_Str",Project.MSG_VERBOSE);
      }
    }
  }
  return shouldCompile;
}
Program: 64294
Project: 64294
Buggy source:
/** 
 * web apps param. only one is allowed.
 * @param fs  add a web app fileset
 */
public void addWebApp(WebAppParameter webappParam) throws BuildException {
  if (webApp == null) {
    webApp=webappParam;
  }
 else {
    throw new BuildException("String_Node_Str");
  }
}

Fixed version (ground truth):
/** 
 * Web apps parameter. Only one is allowed.
 * @param fs  add a web app fileset
 */
public void addWebApp(WebAppParameter webappParam) throws BuildException {
  if (webApp == null) {
    webApp=webappParam;
  }
 else {
    throw new BuildException("String_Node_Str");
  }
}
Program: 64295
Project: 64295
Buggy source:
/** 
 * set the compiler. optional: default=jasper
 */
public void setCompiler(String compiler){
  this.compilerName=compiler;
}

Fixed version (ground truth):
/** 
 * Sets the compiler to use. Optional: default=jasper
 */
public void setCompiler(String compiler){
  this.compilerName=compiler;
}
Program: 64296
Project: 64296
Buggy source:
/** 
 * Set the comment to apply in SourceSafe <p> If this is null or empty, it will be replaced with "-" which is what SourceSafe uses for an empty comment.
 */
public void setComment(String comment){
  if (comment.equals("String_Node_Str") || comment.equals("String_Node_Str")) {
    m_Comment="String_Node_Str";
  }
 else {
    m_Comment=comment;
  }
}

Fixed version (ground truth):
/** 
 * Sets the comment to apply in SourceSafe. <p> If this is null or empty, it will be replaced with "-" which is what SourceSafe uses for an empty comment.
 */
public void setComment(String comment){
  if (comment.equals("String_Node_Str") || comment.equals("String_Node_Str")) {
    m_Comment="String_Node_Str";
  }
 else {
    m_Comment=comment;
  }
}
Program: 64297
Project: 64297
Buggy source:
/** 
 * Set the comment to apply in SourceSafe <p> If this is null or empty, it will be replaced with "-" which is what SourceSafe uses for an empty comment.
 * @param comment the comment to apply in SourceSafe
 */
public void setComment(String comment){
  if (comment.equals("String_Node_Str") || comment.equals("String_Node_Str")) {
    m_Comment="String_Node_Str";
  }
 else {
    m_Comment=comment;
  }
}

Fixed version (ground truth):
/** 
 * Sets the comment to apply in SourceSafe. <p> If this is null or empty, it will be replaced with "-" which is what SourceSafe uses for an empty comment.
 * @param comment the comment to apply in SourceSafe
 */
public void setComment(String comment){
  if (comment.equals("String_Node_Str") || comment.equals("String_Node_Str")) {
    m_Comment="String_Node_Str";
  }
 else {
    m_Comment=comment;
  }
}
Program: 64298
Project: 64298
Buggy source:
/** 
 * Add a class name in slash format (e.g. org/apache/tools/ant/...)
 * @param classname the class name in slash format
 */
private void addSlashClass(String classname){
  addClass(classname.replace('/','.'));
}

Fixed version (ground truth):
/** 
 * Adds a class name in slash format  (for example org/apache/tools/ant/Main).
 * @param classname the class name in slash format
 */
private void addSlashClass(String classname){
  addClass(classname.replace('/','.'));
}
Program: 64299
Project: 64299
Buggy source:
/** 
 * Create an instance of converter with specified name.
 * @param name the name of converter
 * @return the created converter instance
 * @throws java.lang.Exception if converter can not be created.
 */
protected abstract Converter createConverter(final String name) throws Exception ;

Fixed version (ground truth):
/** 
 * Create an instance of converter with specified name.
 * @param name the name of converter
 * @return the created converter instance
 * @throws Exception if converter can not be created.
 */
protected abstract Converter createConverter(final String name) throws Exception ;
Program: 64302
Project: 64302
Buggy source:
/** 
 * Copies the contents of the current tar archive entry directly into an output stream.
 * @param out The OutputStream into which to write the entry's data.
 * @exception IOException Description of Exception
 */
public void copyEntryContents(final OutputStream output) throws IOException {
  final byte[] buffer=new byte[32 * 1024];
  while (true) {
    final int numRead=read(buffer,0,buffer.length);
    if (numRead == -1) {
      break;
    }
    output.write(buffer,0,numRead);
  }
}

Fixed version (ground truth):
/** 
 * Copies the contents of the current tar archive entry directly into an output stream.
 * @param output The OutputStream into which to write the entry's data.
 * @exception IOException Description of Exception
 */
public void copyEntryContents(final OutputStream output) throws IOException {
  final byte[] buffer=new byte[32 * 1024];
  while (true) {
    final int numRead=read(buffer,0,buffer.length);
    if (numRead == -1) {
      break;
    }
    output.write(buffer,0,numRead);
  }
}
Program: 64303
Project: 64303
Buggy source:
public TarOutputStream(final OutputStream output,final int blockSize,final int recordSize){
  super(output);
  m_buffer=new TarBuffer(output,blockSize,recordSize);
  m_debug=false;
  m_assemLen=0;
  m_assemBuf=new byte[recordSize];
  m_recordBuf=new byte[recordSize];
  m_oneBuf=new byte[1];
}

Fixed version (ground truth):
public TarOutputStream(final OutputStream output,final int blockSize,final int recordSize){
  super(output);
  m_buffer=new TarBuffer(output,blockSize,recordSize);
  m_assemLen=0;
  m_assemBuf=new byte[recordSize];
  m_recordBuf=new byte[recordSize];
  m_oneBuf=new byte[1];
}
Program: 64304
Project: 64304
Buggy source:
/** 
 * Resets the buffer for the current thread.
 */
private void resetBufferInfo(){
  Thread current=Thread.currentThread();
  buffers.remove(current);
}

Fixed version (ground truth):
/** 
 * Resets the buffer for the current thread.
 */
private void resetBufferInfo(){
  Thread current=Thread.currentThread();
  BufferInfo bufferInfo=(BufferInfo)buffers.get(current);
  try {
    bufferInfo.buffer.close();
  }
 catch (  IOException e) {
  }
  bufferInfo.buffer=new ByteArrayOutputStream();
  bufferInfo.skip=false;
}
Program: 64305
Project: 64305
Buggy source:
/** 
 * Equivalent to flushing the stream.
 * @exception IOException if there is a problem closing the stream.
 * @see #flush
 */
public void close() throws IOException {
  flush();
}

Fixed version (ground truth):
/** 
 * Equivalent to flushing the stream.
 * @exception IOException if there is a problem closing the stream.
 * @see #flush
 */
public void close() throws IOException {
  flush();
  removeBuffer();
}
Program: 64306
Project: 64306
Buggy source:
/** 
 * Set the path to zip-file.
 * @param s Path to zip-file.
 */
public void setSrc(final File src){
  m_src=src;
}

Fixed version (ground truth):
/** 
 * Set the path to zip-file.
 * @param src Path to zip-file.
 */
public void setSrc(final File src){
  m_src=src;
}
Program: 64307
Project: 64307
Buggy source:
/** 
 * Should we overwrite files in dest, even if they are newer than the corresponding entries in the archive?
 * @param b The new Overwrite value
 */
public void setOverwrite(final boolean overwrite){
  m_overwrite=overwrite;
}

Fixed version (ground truth):
/** 
 * Should we overwrite files in dest, even if they are newer than the corresponding entries in the archive?
 * @param overwrite The new Overwrite value
 */
public void setOverwrite(final boolean overwrite){
  m_overwrite=overwrite;
}
Program: 64308
Project: 64308
Buggy source:
/** 
 * Set the path to zip-file.
 * @param s Path to zip-file.
 */
public void setSrc(final File src){
  m_src=src;
}

Fixed version (ground truth):
/** 
 * Set the path to zip-file.
 * @param src Path to zip-file.
 */
public void setSrc(final File src){
  m_src=src;
}
Program: 64309
Project: 64309
Buggy source:
/** 
 * Should we overwrite files in dest, even if they are newer than the corresponding entries in the archive?
 * @param b The new Overwrite value
 */
public void setOverwrite(final boolean overwrite){
  m_overwrite=overwrite;
}

Fixed version (ground truth):
/** 
 * Should we overwrite files in dest, even if they are newer than the corresponding entries in the archive?
 * @param overwrite The new Overwrite value
 */
public void setOverwrite(final boolean overwrite){
  m_overwrite=overwrite;
}
Program: 64311
Project: 64311
Buggy source:
/** 
 * Runs a process defined by the command line and returns its exit status.
 * @return the exit status of the subprocess or <code>INVALID</code>
 * @exception java.io.IOExcpetion The exception is thrown, if launchingof the subprocess failed
 */
public int execute() throws IOException {
  CommandLauncher launcher=vmLauncher != null ? vmLauncher : shellLauncher;
  if (!useVMLauncher) {
    launcher=shellLauncher;
  }
  final Process process=launcher.exec(project,getCommandline(),getEnvironment(),workingDirectory);
  try {
    streamHandler.setProcessInputStream(process.getOutputStream());
    streamHandler.setProcessOutputStream(process.getInputStream());
    streamHandler.setProcessErrorStream(process.getErrorStream());
  }
 catch (  IOException e) {
    process.destroy();
    throw e;
  }
  streamHandler.start();
  processDestroyer.add(process);
  if (watchdog != null) {
    watchdog.start(process);
  }
  waitFor(process);
  processDestroyer.remove(process);
  if (watchdog != null) {
    watchdog.stop();
  }
  streamHandler.stop();
  if (watchdog != null) {
    watchdog.checkException();
  }
  return getExitValue();
}

Fixed version (ground truth):
/** 
 * Runs a process defined by the command line and returns its exit status.
 * @return the exit status of the subprocess or <code>INVALID</code>
 * @exception java.io.IOExcpetion The exception is thrown, if launchingof the subprocess failed
 */
public int execute() throws IOException {
  final Process process=launch(project,getCommandline(),getEnvironment(),workingDirectory,useVMLauncher);
  try {
    streamHandler.setProcessInputStream(process.getOutputStream());
    streamHandler.setProcessOutputStream(process.getInputStream());
    streamHandler.setProcessErrorStream(process.getErrorStream());
  }
 catch (  IOException e) {
    process.destroy();
    throw e;
  }
  streamHandler.start();
  processDestroyer.add(process);
  if (watchdog != null) {
    watchdog.start(process);
  }
  waitFor(process);
  processDestroyer.remove(process);
  if (watchdog != null) {
    watchdog.stop();
  }
  streamHandler.stop();
  if (watchdog != null) {
    watchdog.checkException();
  }
  return getExitValue();
}
Program: 64312
Project: 64312
Buggy source:
/** 
 * Copies data from the input stream to the output stream. Terminates as soon as the input stream is closed or an error occurs.
 */
public void run(){
  final byte[] buf=new byte[SIZE];
  int length;
  try {
    while ((length=is.read(buf)) > 0) {
      os.write(buf,0,length);
      try {
        Thread.sleep(SLEEP);
      }
 catch (      InterruptedException e) {
      }
    }
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
/** 
 * Copies data from the input stream to the output stream. Terminates as soon as the input stream is closed or an error occurs.
 */
public void run(){
synchronized (this) {
    finished=false;
  }
  final byte[] buf=new byte[SIZE];
  int length;
  try {
    while ((length=is.read(buf)) > 0) {
      os.write(buf,0,length);
      try {
        Thread.sleep(SLEEP);
      }
 catch (      InterruptedException e) {
      }
    }
  }
 catch (  IOException e) {
  }
 finally {
synchronized (this) {
      finished=true;
      notify();
    }
  }
}
Program: 64314
Project: 64314
Buggy source:
public boolean execute() throws TaskException {
  getLogger().debug("String_Node_Str");
  Commandline cmd=setupRmicCommand();
  try {
    Class c=Class.forName("String_Node_Str");
    Constructor cons=c.getConstructor(new Class[]{OutputStream.class,String.class});
    Object rmic=cons.newInstance(new Object[]{System.out,"String_Node_Str"});
    Method doRmic=c.getMethod("String_Node_Str",new Class[]{String[].class});
    Boolean ok=(Boolean)doRmic.invoke(rmic,(new Object[]{cmd.getArguments()}));
    return ok.booleanValue();
  }
 catch (  ClassNotFoundException ex) {
    throw new TaskException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
catch (  Exception ex) {
    if (ex instanceof TaskException) {
      throw (TaskException)ex;
    }
 else {
      throw new TaskException("String_Node_Str",ex);
    }
  }
 finally {
    try {
      logstr.close();
    }
 catch (    IOException e) {
      throw new TaskException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public boolean execute() throws TaskException {
  getLogger().debug("String_Node_Str");
  Commandline cmd=setupRmicCommand();
  try {
    Class c=Class.forName("String_Node_Str");
    Constructor cons=c.getConstructor(new Class[]{OutputStream.class,String.class});
    Object rmic=cons.newInstance(new Object[]{System.out,"String_Node_Str"});
    Method doRmic=c.getMethod("String_Node_Str",new Class[]{String[].class});
    Boolean ok=(Boolean)doRmic.invoke(rmic,(new Object[]{cmd.getArguments()}));
    return ok.booleanValue();
  }
 catch (  ClassNotFoundException ex) {
    throw new TaskException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
catch (  Exception ex) {
    if (ex instanceof TaskException) {
      throw (TaskException)ex;
    }
 else {
      throw new TaskException("String_Node_Str",ex);
    }
  }
}
Program: 64315
Project: 64315
Buggy source:
public boolean execute() throws TaskException {
  getLogger().debug("String_Node_Str");
  Commandline cmd=setupRmicCommand();
  try {
    Class c=Class.forName("String_Node_Str");
    Constructor cons=c.getConstructor(new Class[]{OutputStream.class,String.class});
    Object rmic=cons.newInstance(new Object[]{System.out,"String_Node_Str"});
    Method doRmic=c.getMethod("String_Node_Str",new Class[]{String[].class});
    Boolean ok=(Boolean)doRmic.invoke(rmic,(new Object[]{cmd.getArguments()}));
    return ok.booleanValue();
  }
 catch (  ClassNotFoundException ex) {
    throw new TaskException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
catch (  Exception ex) {
    if (ex instanceof TaskException) {
      throw (TaskException)ex;
    }
 else {
      throw new TaskException("String_Node_Str",ex);
    }
  }
 finally {
    try {
      logstr.close();
    }
 catch (    IOException e) {
      throw new TaskException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public boolean execute() throws TaskException {
  getLogger().debug("String_Node_Str");
  Commandline cmd=setupRmicCommand();
  try {
    Class c=Class.forName("String_Node_Str");
    Constructor cons=c.getConstructor(new Class[]{OutputStream.class,String.class});
    Object rmic=cons.newInstance(new Object[]{System.out,"String_Node_Str"});
    Method doRmic=c.getMethod("String_Node_Str",new Class[]{String[].class});
    Boolean ok=(Boolean)doRmic.invoke(rmic,(new Object[]{cmd.getArguments()}));
    return ok.booleanValue();
  }
 catch (  ClassNotFoundException ex) {
    throw new TaskException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
catch (  Exception ex) {
    if (ex instanceof TaskException) {
      throw (TaskException)ex;
    }
 else {
      throw new TaskException("String_Node_Str",ex);
    }
  }
}
Program: 64316
Project: 64316
Buggy source:
/** 
 * Method to execute a particular target instance.
 * @param targetName the name of target
 * @param target the target
 * @param context the context in which to execute
 * @exception TaskException if an error occurs
 */
private void executeTarget(final String name,final Target target,final ExecutionFrame frame) throws TaskException {
  final Condition condition=target.getCondition();
  if (null != condition) {
    try {
      final boolean result=condition.evaluate(frame.getContext());
      if (!result) {
        final String message=REZ.getString("String_Node_Str",name);
        getLogger().debug(message);
        return;
      }
    }
 catch (    final TaskException te) {
      final String message=REZ.getString("String_Node_Str",name);
      throw new TaskException(message,te);
    }
  }
  final String message=REZ.getString("String_Node_Str",name);
  getLogger().debug(message);
  final Configuration[] tasks=target.getTasks();
  for (int i=0; i < tasks.length; i++) {
    executeTask(tasks[i],frame);
  }
}

Fixed version (ground truth):
/** 
 * Method to execute a particular target instance.
 * @param name the name of target
 * @param target the target
 * @param frame the frame in which to execute
 * @exception TaskException if an error occurs
 */
private void executeTarget(final String name,final Target target,final ExecutionFrame frame) throws TaskException {
  final Condition condition=target.getCondition();
  if (null != condition) {
    try {
      final boolean result=condition.evaluate(frame.getContext());
      if (!result) {
        final String message=REZ.getString("String_Node_Str",name);
        getLogger().debug(message);
        return;
      }
    }
 catch (    final TaskException te) {
      final String message=REZ.getString("String_Node_Str",name);
      throw new TaskException(message,te);
    }
  }
  final String message=REZ.getString("String_Node_Str",name);
  getLogger().debug(message);
  final Configuration[] tasks=target.getTasks();
  for (int i=0; i < tasks.length; i++) {
    executeTask(tasks[i],frame);
  }
}
Program: 64317
Project: 64317
Buggy source:
/** 
 * Execute a task.
 * @param task the task definition
 * @param context the context
 * @exception TaskException if an error occurs
 */
private void executeTask(final Configuration task,final ExecutionFrame frame) throws TaskException {
  final String name=task.getName();
  final String message=REZ.getString("String_Node_Str",name);
  getLogger().debug(message);
  frame.getContext().setProperty(TaskContext.NAME,name);
  m_listenerSupport.taskStarted(name);
  m_executor.execute(task,frame);
  m_listenerSupport.taskFinished();
}

Fixed version (ground truth):
/** 
 * Execute a task.
 * @param task the task definition
 * @param frame the frame to execute in
 * @exception TaskException if an error occurs
 */
private void executeTask(final Configuration task,final ExecutionFrame frame) throws TaskException {
  final String name=task.getName();
  final String message=REZ.getString("String_Node_Str",name);
  getLogger().debug(message);
  frame.getContext().setProperty(TaskContext.NAME,name);
  m_listenerSupport.taskStarted(name);
  m_executor.execute(task,frame);
  m_listenerSupport.taskFinished();
}
Program: 64318
Project: 64318
Buggy source:
private void deployTypeLib(final Deployer deployer,final Project project) throws TaskException {
  final TypeLib[] typeLibs=project.getTypeLibs();
  for (int i=0; i < typeLibs.length; i++) {
    final TypeLib typeLib=typeLibs[i];
    final File file=findTypeLib(typeLib.getLibrary());
    try {
      final TypeDeployer typeDeployer=deployer.createDeployer(file);
      if (null == typeLib.getRole()) {
        typeDeployer.deployAll();
      }
 else {
        typeDeployer.deployType(typeLib.getRole(),typeLib.getName());
      }
    }
 catch (    final DeploymentException de) {
      final String message=REZ.getString("String_Node_Str",typeLib,file);
      throw new TaskException(message,de);
    }
  }
}

Fixed version (ground truth):
private void deployTypeLib(final Deployer deployer,final Project project) throws TaskException {
  final TypeLib[] typeLibs=project.getTypeLibs();
  for (int i=0; i < typeLibs.length; i++) {
    final TypeLib typeLib=typeLibs[i];
    final File file=findTypeLib(typeLib.getLibrary());
    try {
      final TypeDeployer typeDeployer=deployer.createDeployer(file);
      if (null == typeLib.getRole()) {
        typeDeployer.deployAll();
      }
 else {
        typeDeployer.deployType(typeLib.getRole(),typeLib.getName());
      }
    }
 catch (    final DeploymentException de) {
      final String message=REZ.getString("String_Node_Str",typeLib.getLibrary(),file);
      throw new TaskException(message,de);
    }
  }
}
Program: 64319
Project: 64319
Buggy source:
/** 
 * Helper method to execute a target.
 * @param project the Project
 * @param target the name of the target
 * @param context the context
 * @param done the list of targets already executed in current run
 * @exception TaskException if an error occurs
 */
private void execute(final Project project,final String targetName,final ProjectEntry entry) throws TaskException {
  final int index=targetName.indexOf("String_Node_Str");
  if (-1 != index) {
    final String name=targetName.substring(0,index);
    final String otherTargetName=targetName.substring(index + 2);
    final Project otherProject=getProject(name,project);
    final ProjectEntry otherEntry=getProjectEntry(otherProject);
    execute(otherProject,otherTargetName,otherEntry);
    return;
  }
  final Target target=project.getTarget(targetName);
  if (null == target) {
    final String message=REZ.getString("String_Node_Str",targetName);
    throw new TaskException(message);
  }
  entry.completeTarget(targetName);
  final String[] dependencies=target.getDependencies();
  for (int i=0; i < dependencies.length; i++) {
    if (!entry.isTargetCompleted(dependencies[i])) {
      execute(project,dependencies[i],entry);
    }
  }
  m_listenerSupport.targetStarted(targetName);
  executeTarget(targetName,target,entry.getFrame());
  m_listenerSupport.targetFinished();
}

Fixed version (ground truth):
/** 
 * Helper method to execute a target.
 * @param project the Project
 * @param targetName the name of the target
 * @param entry the context
 * @exception TaskException if an error occurs
 */
private void execute(final Project project,final String targetName,final ProjectEntry entry) throws TaskException {
  final int index=targetName.indexOf("String_Node_Str");
  if (-1 != index) {
    final String name=targetName.substring(0,index);
    final String otherTargetName=targetName.substring(index + 2);
    final Project otherProject=getProject(name,project);
    final ProjectEntry otherEntry=getProjectEntry(otherProject);
    execute(otherProject,otherTargetName,otherEntry);
    return;
  }
  final Target target=project.getTarget(targetName);
  if (null == target) {
    final String message=REZ.getString("String_Node_Str",targetName);
    throw new TaskException(message);
  }
  entry.completeTarget(targetName);
  final String[] dependencies=target.getDependencies();
  for (int i=0; i < dependencies.length; i++) {
    if (!entry.isTargetCompleted(dependencies[i])) {
      execute(project,dependencies[i],entry);
    }
  }
  m_listenerSupport.targetStarted(targetName);
  executeTarget(targetName,target,entry.getFrame());
  m_listenerSupport.targetFinished();
}
Program: 64320
Project: 64320
Buggy source:
/** 
 * Run the sub-build
 * @exception ExecutionException if the build can't be run
 */
public void execute() throws ExecutionException {
  if (baseDir == null) {
    baseDir=getContext().getBaseDir();
  }
  if (antFile == null) {
    antFile=new File(baseDir,"String_Node_Str");
  }
  ComponentService componentService=(ComponentService)getCoreService(ComponentService.class);
  componentService.runBuild(antFile,getProperties(),getTargets());
}

Fixed version (ground truth):
/** 
 * Run the sub-build
 * @exception ExecutionException if the build can't be run
 */
public void execute() throws ExecutionException {
  if (baseDir == null) {
    baseDir=getContext().getBaseDir();
  }
  if (antFile == null) {
    antFile=new File(baseDir,"String_Node_Str");
    if (!antFile.exists()) {
      antFile=new File(baseDir,"String_Node_Str");
    }
  }
  ComponentService componentService=(ComponentService)getCoreService(ComponentService.class);
  componentService.runBuild(antFile,getProperties(),getTargets());
}
Program: 64321
Project: 64321
Buggy source:
/** 
 * @return all collected tests specified with test elements.
 */
protected Enumeration collectTests(){
  Enumeration[] tests=new Enumeration[testCollectors.size()];
  for (int i=0; i < testCollectors.size(); i++) {
    TestCollector te=(TestCollector)testCollectors.elementAt(i);
    tests[i]=te.collectTests();
  }
  return Enumerations.fromCompound(tests);
}

Fixed version (ground truth):
/** 
 * @return all collected tests specified with test elements.
 */
protected Enumeration collectTests(){
  Enumeration[] tests=new Enumeration[testCollectors.size()];
  for (int i=0; i < testCollectors.size(); i++) {
    TestCollector te=(TestCollector)testCollectors.elementAt(i);
    tests[i]=te.collectTests();
  }
  return new CompoundEnumeration(tests);
}
Program: 64322
Project: 64322
Buggy source:
/** 
 * create the Formatter corresponding to this element.
 */
protected Formatter createFormatter() throws BuildException {
  if (classname == null) {
    throw new BuildException("String_Node_Str");
  }
  Formatter f=null;
  try {
    Class clazz=Class.forName(classname);
    if (!Formatter.class.isAssignableFrom(clazz)) {
      throw new BuildException(clazz + "String_Node_Str");
    }
    f=(Formatter)clazz.newInstance();
  }
 catch (  BuildException e) {
    throw e;
  }
catch (  Exception e) {
    throw new BuildException(e);
  }
  for (int i=filters.size() - 1; i >= 0; i--) {
    FilterElement fe=(FilterElement)filters.elementAt(i);
    f=fe.createFilterFormatter(f);
  }
  f.init(params);
  return f;
}

Fixed version (ground truth):
/** 
 * create the Formatter corresponding to this element.
 */
protected Formatter createFormatter() throws BuildException {
  if (classname == null) {
    throw new BuildException("String_Node_Str");
  }
  Formatter f=null;
  try {
    Class clazz=Class.forName(classname);
    if (!Formatter.class.isAssignableFrom(clazz)) {
      throw new BuildException(clazz + "String_Node_Str");
    }
    f=(Formatter)clazz.newInstance();
  }
 catch (  BuildException e) {
    throw e;
  }
catch (  Exception e) {
    throw new BuildException(e);
  }
  for (int i=filters.size() - 1; i >= 0; i--) {
    FilterElement fe=(FilterElement)filters.elementAt(i);
    f=fe.createFilterFormatter(f);
  }
  Properties props=new Properties();
  for (int i=0; i < params.size(); i++) {
    Parameter param=(Parameter)params.elementAt(i);
    props.put(param.getName(),param.getValue());
  }
  f.init(props);
  return f;
}
Program: 64323
Project: 64323
Buggy source:
/** 
 * Add a parameter that can be used for configuration.
 */
public void addParam(Parameter param){
  params.setProperty(param.getName(),param.getValue());
}

Fixed version (ground truth):
/** 
 * Add a parameter that can be used for configuration.
 */
public void addParam(Parameter param){
  params.addElement(param);
}
Program: 64324
Project: 64324
Buggy source:
/** 
 * add a new formatter element 
 */
public void addFormatter(FormatterElement fe){
  Formatter f=fe.createFormatter();
  formatters.addElement(f);
}

Fixed version (ground truth):
/** 
 * add a new formatter element 
 */
public void addFormatter(FormatterElement fe){
  formatterElements.addElement(fe);
}
Program: 64325
Project: 64325
Buggy source:
/** 
 * start the server and block until client has finished 
 */
public void execute() throws BuildException {
  Server server=new Server(port);
  Enumeration listeners=formatters.elements();
  while (listeners.hasMoreElements()) {
    server.addListener((TestRunListener)listeners.nextElement());
  }
  server.start();
}

Fixed version (ground truth):
/** 
 * start the server and block until client has finished 
 */
public void execute() throws BuildException {
  Server server=new Server(port);
  Enumeration listeners=formatterElements.elements();
  while (listeners.hasMoreElements()) {
    FormatterElement fe=(FormatterElement)listeners.nextElement();
    Formatter formatter=fe.createFormatter();
    server.addListener(formatter);
  }
  server.start();
}
Program: 64326
Project: 64326
Buggy source:
public Enumeration collectTests(){
  return Enumerations.fromArray(new String[]{name});
}

Fixed version (ground truth):
public Enumeration collectTests(){
  return new ArrayEnumeration(new String[]{name});
}
Program: 64327
Project: 64327
Buggy source:
/** 
 * Set the source dir to find the files to be compiled
 * @param srcDirName  The new SrcDir value 
 */
public void setSrcDir(File srcDirName){
}

Fixed version (ground truth):
/** 
 * Set the source dir to find the files to be compiled
 * @param srcDirName  The new SrcDir value 
 */
public void setSrcDir(File srcDirName){
  _srcDir=srcDirName;
}
Program: 64328
Project: 64328
Buggy source:
protected Hashtable getFiles(){
  if (files == null) {
    return files;
  }
  files=new Hashtable();
  DirectoryScanner ds=getDirectoryScanner(viewpath);
  String[] includes=ds.getIncludedDirectories();
  addElements(files,ds.getBasedir(),includes);
  includes=ds.getIncludedFiles();
  addElements(files,ds.getBasedir(),includes);
  return files;
}

Fixed version (ground truth):
protected Hashtable getFiles(){
  if (files != null) {
    return files;
  }
  files=new Hashtable();
  DirectoryScanner ds=getDirectoryScanner(viewpath);
  String[] includes=ds.getIncludedDirectories();
  addElements(files,ds.getBasedir(),includes);
  includes=ds.getIncludedFiles();
  addElements(files,ds.getBasedir(),includes);
  return files;
}
Program: 64329
Project: 64329
Buggy source:
/** 
 * Interface TestListener. <p>A Test is finished.
 */
public void endTest(Test test){
  Element currentTest=(Element)testElements.get(test);
  Long l=(Long)testStarts.get(test);
  currentTest.setAttribute(ATTR_TIME,"String_Node_Str" + ((System.currentTimeMillis() - l.longValue()) / 1000.0));
}

Fixed version (ground truth):
/** 
 * Interface TestListener. <p>A Test is finished.
 */
public void endTest(Test test){
  Element currentTest=(Element)testElements.get(test);
  if (currentTest == null) {
    startTest(test);
    currentTest=(Element)testElements.get(test);
  }
  Long l=(Long)testStarts.get(test);
  currentTest.setAttribute(ATTR_TIME,"String_Node_Str" + ((System.currentTimeMillis() - l.longValue()) / 1000.0));
}