Program: 64240
Project: 64240
Buggy source:
public void executeMain() throws BuildException {
  if (baseDir == null && filesets.size() == 0 && groupfilesets.size() == 0 && "String_Node_Str".equals(archiveType)) {
    throw new BuildException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  if (zipFile == null) {
    throw new BuildException("String_Node_Str" + archiveType + "String_Node_Str");
  }
  File renamedFile=null;
  addingNewFiles=true;
  doUpdate=doUpdate && zipFile.exists();
  for (int i=0; i < groupfilesets.size(); i++) {
    log("String_Node_Str",Project.MSG_VERBOSE);
    FileSet fs=(FileSet)groupfilesets.elementAt(i);
    FileScanner scanner=fs.getDirectoryScanner(getProject());
    String[] files=scanner.getIncludedFiles();
    File basedir=scanner.getBasedir();
    for (int j=0; j < files.length; j++) {
      log("String_Node_Str" + files[j] + "String_Node_Str",Project.MSG_VERBOSE);
      ZipFileSet zf=new ZipFileSet();
      zf.setSrc(new File(basedir,files[j]));
      filesets.addElement(zf);
      filesetsFromGroupfilesets.addElement(zf);
    }
  }
  Vector vfss=new Vector();
  if (baseDir != null) {
    FileSet fs=(FileSet)getImplicitFileSet().clone();
    fs.setDir(baseDir);
    vfss.addElement(fs);
  }
  for (int i=0; i < filesets.size(); i++) {
    FileSet fs=(FileSet)filesets.elementAt(i);
    vfss.addElement(fs);
  }
  FileSet[] fss=new FileSet[vfss.size()];
  vfss.copyInto(fss);
  boolean success=false;
  try {
    Resource[][] addThem=getResourcesToAdd(fss,zipFile,false);
    if (isEmpty(addThem)) {
      return;
    }
    if (doUpdate) {
      renamedFile=fileUtils.createTempFile("String_Node_Str","String_Node_Str",fileUtils.getParentFile(zipFile));
      try {
        if (!zipFile.renameTo(renamedFile)) {
          throw new BuildException("String_Node_Str" + "String_Node_Str");
        }
      }
 catch (      SecurityException e) {
        throw new BuildException("String_Node_Str" + "String_Node_Str");
      }
    }
    String action=doUpdate ? "String_Node_Str" : "String_Node_Str";
    log(action + archiveType + "String_Node_Str"+ zipFile.getAbsolutePath());
    ZipOutputStream zOut=null;
    try {
      if (!skipWriting) {
        zOut=new ZipOutputStream(new FileOutputStream(zipFile));
        zOut.setEncoding(encoding);
        if (doCompress) {
          zOut.setMethod(ZipOutputStream.DEFLATED);
        }
 else {
          zOut.setMethod(ZipOutputStream.STORED);
        }
      }
      initZipOutputStream(zOut);
      for (int i=0; i < fss.length; i++) {
        if (addThem[i].length != 0) {
          addResources(fss[i],addThem[i],zOut);
        }
      }
      if (doUpdate) {
        addingNewFiles=false;
        ZipFileSet oldFiles=new ZipFileSet();
        oldFiles.setSrc(renamedFile);
        for (int i=0; i < addedFiles.size(); i++) {
          PatternSet.NameEntry ne=oldFiles.createExclude();
          ne.setName((String)addedFiles.elementAt(i));
        }
        DirectoryScanner ds=oldFiles.getDirectoryScanner(getProject());
        String[] f=ds.getIncludedFiles();
        Resource[] r=new Resource[f.length];
        for (int i=0; i < f.length; i++) {
          r[i]=ds.getResource(f[i]);
        }
        addResources(oldFiles,r,zOut);
      }
      finalizeZipOutputStream(zOut);
      if (doUpdate) {
        if (!renamedFile.delete()) {
          log("String_Node_Str" + renamedFile.getName(),Project.MSG_WARN);
        }
      }
      success=true;
    }
  finally {
      try {
        if (zOut != null) {
          zOut.close();
        }
      }
 catch (      IOException ex) {
        if (success) {
          throw ex;
        }
      }
    }
  }
 catch (  IOException ioe) {
    String msg="String_Node_Str" + archiveType + "String_Node_Str"+ ioe.getMessage();
    if ((!doUpdate || renamedFile != null) && !zipFile.delete()) {
      msg+="String_Node_Str" + "String_Node_Str";
    }
    if (doUpdate && renamedFile != null) {
      if (!renamedFile.renameTo(zipFile)) {
        msg+="String_Node_Str" + renamedFile.getName() + "String_Node_Str";
      }
    }
    throw new BuildException(msg,ioe,getLocation());
  }
 finally {
    cleanUp();
  }
}

Fixed version (ground truth):
public void executeMain() throws BuildException {
  if (baseDir == null && filesets.size() == 0 && groupfilesets.size() == 0 && "String_Node_Str".equals(archiveType)) {
    throw new BuildException("String_Node_Str" + "String_Node_Str" + "String_Node_Str");
  }
  if (zipFile == null) {
    throw new BuildException("String_Node_Str" + archiveType + "String_Node_Str");
  }
  File renamedFile=null;
  addingNewFiles=true;
  if (doUpdate && !zipFile.exists()) {
    doUpdate=false;
    log("String_Node_Str" + archiveType + "String_Node_Str",Project.MSG_DEBUG);
  }
  for (int i=0; i < groupfilesets.size(); i++) {
    log("String_Node_Str",Project.MSG_VERBOSE);
    FileSet fs=(FileSet)groupfilesets.elementAt(i);
    FileScanner scanner=fs.getDirectoryScanner(getProject());
    String[] files=scanner.getIncludedFiles();
    File basedir=scanner.getBasedir();
    for (int j=0; j < files.length; j++) {
      log("String_Node_Str" + files[j] + "String_Node_Str",Project.MSG_VERBOSE);
      ZipFileSet zf=new ZipFileSet();
      zf.setSrc(new File(basedir,files[j]));
      filesets.addElement(zf);
      filesetsFromGroupfilesets.addElement(zf);
    }
  }
  Vector vfss=new Vector();
  if (baseDir != null) {
    FileSet fs=(FileSet)getImplicitFileSet().clone();
    fs.setDir(baseDir);
    vfss.addElement(fs);
  }
  for (int i=0; i < filesets.size(); i++) {
    FileSet fs=(FileSet)filesets.elementAt(i);
    vfss.addElement(fs);
  }
  FileSet[] fss=new FileSet[vfss.size()];
  vfss.copyInto(fss);
  boolean success=false;
  try {
    ArchiveState state=getResourcesToAdd(fss,zipFile,false);
    if (!state.isOutOfDate()) {
      return;
    }
    Resource[][] addThem=state.getResourcesToAdd();
    if (doUpdate) {
      renamedFile=fileUtils.createTempFile("String_Node_Str","String_Node_Str",fileUtils.getParentFile(zipFile));
      try {
        if (!zipFile.renameTo(renamedFile)) {
          throw new BuildException("String_Node_Str" + "String_Node_Str");
        }
      }
 catch (      SecurityException e) {
        throw new BuildException("String_Node_Str" + "String_Node_Str");
      }
    }
    String action=doUpdate ? "String_Node_Str" : "String_Node_Str";
    log(action + archiveType + "String_Node_Str"+ zipFile.getAbsolutePath());
    ZipOutputStream zOut=null;
    try {
      if (!skipWriting) {
        zOut=new ZipOutputStream(new FileOutputStream(zipFile));
        zOut.setEncoding(encoding);
        if (doCompress) {
          zOut.setMethod(ZipOutputStream.DEFLATED);
        }
 else {
          zOut.setMethod(ZipOutputStream.STORED);
        }
      }
      initZipOutputStream(zOut);
      for (int i=0; i < fss.length; i++) {
        if (addThem[i].length != 0) {
          addResources(fss[i],addThem[i],zOut);
        }
      }
      if (doUpdate) {
        addingNewFiles=false;
        ZipFileSet oldFiles=new ZipFileSet();
        oldFiles.setSrc(renamedFile);
        for (int i=0; i < addedFiles.size(); i++) {
          PatternSet.NameEntry ne=oldFiles.createExclude();
          ne.setName((String)addedFiles.elementAt(i));
        }
        DirectoryScanner ds=oldFiles.getDirectoryScanner(getProject());
        String[] f=ds.getIncludedFiles();
        Resource[] r=new Resource[f.length];
        for (int i=0; i < f.length; i++) {
          r[i]=ds.getResource(f[i]);
        }
        addResources(oldFiles,r,zOut);
      }
      finalizeZipOutputStream(zOut);
      if (doUpdate) {
        if (!renamedFile.delete()) {
          log("String_Node_Str" + renamedFile.getName(),Project.MSG_WARN);
        }
      }
      success=true;
    }
  finally {
      try {
        if (zOut != null) {
          zOut.close();
        }
      }
 catch (      IOException ex) {
        if (success) {
          throw ex;
        }
      }
    }
  }
 catch (  IOException ioe) {
    String msg="String_Node_Str" + archiveType + "String_Node_Str"+ ioe.getMessage();
    if ((!doUpdate || renamedFile != null) && !zipFile.delete()) {
      msg+="String_Node_Str" + "String_Node_Str";
    }
    if (doUpdate && renamedFile != null) {
      if (!renamedFile.renameTo(zipFile)) {
        msg+="String_Node_Str" + renamedFile.getName() + "String_Node_Str";
      }
    }
    throw new BuildException(msg,ioe,getLocation());
  }
 finally {
    cleanUp();
  }
}