nus-yam/ex-repair huggingface dataset:
Program: 64225
Project: 64225
Buggy source:
public void testFullPathMatchesCaseInsensitive(){
  DirectoryScanner ds=new DirectoryScanner();
  ds.setCaseSensitive(false);
  ds.setBasedir(new File(getProject().getBaseDir(),"String_Node_Str"));
  ds.setIncludes(new String[]{"String_Node_Str"});
  ds.scan();
  if (Os.isFamily("String_Node_Str")) {
    compareFiles(ds,new String[]{"String_Node_Str"},new String[]{});
  }
 else {
    compareFiles(ds,new String[]{"String_Node_Str"},new String[]{});
  }
}

Fixed version (ground truth):
public void testFullPathMatchesCaseInsensitive(){
  DirectoryScanner ds=new DirectoryScanner();
  ds.setCaseSensitive(false);
  ds.setBasedir(new File(getProject().getBaseDir(),"String_Node_Str"));
  ds.setIncludes(new String[]{"String_Node_Str"});
  ds.scan();
  compareFiles(ds,new String[]{"String_Node_Str"},new String[]{});
}
Program: 64226
Project: 64226
Buggy source:
/** 
 * The regular expression used to search the file.
 * @param regular expression that must match a line in the file tobe selected.
 */
public void setExpression(String theexpression){
  this.userProvidedExpression=theexpression;
}

Fixed version (ground truth):
/** 
 * The regular expression used to search the file.
 * @param theexpression this must match a line in the file to be selected.
 */
public void setExpression(String theexpression){
  this.userProvidedExpression=theexpression;
}
Program: 64227
Project: 64227
Buggy source:
/** 
 * Whether to ignore whitespace in the string being searched.
 * @param whitespace whether to ignore any whitespace (spaces, tabs, etc.) in the searchstring
 */
public void setIgnorewhitespace(boolean ignorewhitespace){
  this.ignorewhitespace=ignorewhitespace;
}

Fixed version (ground truth):
/** 
 * Whether to ignore whitespace in the string being searched.
 * @param ignorewhitespace whether to ignore any whitespace (spaces, tabs, etc.) in the searchstring
 */
public void setIgnorewhitespace(boolean ignorewhitespace){
  this.ignorewhitespace=ignorewhitespace;
}
Program: 64228
Project: 64228
Buggy source:
public void process(String line) throws BuildException ;

Fixed version (ground truth):
/** 
 * processing of one line of stdout or of stderr
 * @param line
 */
public void process(String line) throws BuildException ;
Program: 64229
Project: 64229
Buggy source:
public void setOutput(String line) throws BuildException ;

Fixed version (ground truth):
/** 
 * set any data to be written to P4's stdin
 * @param line the text to write to P4's stdin
 */
public void setOutput(String line) throws BuildException ;
Program: 64230
Project: 64230
Buggy source:
public abstract void process(String line);

Fixed version (ground truth):
/** 
 * subclasses of P4HandlerAdapter must implement this routine processing of one line of stdout or of stderr
 * @param line
 */
public abstract void process(String line);
Program: 64231
Project: 64231
Buggy source:
public void stop(){
}

Fixed version (ground truth):
public void stop(){
  myHandler.stop();
}
Program: 64232
Project: 64232
Buggy source:
public void start() throws BuildException {
  try {
    if (p4input != null && p4input.length() > 0 && os != null) {
      os.write(p4input.getBytes());
      os.flush();
      os.close();
    }
    Thread output=new Thread(new Reader(is));
    Thread error=new Thread(new Reader(es));
    output.start();
    error.start();
    output.join();
    error.join();
  }
 catch (  Exception e) {
    throw new BuildException(e);
  }
}

Fixed version (ground truth):
public void start() throws BuildException {
  if (p4input != null && p4input.length() > 0) {
    myHandler=new PumpStreamHandler(new P4OutputStream(this),new P4OutputStream(this),new ByteArrayInputStream(p4input.getBytes()));
  }
 else {
    myHandler=new PumpStreamHandler(new P4OutputStream(this),new P4OutputStream(this));
  }
  myHandler.setProcessInputStream(os);
  myHandler.setProcessErrorStream(es);
  myHandler.setProcessOutputStream(is);
  myHandler.start();
}
Program: 64233
Project: 64233
Buggy source:
public void setOutput(String p4Input){
  this.p4input=p4Input;
}

Fixed version (ground truth):
/** 
 * set any data to be written to P4's stdin
 * @param p4Input the text to write to P4's stdin
 */
public void setOutput(String p4Input){
  this.p4input=p4Input;
}
Program: 64234
Project: 64234
Buggy source:
/** 
 * Assemble string for parameters common for import and export Helper method to remove double code.
 */
