Program: 106196
Project: 106196
Buggy source:
protected Answer copyFromS3ToNfs(CopyCommand cmd,DataTO srcData,S3TO s3,DataTO destData,NfsTO destImageStore){
  final String storagePath=destImageStore.getUrl();
  final String destPath=destData.getPath();
  try {
    String downloadPath=determineStorageTemplatePath(storagePath,destPath);
    final File downloadDirectory=_storage.getFile(downloadPath);
    downloadDirectory.mkdirs();
    if (!downloadDirectory.exists()) {
      final String errMsg="String_Node_Str" + downloadPath + "String_Node_Str";
      s_logger.error(errMsg);
      return new CopyCmdAnswer(errMsg);
    }
 else {
      s_logger.debug("String_Node_Str" + downloadPath + "String_Node_Str");
    }
    List<File> files=getDirectory(s3,s3.getBucketName(),destPath,downloadDirectory,new FileNamingStrategy(){
      @Override public String determineFileName(      final String key){
        return substringAfterLast(key,S3Utils.SEPARATOR);
      }
    }
);
    File destFile=null;
    for (    File f : files) {
      if (!f.getName().endsWith("String_Node_Str")) {
        destFile=f;
        break;
      }
    }
    if (destFile == null) {
      return new CopyCmdAnswer("String_Node_Str");
    }
    String scriptsDir="String_Node_Str";
    String createTmpltScr=Script.findScript(scriptsDir,"String_Node_Str");
    if (createTmpltScr == null) {
      throw new ConfigurationException("String_Node_Str");
    }
    s_logger.info("String_Node_Str" + createTmpltScr);
    String createVolScr=Script.findScript(scriptsDir,"String_Node_Str");
    if (createVolScr == null) {
      throw new ConfigurationException("String_Node_Str");
    }
    s_logger.info("String_Node_Str" + createVolScr);
    String script=srcData.getObjectType() == DataObjectType.TEMPLATE ? createTmpltScr : createVolScr;
    int installTimeoutPerGig=180 * 60 * 1000;
    int imgSizeGigs=(int)Math.ceil(destFile.length() * 1.0d / (1024 * 1024 * 1024));
    imgSizeGigs++;
    long timeout=imgSizeGigs * installTimeoutPerGig;
    String origPath=destFile.getAbsolutePath();
    String extension=null;
    if (srcData.getObjectType() == DataObjectType.TEMPLATE) {
      extension=((TemplateObjectTO)srcData).getFormat().getFileExtension();
    }
 else {
      extension=((VolumeObjectTO)srcData).getFormat().getFileExtension();
    }
    String templateName=UUID.randomUUID().toString();
    String templateFilename=templateName + "String_Node_Str" + extension;
    Script scr=new Script(script,timeout,s_logger);
    scr.add("String_Node_Str",Integer.toString(imgSizeGigs));
    scr.add("String_Node_Str",templateFilename);
    scr.add("String_Node_Str",downloadPath);
    scr.add("String_Node_Str",origPath);
    String result;
    result=scr.execute();
    if (result != null) {
      throw new CloudRuntimeException("String_Node_Str" + script);
    }
    String finalFileName=templateFilename;
    String finalDownloadPath=destPath + File.separator + templateFilename;
    long size=this._storage.getSize(downloadPath + File.separator + templateFilename);
    DataTO newDestTO=null;
    if (destData.getObjectType() == DataObjectType.TEMPLATE) {
      TemplateObjectTO newTemplTO=new TemplateObjectTO();
      newTemplTO.setPath(finalDownloadPath);
      newTemplTO.setName(finalFileName);
      newTemplTO.setSize(size);
      newDestTO=newTemplTO;
    }
 else {
      return new CopyCmdAnswer("String_Node_Str");
    }
    return new CopyCmdAnswer(newDestTO);
  }
 catch (  Exception e) {
    final String errMsg=format("String_Node_Str" + "String_Node_Str",e.getMessage());
    s_logger.error(errMsg,e);
    return new CopyCmdAnswer(errMsg);
  }
}

