Program: 40988
Project: 40988
Buggy source:
/** 
 * Exports the given BuildPlan to the given URI location
 * @param destination the URI to export to
 * @param buildPlan the BuildPlan to export
 * @return true iff exporting the BuildPlan was successful
 * @throws IOException is thrown when reading/writing the file fails
 * @throws JAXBException is thrown when writing with JAXB fails
 */
public boolean export(URI destination,BuildPlan buildPlan) throws IOException, JAXBException {
  if (!new File(destination).getName().contains("String_Node_Str")) {
    return false;
  }
  List<File> importedFiles=buildPlan.getImportedFiles();
  SimpleFileExporter.LOG.debug("String_Node_Str");
  for (  File file : importedFiles) {
    SimpleFileExporter.LOG.debug(file.getAbsolutePath());
  }
  List<Element> importElements=buildPlan.getBpelImportElements();
  SimpleFileExporter.LOG.debug("String_Node_Str");
  for (  Element element : importElements) {
    SimpleFileExporter.LOG.debug("String_Node_Str" + element.getLocalName());
    SimpleFileExporter.LOG.debug("String_Node_Str" + element.getAttribute("String_Node_Str"));
  }
  GenericWsdlWrapper wsdl=buildPlan.getWsdl();
  File tempDir=FileUtils.getTempDirectory();
  SimpleFileExporter.LOG.debug("String_Node_Str" + tempDir.getAbsolutePath());
  File tempFolder=new File(tempDir,Long.toString(System.currentTimeMillis()));
  tempFolder.mkdir();
  SimpleFileExporter.LOG.debug("String_Node_Str" + tempFolder.getAbsolutePath());
  List<File> exportedFiles=new ArrayList<File>();
  for (  File importedFile : importedFiles) {
    for (    Element importElement : importElements) {
      String filePath=importedFile.getAbsolutePath();
      String locationPath=importElement.getAttribute("String_Node_Str");
      SimpleFileExporter.LOG.debug("String_Node_Str");
      SimpleFileExporter.LOG.debug(filePath);
      SimpleFileExporter.LOG.debug("String_Node_Str");
      SimpleFileExporter.LOG.debug(locationPath);
      if (importedFile.getAbsolutePath().trim().equals(importElement.getAttribute("String_Node_Str").trim())) {
        String fileName=importedFile.getName();
        SimpleFileExporter.LOG.debug("String_Node_Str" + fileName);
        importElement.setAttribute("String_Node_Str",fileName);
        File fileLocationInDir=new File(tempFolder,fileName);
        FileUtils.copyFile(importedFile,fileLocationInDir);
        exportedFiles.add(fileLocationInDir);
      }
    }
  }
  SimpleFileExporter.LOG.debug("String_Node_Str");
  Deploy deployment=buildPlan.getDeploymentDeskriptor();
  try {
    this.rewriteServiceNames(deployment,exportedFiles,buildPlan.getCsarName());
  }
 catch (  WSDLException e) {
    LOG.warn("String_Node_Str",e);
  }
catch (  FileNotFoundException e) {
    LOG.warn("String_Node_Str",e);
  }
  File deployXmlFile=new File(tempFolder,"String_Node_Str");
  deployXmlFile.createNewFile();
  JAXBContext jaxbContext=JAXBContext.newInstance(Deploy.class);
  Marshaller m=jaxbContext.createMarshaller();
  m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
  m.marshal(deployment,deployXmlFile);
  File wsdlFile=new File(tempFolder,wsdl.getFileName());
  FileUtils.writeStringToFile(wsdlFile,wsdl.getFinalizedWsdlAsString());
  File bpelFile=new File(tempFolder,wsdl.getFileName().replace("String_Node_Str","String_Node_Str"));
  try {
    this.writeBPELDocToFile(bpelFile,buildPlan.getBpelDocument());
  }
 catch (  TransformerException e) {
    SimpleFileExporter.LOG.error("String_Node_Str",e);
    return false;
  }
  ServiceReference<?> servRef=FrameworkUtil.getBundle(this.getClass()).getBundleContext().getServiceReference(IFileAccessService.class.getName());
  IFileAccessService service=(IFileAccessService)FrameworkUtil.getBundle(this.getClass()).getBundleContext().getService(servRef);
  service.zip(tempFolder,new File(destination));
  return true;
}