private String assembleImportExportParams(File dir,String[] includePatterns,String[] excludePatterns,boolean includeClasses,boolean includeResources,boolean includeSources,boolean useDefaultExcludes){
  String result=VAJToolsServlet.DIR_PARAM + "String_Node_Str" + URLEncoder.encode(dir.getAbsolutePath())+ "String_Node_Str"+ VAJToolsServlet.CLASSES_PARAM+ "String_Node_Str"+ includeClasses+ "String_Node_Str"+ VAJToolsServlet.RESOURCES_PARAM+ "String_Node_Str"+ includeResources+ "String_Node_Str"+ VAJToolsServlet.SOURCES_PARAM+ "String_Node_Str"+ includeSources+ "String_Node_Str"+ VAJToolsServlet.DEFAULT_EXCLUDES_PARAM+ "String_Node_Str"+ useDefaultExcludes;
  if (includePatterns != null) {
    for (int i=0; i < includePatterns.length; i++) {
      result=result + "String_Node_Str" + VAJExportServlet.INCLUDE_PARAM+ "String_Node_Str"+ URLEncoder.encode(includePatterns[i]);
    }
  }
  if (excludePatterns != null) {
    for (int i=0; i < excludePatterns.length; i++) {
      result=result + "String_Node_Str" + VAJExportServlet.EXCLUDE_PARAM+ "String_Node_Str"+ URLEncoder.encode(excludePatterns[i]);
    }
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Assemble string for parameters common for import and export Helper method to remove double code.
 */
private String assembleImportExportParams(File dir,String[] includePatterns,String[] excludePatterns,boolean includeClasses,boolean includeResources,boolean includeSources,boolean useDefaultExcludes){
  String result=VAJToolsServlet.DIR_PARAM + "String_Node_Str" + URLEncoder.encode(dir.getPath())+ "String_Node_Str"+ VAJToolsServlet.CLASSES_PARAM+ "String_Node_Str"+ includeClasses+ "String_Node_Str"+ VAJToolsServlet.RESOURCES_PARAM+ "String_Node_Str"+ includeResources+ "String_Node_Str"+ VAJToolsServlet.SOURCES_PARAM+ "String_Node_Str"+ includeSources+ "String_Node_Str"+ VAJToolsServlet.DEFAULT_EXCLUDES_PARAM+ "String_Node_Str"+ useDefaultExcludes;
  if (includePatterns != null) {
    for (int i=0; i < includePatterns.length; i++) {
      result=result + "String_Node_Str" + VAJExportServlet.INCLUDE_PARAM+ "String_Node_Str"+ URLEncoder.encode(includePatterns[i]);
    }
  }
  if (excludePatterns != null) {
    for (int i=0; i < excludePatterns.length; i++) {
      result=result + "String_Node_Str" + VAJExportServlet.EXCLUDE_PARAM+ "String_Node_Str"+ URLEncoder.encode(excludePatterns[i]);
    }
  }
  return result;
}
Program: 64235
Project: 64235
Buggy source:
public void start() throws BuildException {
  try {
    if (p4input != null && p4input.length() > 0 && os != null) {
      os.write(p4input.getBytes());
      os.flush();
      os.close();
    }
    Thread output=new Thread(new Reader(is));
    Thread error=new Thread(new Reader(es));
    output.start();
    error.start();
  }
 catch (  Exception e) {
    throw new BuildException(e);
  }
}

Fixed version (ground truth):
public void start() throws BuildException {
  try {
    if (p4input != null && p4input.length() > 0 && os != null) {
      os.write(p4input.getBytes());
      os.flush();
      os.close();
    }
    Thread output=new Thread(new Reader(is));
    Thread error=new Thread(new Reader(es));
    output.start();
    error.start();
    output.join();
    error.join();
  }
 catch (  Exception e) {
    throw new BuildException(e);
  }
}
Program: 64236
Project: 64236
Buggy source:
/** 
 * Overriden from Zip class to deal with application.xml
 */
protected void zipFile(File file,ZipOutputStream zOut,String vPath,int mode) throws IOException {
  if (vPath.equalsIgnoreCase("String_Node_Str")) {
    if (deploymentDescriptor == null || !deploymentDescriptor.equals(file) || descriptorAdded) {
      log("String_Node_Str" + archiveType + "String_Node_Str"+ "String_Node_Str"+ archiveType+ "String_Node_Str",Project.MSG_WARN);
    }
 else {
      super.zipFile(file,zOut,vPath,mode);
      descriptorAdded=true;
    }
  }
 else {
    super.zipFile(file,zOut,vPath,mode);
  }
}

Fixed version (ground truth):
/** 
 * Overriden from Zip class to deal with application.xml
 */
protected void zipFile(File file,ZipOutputStream zOut,String vPath,int mode) throws IOException {
  if (vPath.equalsIgnoreCase("String_Node_Str")) {
    if (deploymentDescriptor == null || !fu.fileNameEquals(deploymentDescriptor,file) || descriptorAdded) {
      log("String_Node_Str" + archiveType + "String_Node_Str"+ "String_Node_Str"+ archiveType+ "String_Node_Str",Project.MSG_WARN);
    }
 else {
      super.zipFile(file,zOut,vPath,mode);
      descriptorAdded=true;
    }
  }
 else {
    super.zipFile(file,zOut,vPath,mode);
  }
}
Program: 64237
Project: 64237
Buggy source:
/** 
 * Overriden from Zip class to deal with web.xml
 */
protected void zipFile(File file,ZipOutputStream zOut,String vPath,int mode) throws IOException {
  if (vPath.equalsIgnoreCase("String_Node_Str")) {
    if (deploymentDescriptor == null || !deploymentDescriptor.equals(file) || descriptorAdded) {
      log("String_Node_Str" + archiveType + "String_Node_Str"+ "String_Node_Str"+ archiveType+ "String_Node_Str",Project.MSG_WARN);
    }
 else {
      super.zipFile(file,zOut,vPath,mode);
      descriptorAdded=true;
    }
  }
 else {
    super.zipFile(file,zOut,vPath,mode);
  }
}

Fixed version (ground truth):
/** 
 * Overriden from Zip class to deal with web.xml
 */
protected void zipFile(File file,ZipOutputStream zOut,String vPath,int mode) throws IOException {
  if (vPath.equalsIgnoreCase("String_Node_Str")) {
    if (deploymentDescriptor == null || !fu.fileNameEquals(deploymentDescriptor,file) || descriptorAdded) {
      log("String_Node_Str" + archiveType + "String_Node_Str"+ "String_Node_Str"+ archiveType+ "String_Node_Str",Project.MSG_WARN);
    }
 else {
      super.zipFile(file,zOut,vPath,mode);
      descriptorAdded=true;
    }
  }
 else {
    super.zipFile(file,zOut,vPath,mode);
  }
}
Program: 64238
Project: 64238
Buggy source:
/** 
 * Compares the contents of two files. <p>simple but sub-optimal comparision algorithm.  written for working rather than fast. Better would be a block read into buffers followed by long comparisions apart from the final 1-7 bytes.</p>
 * @since 1.9
 */
public boolean contentEquals(File f1,File f2) throws IOException {
  if (f1.exists() != f2.exists()) {
    return false;
  }
  if (!f1.exists()) {
    return true;
  }
  if (f1.isDirectory() || f2.isDirectory()) {
    return false;
  }
  if (f1.equals(f2)) {
    return true;
  }
  if (f1.length() != f2.length()) {
    return false;
  }
  InputStream in1=null;
  InputStream in2=null;
  try {
    in1=new BufferedInputStream(new FileInputStream(f1));
    in2=new BufferedInputStream(new FileInputStream(f2));
    int expectedByte=in1.read();
    while (expectedByte != -1) {
      if (expectedByte != in2.read()) {
        return false;
      }
      expectedByte=in1.read();
    }
    if (in2.read() != -1) {
      return false;
    }
    return true;
  }
  finally {
    if (in1 != null) {
      try {
        in1.close();
      }
 catch (      IOException e) {
      }
    }
    if (in2 != null) {
      try {
        in2.close();
      }
 catch (      IOException e) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Compares the contents of two files. <p>simple but sub-optimal comparision algorithm.  written for working rather than fast. Better would be a block read into buffers followed by long comparisions apart from the final 1-7 bytes.</p>
 * @since 1.9
 */
public boolean contentEquals(File f1,File f2) throws IOException {
  if (f1.exists() != f2.exists()) {
    return false;
  }
  if (!f1.exists()) {
    return true;
  }
  if (f1.isDirectory() || f2.isDirectory()) {
    return false;
  }
  if (fileNameEquals(f1,f2)) {
    return true;
  }
  if (f1.length() != f2.length()) {
    return false;
  }
  InputStream in1=null;
  InputStream in2=null;
  try {
    in1=new BufferedInputStream(new FileInputStream(f1));
    in2=new BufferedInputStream(new FileInputStream(f2));
    int expectedByte=in1.read();
    while (expectedByte != -1) {
      if (expectedByte != in2.read()) {
        return false;
      }
      expectedByte=in1.read();
    }
    if (in2.read() != -1) {
      return false;
    }
    return true;
  }
  finally {
    if (in1 != null) {
      try {
        in1.close();
      }
 catch (      IOException e) {
      }
    }
    if (in2 != null) {
      try {
        in2.close();
      }
 catch (      IOException e) {
      }
    }
  }
}
Program: 64244
Project: 64244
Buggy source:
/** 
 * Utility method to lookup a ResourceLocation in the filesystem.
 * @return An InputSource for reading the file, or <code>null</code>if the file does not exist or is not readable.
 */
private InputSource filesystemLookup(ResourceLocation matchingEntry){
  String uri=matchingEntry.getLocation();
  URL baseURL=null;
  if (matchingEntry.getBase() != null) {
    baseURL=matchingEntry.getBase();
  }
 else {
    try {
      baseURL=getProject().getBaseDir().toURL();
    }
 catch (    MalformedURLException ex) {
      throw new BuildException("String_Node_Str");
    }
  }
  InputSource source=null;
  URL url=null;
  try {
    url=new URL(baseURL,uri);
  }
 catch (  MalformedURLException ex) {
  }
  if (url != null) {
    String fileName=url.getFile();
    if (fileName != null) {
      log("String_Node_Str" + fileName,Project.MSG_DEBUG);
      File resFile=new File(fileName);
      if (resFile.exists() && resFile.canRead()) {
        try {
          source=new InputSource(new FileInputStream(resFile));
          String sysid=JAXPUtils.getSystemId(resFile);
          source.setSystemId(sysid);
          log("String_Node_Str" + sysid + "String_Node_Str",Project.MSG_DEBUG);
        }
 catch (        FileNotFoundException ex) {
        }
catch (        IOException ex) {
        }
      }
    }
  }
  return source;
}

Fixed version (ground truth):
/** 
 * Utility method to lookup a ResourceLocation in the filesystem.
 * @return An InputSource for reading the file, or <code>null</code>if the file does not exist or is not readable.
 */
private InputSource filesystemLookup(ResourceLocation matchingEntry){
  String uri=matchingEntry.getLocation();
  URL baseURL=null;
  if (matchingEntry.getBase() != null) {
    baseURL=matchingEntry.getBase();
  }
 else {
    try {
      baseURL=fileUtils.getFileURL(getProject().getBaseDir());
    }
 catch (    MalformedURLException ex) {
      throw new BuildException("String_Node_Str");
    }
  }
  InputSource source=null;
  URL url=null;
  try {
    url=new URL(baseURL,uri);
  }
 catch (  MalformedURLException ex) {
  }
  if (url != null) {
    String fileName=url.getFile();
    if (fileName != null) {
      log("String_Node_Str" + fileName,Project.MSG_DEBUG);
      File resFile=new File(fileName);
      if (resFile.exists() && resFile.canRead()) {
        try {
          source=new InputSource(new FileInputStream(resFile));
          String sysid=JAXPUtils.getSystemId(resFile);
          source.setSystemId(sysid);
          log("String_Node_Str" + sysid + "String_Node_Str",Project.MSG_DEBUG);
        }
 catch (        FileNotFoundException ex) {
        }
catch (        IOException ex) {
        }
      }
    }
  }
  return source;
}
Program: 64245
Project: 64245
Buggy source:
/** 
 * Utility method to lookup a ResourceLocation in URL-space.
 * @return An InputSource for reading the resource, or <code>null</code>if the resource does not identify a valid URL or is not readable.
 */
private InputSource urlLookup(ResourceLocation matchingEntry){
  String uri=matchingEntry.getLocation();
  URL baseURL=null;
  if (matchingEntry.getBase() != null) {
    baseURL=matchingEntry.getBase();
  }
 else {
    try {
      baseURL=getProject().getBaseDir().toURL();
    }
 catch (    MalformedURLException ex) {
      throw new BuildException("String_Node_Str");
    }
  }
  InputSource source=null;
  URL url=null;
  try {
    url=new URL(baseURL,uri);
  }
 catch (  MalformedURLException ex) {
  }
  if (url != null) {
    try {
      InputStream is=url.openStream();
      if (is != null) {
        source=new InputSource(is);
        String sysid=url.toExternalForm();
        source.setSystemId(sysid);
        log("String_Node_Str" + sysid + "String_Node_Str",Project.MSG_DEBUG);
      }
    }
 catch (    IOException ex) {
    }
  }
  return source;
}

Fixed version (ground truth):
/** 
 * Utility method to lookup a ResourceLocation in URL-space.
 * @return An InputSource for reading the resource, or <code>null</code>if the resource does not identify a valid URL or is not readable.
 */
private InputSource urlLookup(ResourceLocation matchingEntry){
  String uri=matchingEntry.getLocation();
  URL baseURL=null;
  if (matchingEntry.getBase() != null) {
    baseURL=matchingEntry.getBase();
  }
 else {
    try {
      baseURL=fileUtils.getFileURL(getProject().getBaseDir());
    }
 catch (    MalformedURLException ex) {
      throw new BuildException("String_Node_Str");
    }
  }
  InputSource source=null;
  URL url=null;
  try {
    url=new URL(baseURL,uri);
  }
 catch (  MalformedURLException ex) {
  }
  if (url != null) {
    try {
      InputStream is=url.openStream();
      if (is != null) {
        source=new InputSource(is);
        String sysid=url.toExternalForm();
        source.setSystemId(sysid);
        log("String_Node_Str" + sysid + "String_Node_Str",Project.MSG_DEBUG);
      }
    }
 catch (    IOException ex) {
    }
  }
  return source;
}
Program: 64246
Project: 64246
Buggy source:
/** 
 * Constructs a <code>file:</code> URI that represents the external form of the given pathname. <p>Will be an absolute URI if the given path is absolute.</p> <p>This code doesn't handle non-ASCII characters properly.</p>
 * @since Ant 1.6
 */
public String toURI(String path){
  StringBuffer sb=new StringBuffer("String_Node_Str");
  try {
    path=normalize(path).getAbsolutePath();
    sb.append("String_Node_Str");
    if (!path.startsWith("String_Node_Str")) {
      sb.append("String_Node_Str");
    }
  }
 catch (  BuildException e) {
  }
  path=path.replace('\\','/');
  CharacterIterator iter=new StringCharacterIterator(path);
  for (char c=iter.first(); c != CharacterIterator.DONE; c=iter.next()) {
    if (isSpecial[c]) {
      sb.append('%');
      sb.append(escapedChar1[c]);
      sb.append(escapedChar2[c]);
    }
 else {
      sb.append(c);
    }
  }
  return sb.toString();
}

Fixed version (ground truth):
/** 
 * Constructs a <code>file:</code> URI that represents the external form of the given pathname. <p>Will be an absolute URI if the given path is absolute.</p> <p>This code doesn't handle non-ASCII characters properly.</p>
 * @since Ant 1.6
 */
public String toURI(String path){
  boolean isDir=(new File(path)).isDirectory();
  StringBuffer sb=new StringBuffer("String_Node_Str");
  try {
    path=normalize(path).getAbsolutePath();
    sb.append("String_Node_Str");
    if (!path.startsWith("String_Node_Str")) {
      sb.append("String_Node_Str");
    }
  }
 catch (  BuildException e) {
  }
  path=path.replace('\\','/');
  CharacterIterator iter=new StringCharacterIterator(path);
  for (char c=iter.first(); c != CharacterIterator.DONE; c=iter.next()) {
    if (isSpecial[c]) {
      sb.append('%');
      sb.append(escapedChar1[c]);
      sb.append(escapedChar2[c]);
    }
 else {
      sb.append(c);
    }
  }
  if (isDir && !path.endsWith("String_Node_Str")) {
    sb.append('/');
  }
  return sb.toString();
}
Program: 64247
Project: 64247
Buggy source:
/** 
 * Create a temporary file in a given directory. <p>The file denoted by the returned abstract pathname did not exist before this method was invoked, any subsequent invocation of this method will yield a different file name.</p> <p>This method is different to File.createTempFile of JDK 1.2 as it doesn't create the file itself and doesn't use platform specific temporary directory when the parentDir attribute is null.</p>
 * @param parentDir Directory to create the temporary file in -current working directory will be assumed if this parameter is null.
 * @since 1.8
 */
public File createTempFile(String prefix,String suffix,File parentDir){
  File result=null;
  String parent=null;
  if (parentDir != null) {
    parent=parentDir.getPath();
  }
  DecimalFormat fmt=new DecimalFormat("String_Node_Str");
synchronized (rand) {
    do {
      result=new File(parent,prefix + fmt.format(rand.nextInt(Integer.MAX_VALUE)) + suffix);
    }
 while (result.exists());
  }
  return result;
}

Fixed version (ground truth):
/** 
 * Create a temporary file in a given directory. <p>The file denoted by the returned abstract pathname did not exist before this method was invoked, any subsequent invocation of this method will yield a different file name.</p> <p>This method is different to File.createTempFile of JDK 1.2 as it doesn't create the file itself and doesn't use platform specific temporary directory when the parentDir attribute is null.</p>
 * @param parentDir Directory to create the temporary file in -current working directory will be assumed if this parameter is null.
 * @since 1.8
 */
public File createTempFile(String prefix,String suffix,File parentDir){
  File result=null;
  String parent=null;
  if (parentDir != null) {
    parent=parentDir.getPath();
  }
  DecimalFormat fmt=new DecimalFormat("String_Node_Str");
synchronized (rand) {
    do {
      result=new File(parent,prefix + fmt.format(Math.abs(rand.nextInt())) + suffix);
    }
 while (result.exists());
  }
  return result;
}
Program: 64248
Project: 64248
Buggy source:
/** 
 * Get the URL for a file taking into account # characters
 * @param file the file whose URL representation is required.
 * @return The FileURL value
 * @throws MalformedURLException if the URL representation cannot beformed.
 */
public URL getFileURL(File file) throws MalformedURLException {
  String path=file.getAbsolutePath();
  if (file.isDirectory()) {
    path+="String_Node_Str";
  }
  return new URL(toURI(path));
}

Fixed version (ground truth):
/** 
 * Get the URL for a file taking into account # characters
 * @param file the file whose URL representation is required.
 * @return The FileURL value
 * @throws MalformedURLException if the URL representation cannot beformed.
 */
public URL getFileURL(File file) throws MalformedURLException {
  return new URL(toURI(file.getAbsolutePath()));
}
Program: 64249
Project: 64249
Buggy source:
public boolean containsValue(Object value){
  initAll();
  return super.containsValue(value);
}

Fixed version (ground truth):
public boolean containsValue(Object value){
  initAll();
  return super.contains(value);
}
Program: 64250
Project: 64250
Buggy source:
/** 
 * Adds descriptive text to the project.
 */
public void addText(String text){
  String currentDescription=getProject().getDescription();
  if (currentDescription == null) {
    getProject().setDescription(text);
  }
 else {
    getProject().setDescription(currentDescription + text);
  }
}

Fixed version (ground truth):
/** 
 * Adds descriptive text to the project.
 */
public void addText(String text){
  ProjectHelper ph=ProjectHelper.getProjectHelper();
  if (!(ph instanceof ProjectHelperImpl)) {
    return;
  }
  String currentDescription=getProject().getDescription();
  if (currentDescription == null) {
    getProject().setDescription(text);
  }
 else {
    getProject().setDescription(currentDescription + text);
  }
}
Program: 64252
Project: 64252
Buggy source:
public boolean eval() throws BuildException {
  if (server == null) {
    throw new BuildException("String_Node_Str" + "String_Node_Str");
  }
  if (port == 0) {
    throw new BuildException("String_Node_Str");
  }
  log("String_Node_Str" + server + "String_Node_Str"+ port,Project.MSG_VERBOSE);
  try {
    java.net.Socket socket=new java.net.Socket(server,port);
  }
 catch (  IOException e) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean eval() throws BuildException {
  if (server == null) {
    throw new BuildException("String_Node_Str" + "String_Node_Str");
  }
  if (port == 0) {
    throw new BuildException("String_Node_Str");
  }
  log("String_Node_Str" + server + "String_Node_Str"+ port,Project.MSG_VERBOSE);
  try {
    new java.net.Socket(server,port);
  }
 catch (  IOException e) {
    return false;
  }
  return true;
}
Program: 64253
Project: 64253
Buggy source:
/** 
 * Executes the task. <p> Builds a command line to execute ccm and then calls Exec's run method to execute the command line. </p>
 */
public void execute() throws BuildException {
  Commandline commandLine=new Commandline();
  Project aProj=getProject();
  int result=0;
  commandLine.setExecutable(getCcmCommand());
  commandLine.createArgument().setValue(getCcmAction());
  checkOptions(commandLine);
  result=run(commandLine);
  if (result != 0) {
    String msg="String_Node_Str" + commandLine.toString();
    throw new BuildException(msg,getLocation());
  }
}

Fixed version (ground truth):
/** 
 * Executes the task. <p> Builds a command line to execute ccm and then calls Exec's run method to execute the command line. </p>
 */
public void execute() throws BuildException {
  Commandline commandLine=new Commandline();
  int result=0;
  commandLine.setExecutable(getCcmCommand());
  commandLine.createArgument().setValue(getCcmAction());
  checkOptions(commandLine);
  result=run(commandLine);
  if (result != 0) {
    String msg="String_Node_Str" + commandLine.toString();
    throw new BuildException(msg,getLocation());
  }
}
Program: 64254
Project: 64254
Buggy source:
/** 
 * Executes the task. <p> Builds a command line to execute ccm and then calls Exec's run method to execute the command line. </p>
 */
public void execute() throws BuildException {
  Commandline commandLine=new Commandline();
  Project aProj=getProject();
  int result=0;
  commandLine.setExecutable(getCcmCommand());
  commandLine.createArgument().setValue(getCcmAction());
  checkOptions(commandLine);
  result=run(commandLine);
  if (result != 0) {
    String msg="String_Node_Str" + commandLine.toString();
    throw new BuildException(msg,getLocation());
  }
}

Fixed version (ground truth):
/** 
 * Executes the task. <p> Builds a command line to execute ccm and then calls Exec's run method to execute the command line. </p>
 */
public void execute() throws BuildException {
  Commandline commandLine=new Commandline();
  int result=0;
  commandLine.setExecutable(getCcmCommand());
  commandLine.createArgument().setValue(getCcmAction());
  checkOptions(commandLine);
  result=run(commandLine);
  if (result != 0) {
    String msg="String_Node_Str" + commandLine.toString();
    throw new BuildException(msg,getLocation());
  }
}
Program: 64255
Project: 64255
Buggy source:
/** 
 * Read the class from a data stream. This method takes an InputStream as input and parses the class from the stream. <p>
 * @param stream an InputStream from which the class will be read
 * @exception IOException if there is a problem reading from the givenstream.
 * @exception ClassFormatError if the class cannot be parsed correctly
 */
public void read(InputStream stream) throws IOException, ClassFormatError {
  DataInputStream classStream=new DataInputStream(stream);
  if (classStream.readInt() != CLASS_MAGIC) {
    throw new ClassFormatError("String_Node_Str" + "String_Node_Str");
  }
  int minorVersion=classStream.readUnsignedShort();
  int majorVersion=classStream.readUnsignedShort();
  constantPool=new ConstantPool();
  constantPool.read(classStream);
  constantPool.resolve();
  int accessFlags=classStream.readUnsignedShort();
  int thisClassIndex=classStream.readUnsignedShort();
  int superClassIndex=classStream.readUnsignedShort();
  ClassCPInfo classInfo=(ClassCPInfo)constantPool.getEntry(thisClassIndex);
  className=classInfo.getClassName();
}

Fixed version (ground truth):
/** 
 * Read the class from a data stream. This method takes an InputStream as input and parses the class from the stream. <p>
 * @param stream an InputStream from which the class will be read
 * @exception IOException if there is a problem reading from the givenstream.
 * @exception ClassFormatError if the class cannot be parsed correctly
 */
public void read(InputStream stream) throws IOException, ClassFormatError {
  DataInputStream classStream=new DataInputStream(stream);
  if (classStream.readInt() != CLASS_MAGIC) {
    throw new ClassFormatError("String_Node_Str" + "String_Node_Str");
  }
  classStream.readUnsignedShort();
  classStream.readUnsignedShort();
  constantPool=new ConstantPool();
  constantPool.read(classStream);
  constantPool.resolve();
  classStream.readUnsignedShort();
  int thisClassIndex=classStream.readUnsignedShort();
  classStream.readUnsignedShort();
  ClassCPInfo classInfo=(ClassCPInfo)constantPool.getEntry(thisClassIndex);
  className=classInfo.getClassName();
}
Program: 64257
Project: 64257
Buggy source:
public static String getClassName(InputStream input) throws IOException {
  DataInputStream data=new DataInputStream(input);
  int cookie=data.readInt();
  if (cookie != 0xCAFEBABE) {
    return null;
  }
  int version=data.readInt();
  ConstantPool constants=new ConstantPool(data);
  Object[] values=constants.values;
  int accessFlags=data.readUnsignedShort();
  int classIndex=data.readUnsignedShort();
  Integer stringIndex=(Integer)values[classIndex];
  String className=(String)values[stringIndex.intValue()];
  return className;
}

Fixed version (ground truth):
public static String getClassName(InputStream input) throws IOException {
  DataInputStream data=new DataInputStream(input);
  int cookie=data.readInt();
  if (cookie != 0xCAFEBABE) {
    return null;
  }
  data.readInt();
  ConstantPool constants=new ConstantPool(data);
  Object[] values=constants.values;
  data.readUnsignedShort();
  int classIndex=data.readUnsignedShort();
  Integer stringIndex=(Integer)values[classIndex];
  String className=(String)values[stringIndex.intValue()];
  return className;
}
Program: 64258
Project: 64258
Buggy source:
private long calcChecksum(InputStream in,long size) throws IOException {
  CRC32 crc=new CRC32();
  int len=buffer.length;
  int count=-1;
  int haveRead=0;
  while ((count=in.read(buffer,0,len)) > 0) {
    haveRead+=count;
    crc.update(buffer,0,count);
  }
  in.close();
  return crc.getValue();
}

Fixed version (ground truth):
private long calcChecksum(InputStream in) throws IOException {
  CRC32 crc=new CRC32();
  int len=buffer.length;
  int count=-1;
  int haveRead=0;
  while ((count=in.read(buffer,0,len)) > 0) {
    haveRead+=count;
    crc.update(buffer,0,count);
  }
  in.close();
  return crc.getValue();
}
Program: 64259
Project: 64259
Buggy source:
private void addFile(ZipOutputStream output,File file,String prefix,boolean compress) throws IOException {
  long checksum=0;
  if (!file.exists()) {
    return;
  }
  ZipEntry entry=new ZipEntry(getEntryName(file,prefix));
  entry.setTime(file.lastModified());
  entry.setSize(file.length());
  if (!compress) {
    entry.setCrc(calcChecksum(file));
  }
  FileInputStream input=new FileInputStream(file);
  addToOutputStream(output,input,entry);
}

Fixed version (ground truth):
private void addFile(ZipOutputStream output,File file,String prefix,boolean compress) throws IOException {
  if (!file.exists()) {
    return;
  }
  ZipEntry entry=new ZipEntry(getEntryName(file,prefix));
  entry.setTime(file.lastModified());
  entry.setSize(file.length());
  if (!compress) {
    entry.setCrc(calcChecksum(file));
  }
  FileInputStream input=new FileInputStream(file);
  addToOutputStream(output,input,entry);
}
Program: 64262
Project: 64262
Buggy source:
public ClassFile(InputStream is) throws IOException {
  DataInputStream dis=new DataInputStream(is);
  ConstantPool constantPool=new ConstantPool();
  int magic=dis.readInt();
  int minor=dis.readShort();
  int major=dis.readShort();
  constantPool.read(dis);
  constantPool.resolve();
  access_flags=dis.readShort();
  int this_class=dis.readShort();
  fullname=((ClassCPInfo)constantPool.getEntry(this_class)).getClassName().replace('/','.');
  int super_class=dis.readShort();
  int count=dis.readShort();
  dis.skipBytes(count * 2);
  int numFields=dis.readShort();
  for (int i=0; i < numFields; i++) {
    dis.skip(2 * 3);
    int attributes_count=dis.readUnsignedShort();
    for (int j=0; j < attributes_count; j++) {
      dis.skipBytes(2);
      int len=dis.readInt();
      dis.skipBytes(len);
    }
  }
  int method_count=dis.readShort();
  methods=new MethodInfo[method_count];
  for (int i=0; i < method_count; i++) {
    methods[i]=new MethodInfo();
    methods[i].read(constantPool,dis);
  }
  int attributes_count=dis.readUnsignedShort();
  for (int j=0; j < attributes_count; j++) {
    int attr_id=dis.readShort();
    int len=dis.readInt();
    String attr_name=Utils.getUTF8Value(constantPool,attr_id);
    if (AttributeInfo.SOURCE_FILE.equals(attr_name)) {
      int name_index=dis.readShort();
      sourceFile=((Utf8CPInfo)constantPool.getEntry(name_index)).getValue();
    }
 else {
      dis.skipBytes(len);
    }
  }
}

Fixed version (ground truth):
public ClassFile(InputStream is) throws IOException {
  DataInputStream dis=new DataInputStream(is);
  ConstantPool constantPool=new ConstantPool();
  dis.readInt();
  dis.readShort();
  dis.readShort();
  constantPool.read(dis);
  constantPool.resolve();
  access_flags=dis.readShort();
  int this_class=dis.readShort();
  fullname=((ClassCPInfo)constantPool.getEntry(this_class)).getClassName().replace('/','.');
  dis.readShort();
  int count=dis.readShort();
  dis.skipBytes(count * 2);
  int numFields=dis.readShort();
  for (int i=0; i < numFields; i++) {
    dis.skip(2 * 3);
    int attributes_count=dis.readUnsignedShort();
    for (int j=0; j < attributes_count; j++) {
      dis.skipBytes(2);
      int len=dis.readInt();
      dis.skipBytes(len);
    }
  }
  int method_count=dis.readShort();
  methods=new MethodInfo[method_count];
  for (int i=0; i < method_count; i++) {
    methods[i]=new MethodInfo();
    methods[i].read(constantPool,dis);
  }
  int attributes_count=dis.readUnsignedShort();
  for (int j=0; j < attributes_count; j++) {
    int attr_id=dis.readShort();
    int len=dis.readInt();
    String attr_name=Utils.getUTF8Value(constantPool,attr_id);
    if (AttributeInfo.SOURCE_FILE.equals(attr_name)) {
      int name_index=dis.readShort();
      sourceFile=((Utf8CPInfo)constantPool.getEntry(name_index)).getValue();
    }
 else {
      dis.skipBytes(len);
    }
  }
}
Program: 64263
Project: 64263
Buggy source:
public PlanarImage executeTransformOperation(PlanarImage image){
  BufferedImage bi=image.getAsBufferedImage();
  Graphics2D graphics=(Graphics2D)bi.getGraphics();
  for (int i=0; i < instructions.size(); i++) {
    ImageOperation instr=((ImageOperation)instructions.elementAt(i));
    if (instr instanceof DrawOperation) {
      PlanarImage op=((DrawOperation)instr).executeDrawOperation();
      log("String_Node_Str" + xloc + "String_Node_Str"+ yloc);
      graphics.drawImage(op.getAsBufferedImage(),null,xloc,yloc);
    }
 else     if (instr instanceof TransformOperation) {
      PlanarImage op=((TransformOperation)instr).executeTransformOperation(null);
      BufferedImage child=op.getAsBufferedImage();
      log("String_Node_Str" + xloc + "String_Node_Str"+ yloc);
      graphics.drawImage(child,null,xloc,yloc);
      PlanarImage test=PlanarImage.wrapRenderedImage(bi);
    }
  }
  image=PlanarImage.wrapRenderedImage(bi);
  return image;
}

Fixed version (ground truth):
public PlanarImage executeTransformOperation(PlanarImage image){
  BufferedImage bi=image.getAsBufferedImage();
  Graphics2D graphics=(Graphics2D)bi.getGraphics();
  for (int i=0; i < instructions.size(); i++) {
    ImageOperation instr=((ImageOperation)instructions.elementAt(i));
    if (instr instanceof DrawOperation) {
      PlanarImage op=((DrawOperation)instr).executeDrawOperation();
      log("String_Node_Str" + xloc + "String_Node_Str"+ yloc);
      graphics.drawImage(op.getAsBufferedImage(),null,xloc,yloc);
    }
 else     if (instr instanceof TransformOperation) {
      PlanarImage op=((TransformOperation)instr).executeTransformOperation(null);
      BufferedImage child=op.getAsBufferedImage();
      log("String_Node_Str" + xloc + "String_Node_Str"+ yloc);
      graphics.drawImage(child,null,xloc,yloc);
      PlanarImage.wrapRenderedImage(bi);
    }
  }
  image=PlanarImage.wrapRenderedImage(bi);
  return image;
}
Program: 64265
Project: 64265
Buggy source:
public AncestorAnalyzer(){
  try {
    ClassParser parser=new ClassParser("String_Node_Str");
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
public AncestorAnalyzer(){
  try {
    new ClassParser("String_Node_Str");
  }
 catch (  IOException e) {
  }
}
Program: 64266
Project: 64266
Buggy source:
public FullAnalyzer(){
  try {
    ClassParser parser=new ClassParser("String_Node_Str");
  }
 catch (  IOException e) {
  }
}

Fixed version (ground truth):
public FullAnalyzer(){
  try {
    new ClassParser("String_Node_Str");
  }
 catch (  IOException e) {
  }
}
Program: 64267
Project: 64267
Buggy source:
/** 
 * Parse an octal integer from a header buffer.
 * @param header The header buffer from which to parse.
 * @param offset The offset into the buffer from which to parse.
 * @param length The number of header bytes to parse.
 * @return The integer value of the octal bytes.
 */
public static int getOctalBytes(long value,byte[] buf,int offset,int length){
  byte[] result=new byte[length];
  int idx=length - 1;
  buf[offset + idx]=0;
  --idx;
  buf[offset + idx]=(byte)' ';
  --idx;
  if (value == 0) {
    buf[offset + idx]=(byte)'0';
    --idx;
  }
 else {
    for (long val=value; idx >= 0 && val > 0; --idx) {
      buf[offset + idx]=(byte)((byte)'0' + (byte)(val & 7));
      val=val >> 3;
    }
  }
  for (; idx >= 0; --idx) {
    buf[offset + idx]=(byte)' ';
  }
  return offset + length;
}

Fixed version (ground truth):
/** 
 * Parse an octal integer from a header buffer.
 * @param header The header buffer from which to parse.
 * @param offset The offset into the buffer from which to parse.
 * @param length The number of header bytes to parse.
 * @return The integer value of the octal bytes.
 */
public static int getOctalBytes(long value,byte[] buf,int offset,int length){
  int idx=length - 1;
  buf[offset + idx]=0;
  --idx;
  buf[offset + idx]=(byte)' ';
  --idx;
  if (value == 0) {
    buf[offset + idx]=(byte)'0';
    --idx;
  }
 else {
    for (long val=value; idx >= 0 && val > 0; --idx) {
      buf[offset + idx]=(byte)((byte)'0' + (byte)(val & 7));
      val=val >> 3;
    }
  }
  for (; idx >= 0; --idx) {
    buf[offset + idx]=(byte)' ';
  }
  return offset + length;
}
Program: 64268
Project: 64268
Buggy source:
protected void nextLine() throws BuildException {
  int ch=-1;
  int eolcount=0;
  eolStr.setLength(0);
  line.setLength(0);
  try {
    ch=reader.read();
    while (ch != -1 && ch != '\r' && ch != '\n') {
      line.append((char)ch);
      ch=reader.read();
    }
    if (ch == -1 && line.length() == 0) {
      reachedEof=true;
      return;
    }
switch ((char)ch) {
case '\r':
      ++eolcount;
    eolStr.append('\r');
  reader.mark(2);
switch ((ch=reader.read())) {
case '\r':
  if ((char)(ch=reader.read()) == '\n') {
    eolcount+=2;
    eolStr.append("String_Node_Str");
  }
 else {
    reader.reset();
  }
break;
case '\n':
++eolcount;
eolStr.append('\n');
break;
case -1:
break;
default :
reader.reset();
break;
}
break;
case '\n':
++eolcount;
eolStr.append('\n');
break;
}
if (eolcount == 0) {
int i=line.length();
while (--i >= 0 && line.charAt(i) == CTRLZ) {
}
if (i < line.length() - 1) {
eofStr.append(line.toString().substring(i + 1));
if (i < 0) {
line.setLength(0);
reachedEof=true;
}
 else {
line.setLength(i + 1);
}
}
}
}
 catch (IOException e) {
throw new BuildException(e);
}
}

Fixed version (ground truth):
protected void nextLine() throws BuildException {
  int ch=-1;
  int eolcount=0;
  eolStr.setLength(0);
  line.setLength(0);
  try {
    ch=reader.read();
    while (ch != -1 && ch != '\r' && ch != '\n') {
      line.append((char)ch);
      ch=reader.read();
    }
    if (ch == -1 && line.length() == 0) {
      reachedEof=true;
      return;
    }
switch ((char)ch) {
case '\r':
      ++eolcount;
    eolStr.append('\r');
  reader.mark(2);
switch ((ch=reader.read())) {
case '\r':
  if ((char)(ch=reader.read()) == '\n') {
    eolcount+=2;
    eolStr.append("String_Node_Str");
  }
 else {
    reader.reset();
  }
break;
case '\n':
++eolcount;
eolStr.append('\n');
break;
case -1:
break;
default :
reader.reset();
break;
}
break;
case '\n':
++eolcount;
eolStr.append('\n');
break;
}
if (eolcount == 0) {
int i=line.length();
while (--i >= 0 && line.charAt(i) == CTRLZ) {
}
if (i < line.length() - 1) {
eofStr.append(line.toString().substring(i + 1));
if (i < 0) {
line.setLength(0);
reachedEof=true;
}
 else {
line.setLength(i + 1);
}
}
}
}
 catch (IOException e) {
throw new BuildException(srcFile + "String_Node_Str" + e.getMessage(),e,getLocation());
}
}
Program: 64269
Project: 64269
Buggy source:
public OneLiner(File srcFile) throws BuildException {
  try {
    reader=new BufferedReader(getReader(srcFile),INBUFLEN);
    nextLine();
  }
 catch (  IOException e) {
    throw new BuildException(e);
  }
}

Fixed version (ground truth):
public OneLiner(File srcFile) throws BuildException {
  this.srcFile=srcFile;
  try {
    reader=new BufferedReader(getReader(srcFile),INBUFLEN);
    nextLine();
  }
 catch (  IOException e) {
    throw new BuildException(srcFile + "String_Node_Str" + e.getMessage(),e,getLocation());
  }
}
Program: 64270
Project: 64270
Buggy source:
/** 
 * Writes a formatted list of target names to <code>System.out</code> with an optional description.
 * @param names The names to be printed.Must not be <code>null</code>.
 * @param descriptions The associated target descriptions.May be <code>null</code>, in which case no descriptions are displayed. If non-<code>null</code>, this should have as many elements as <code>names</code>.
 * @param heading The heading to display.Should not be <code>null</code>.
 * @param maxlen The maximum length of the names of the targets.If descriptions are given, they are padded to this position so they line up (so long as the names really <i>are</i> shorter than this).
 */
private static void printTargets(Project project,Vector names,Vector descriptions,String heading,int maxlen){
  String lSep=System.getProperty("String_Node_Str");
  String spaces="String_Node_Str";
  while (spaces.length() < maxlen) {
    spaces+=spaces;
  }
  StringBuffer msg=new StringBuffer();
  msg.append(heading + lSep + lSep);
  for (int i=0; i < names.size(); i++) {
    msg.append("String_Node_Str");
    msg.append(names.elementAt(i));
    if (descriptions != null) {
      msg.append(spaces.substring(0,maxlen - ((String)names.elementAt(i)).length() + 2));
      msg.append(descriptions.elementAt(i));
    }
    msg.append(lSep);
  }
  project.log(msg.toString());
}

Fixed version (ground truth):
/** 
 * Writes a formatted list of target names to <code>System.out</code> with an optional description.
 * @param names The names to be printed.Must not be <code>null</code>.
 * @param descriptions The associated target descriptions.May be <code>null</code>, in which case no descriptions are displayed. If non-<code>null</code>, this should have as many elements as <code>names</code>.
 * @param heading The heading to display.Should not be <code>null</code>.
 * @param maxlen The maximum length of the names of the targets.If descriptions are given, they are padded to this position so they line up (so long as the names really <i>are</i> shorter than this).
 */
private static void printTargets(Project project,Vector names,Vector descriptions,String heading,int maxlen){
  String lSep=System.getProperty("String_Node_Str");
  String spaces="String_Node_Str";
  while (spaces.length() <= maxlen) {
    spaces+=spaces;
  }
  StringBuffer msg=new StringBuffer();
  msg.append(heading + lSep + lSep);
  for (int i=0; i < names.size(); i++) {
    msg.append("String_Node_Str");
    msg.append(names.elementAt(i));
    if (descriptions != null) {
      msg.append(spaces.substring(0,maxlen - ((String)names.elementAt(i)).length() + 2));
      msg.append(descriptions.elementAt(i));
    }
    msg.append(lSep);
  }
  project.log(msg.toString());
}
Program: 64271
Project: 64271
Buggy source:
/** 
 * our execute method
 */
public boolean execute() throws BuildException {
  getJspc().log("String_Node_Str",Project.MSG_VERBOSE);
  CommandlineJava cmd=setupJasperCommand();
  try {
    Java java=(Java)(getProject().createTask("String_Node_Str"));
    if (getJspc().getClasspath() != null) {
      java.setClasspath(getJspc().getClasspath());
    }
 else {
      Path classpath=new Path(getProject());
      classpath.concatSystemClasspath();
      java.setClasspath(classpath);
    }
    java.setDir(getProject().getBaseDir());
    java.setClassname("String_Node_Str");
    String args[]=cmd.getJavaCommand().getArguments();
    for (int i=0; i < args.length; i++) {
      java.createArg().setValue(args[i]);
    }
    java.setFailonerror(getJspc().getFailonerror());
    java.setFork(true);
    java.execute();
    return true;
  }
 catch (  Exception ex) {
    if (ex instanceof BuildException) {
      throw (BuildException)ex;
    }
 else {
      throw new BuildException("String_Node_Str",ex,getJspc().getLocation());
    }
  }
 finally {
    getJspc().deleteEmptyJavaFiles();
  }
}

Fixed version (ground truth):
/** 
 * our execute method
 */
public boolean execute() throws BuildException {
  getJspc().log("String_Node_Str",Project.MSG_VERBOSE);
  CommandlineJava cmd=setupJasperCommand();
  try {
    Java java=(Java)(getProject().createTask("String_Node_Str"));
    if (getJspc().getClasspath() != null) {
      getProject().log("String_Node_Str" + getJspc().getClasspath(),Project.MSG_DEBUG);
      java.setClasspath(getJspc().getClasspath());
    }
 else {
      Path classpath=new Path(getProject());
      classpath=classpath.concatSystemClasspath("String_Node_Str");
      getProject().log("String_Node_Str" + classpath,Project.MSG_DEBUG);
      java.setClasspath(classpath);
    }
    java.setDir(getProject().getBaseDir());
    java.setClassname("String_Node_Str");
    String args[]=cmd.getJavaCommand().getArguments();
    for (int i=0; i < args.length; i++) {
      java.createArg().setValue(args[i]);
    }
    java.setFailonerror(getJspc().getFailonerror());
    java.setFork(true);
    java.setTaskName("String_Node_Str");
    java.execute();
    return true;
  }
 catch (  Exception ex) {
    if (ex instanceof BuildException) {
      throw (BuildException)ex;
    }
 else {
      throw new BuildException("String_Node_Str",ex,getJspc().getLocation());
    }
  }
 finally {
    getJspc().deleteEmptyJavaFiles();
  }
}
Program: 64272
Project: 64272
Buggy source:
/** 
 * Removes a leading path from a second path.
 * @param leading The leading path, must not be null, must be absolute.
 * @param path The path to remove from, must not be null, must be absolute.
 * @return path's normalized absolute if it doesn't start withleading, path's path with leading's path removed otherwise.
 * @since Ant 1.5
 */
public String removeLeadingPath(File leading,File path){
  String l=normalize(leading.getAbsolutePath()).getAbsolutePath();
  String p=normalize(path.getAbsolutePath()).getAbsolutePath();
  if (p.startsWith(l)) {
    String result=p.substring(l.length());
    if (result.startsWith(File.separator)) {
      result=result.substring(File.separator.length());
    }
    return result;
  }
 else {
    return p;
  }
}

Fixed version (ground truth):
/** 
 * Removes a leading path from a second path.
 * @param leading The leading path, must not be null, must be absolute.
 * @param path The path to remove from, must not be null, must be absolute.
 * @return path's normalized absolute if it doesn't start withleading, path's path with leading's path removed otherwise.
 * @since Ant 1.5
 */
public String removeLeadingPath(File leading,File path){
  String l=normalize(leading.getAbsolutePath()).getAbsolutePath() + File.separator;
  String p=normalize(path.getAbsolutePath()).getAbsolutePath();
  if (p.startsWith(l)) {
    return p.substring(l.length());
  }
 else {
    return p;
  }
}