Fixed version (ground truth):
protected Answer copyFromS3ToNfs(CopyCommand cmd,DataTO srcData,S3TO s3,DataTO destData,NfsTO destImageStore){
  final String storagePath=destImageStore.getUrl();
  final String destPath=destData.getPath();
  try {
    String downloadPath=determineStorageTemplatePath(storagePath,destPath);
    final File downloadDirectory=_storage.getFile(downloadPath);
    downloadDirectory.mkdirs();
    if (!downloadDirectory.exists()) {
      final String errMsg="String_Node_Str" + downloadPath + "String_Node_Str";
      s_logger.error(errMsg);
      return new CopyCmdAnswer(errMsg);
    }
 else {
      s_logger.debug("String_Node_Str" + downloadPath + "String_Node_Str");
    }
    File destFile=S3Utils.getFile(s3,s3.getBucketName(),srcData.getPath(),downloadDirectory,new FileNamingStrategy(){
      @Override public String determineFileName(      final String key){
        return substringAfterLast(key,S3Utils.SEPARATOR);
      }
    }
);
    if (destFile == null) {
      return new CopyCmdAnswer("String_Node_Str");
    }
    String scriptsDir="String_Node_Str";
    String createTmpltScr=Script.findScript(scriptsDir,"String_Node_Str");
    if (createTmpltScr == null) {
      throw new ConfigurationException("String_Node_Str");
    }
    s_logger.info("String_Node_Str" + createTmpltScr);
    String createVolScr=Script.findScript(scriptsDir,"String_Node_Str");
    if (createVolScr == null) {
      throw new ConfigurationException("String_Node_Str");
    }
    s_logger.info("String_Node_Str" + createVolScr);
    String script=srcData.getObjectType() == DataObjectType.TEMPLATE ? createTmpltScr : createVolScr;
    int installTimeoutPerGig=180 * 60 * 1000;
    int imgSizeGigs=(int)Math.ceil(destFile.length() * 1.0d / (1024 * 1024 * 1024));
    imgSizeGigs++;
    long timeout=imgSizeGigs * installTimeoutPerGig;
    String origPath=destFile.getAbsolutePath();
    String extension=null;
    if (srcData.getObjectType() == DataObjectType.TEMPLATE) {
      extension=((TemplateObjectTO)srcData).getFormat().getFileExtension();
    }
 else {
      extension=((VolumeObjectTO)srcData).getFormat().getFileExtension();
    }
    String templateName=UUID.randomUUID().toString();
    String templateFilename=templateName + "String_Node_Str" + extension;
    Script scr=new Script(script,timeout,s_logger);
    scr.add("String_Node_Str",Integer.toString(imgSizeGigs));
    scr.add("String_Node_Str",templateFilename);
    scr.add("String_Node_Str",downloadPath);
    scr.add("String_Node_Str",origPath);
    String result;
    result=scr.execute();
    if (result != null) {
      throw new CloudRuntimeException("String_Node_Str" + script);
    }
    String finalFileName=templateFilename;
    String finalDownloadPath=destPath + File.separator + templateFilename;
    long size=this._storage.getSize(downloadPath + File.separator + templateFilename);
    DataTO newDestTO=null;
    if (destData.getObjectType() == DataObjectType.TEMPLATE) {
      TemplateObjectTO newTemplTO=new TemplateObjectTO();
      newTemplTO.setPath(finalDownloadPath);
      newTemplTO.setName(finalFileName);
      newTemplTO.setSize(size);
      newDestTO=newTemplTO;
    }
 else {
      return new CopyCmdAnswer("String_Node_Str");
    }
    return new CopyCmdAnswer(newDestTO);
  }
 catch (  Exception e) {
    final String errMsg=format("String_Node_Str" + "String_Node_Str",e.getMessage());
    s_logger.error(errMsg,e);
    return new CopyCmdAnswer(errMsg);
  }
}