Fixed version (ground truth):
/** 
 * Exports the given BuildPlan to the given URI location
 * @param destination the URI to export to
 * @param buildPlan the BuildPlan to export
 * @return true iff exporting the BuildPlan was successful
 * @throws IOException is thrown when reading/writing the file fails
 * @throws JAXBException is thrown when writing with JAXB fails
 */
public boolean export(URI destination,BuildPlan buildPlan) throws IOException, JAXBException {
  if (!new File(destination).getName().contains("String_Node_Str")) {
    return false;
  }
  List<File> importedFiles=buildPlan.getImportedFiles();
  SimpleFileExporter.LOG.debug("String_Node_Str");
  for (  File file : importedFiles) {
    SimpleFileExporter.LOG.debug(file.getAbsolutePath());
  }
  List<Element> importElements=buildPlan.getBpelImportElements();
  SimpleFileExporter.LOG.debug("String_Node_Str");
  for (  Element element : importElements) {
    SimpleFileExporter.LOG.debug("String_Node_Str" + element.getLocalName());
    SimpleFileExporter.LOG.debug("String_Node_Str" + element.getAttribute("String_Node_Str"));
  }
  GenericWsdlWrapper wsdl=buildPlan.getWsdl();
  File tempDir=this.getFileAccessService().getTemp();
  SimpleFileExporter.LOG.debug("String_Node_Str" + tempDir.getAbsolutePath());
  File tempFolder=new File(tempDir,Long.toString(System.currentTimeMillis()));
  tempFolder.mkdir();
  SimpleFileExporter.LOG.debug("String_Node_Str" + tempFolder.getAbsolutePath());
  List<File> exportedFiles=new ArrayList<File>();
  for (  File importedFile : importedFiles) {
    for (    Element importElement : importElements) {
      String filePath=importedFile.getAbsolutePath();
      String locationPath=importElement.getAttribute("String_Node_Str");
      SimpleFileExporter.LOG.debug("String_Node_Str");
      SimpleFileExporter.LOG.debug(filePath);
      SimpleFileExporter.LOG.debug("String_Node_Str");
      SimpleFileExporter.LOG.debug(locationPath);
      if (importedFile.getAbsolutePath().trim().equals(importElement.getAttribute("String_Node_Str").trim())) {
        String fileName=importedFile.getName();
        SimpleFileExporter.LOG.debug("String_Node_Str" + fileName);
        importElement.setAttribute("String_Node_Str",fileName);
        File fileLocationInDir=new File(tempFolder,fileName);
        FileUtils.copyFile(importedFile,fileLocationInDir);
        exportedFiles.add(fileLocationInDir);
      }
    }
  }
  SimpleFileExporter.LOG.debug("String_Node_Str");
  Deploy deployment=buildPlan.getDeploymentDeskriptor();
  try {
    this.rewriteServiceNames(deployment,exportedFiles,buildPlan.getCsarName());
  }
 catch (  WSDLException e) {
    LOG.warn("String_Node_Str",e);
  }
catch (  FileNotFoundException e) {
    LOG.warn("String_Node_Str",e);
  }
  File deployXmlFile=new File(tempFolder,"String_Node_Str");
  deployXmlFile.createNewFile();
  JAXBContext jaxbContext=JAXBContext.newInstance(Deploy.class);
  Marshaller m=jaxbContext.createMarshaller();
  m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,true);
  m.marshal(deployment,deployXmlFile);
  File wsdlFile=new File(tempFolder,wsdl.getFileName());
  FileUtils.writeStringToFile(wsdlFile,wsdl.getFinalizedWsdlAsString());
  File bpelFile=new File(tempFolder,wsdl.getFileName().replace("String_Node_Str","String_Node_Str"));
  try {
    this.writeBPELDocToFile(bpelFile,buildPlan.getBpelDocument());
  }
 catch (  TransformerException e) {
    SimpleFileExporter.LOG.error("String_Node_Str",e);
    return false;
  }
  ServiceReference<?> servRef=FrameworkUtil.getBundle(this.getClass()).getBundleContext().getServiceReference(IFileAccessService.class.getName());
  IFileAccessService service=(IFileAccessService)FrameworkUtil.getBundle(this.getClass()).getBundleContext().getService(servRef);
  service.zip(tempFolder,new File(destination));
  return true;
}