Program: 118676
Project: 118676
Buggy source:
/** 
 * DOC nrousseau Comment method "addTDMDependencies".
 * @param items
 * @param itemsFolder
 */
private void addTDMDependencies(IFolder itemsFolder,List<Item> items){
  ITransformService tdmService=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITransformService.class)) {
    tdmService=(ITransformService)GlobalServiceRegister.getDefault().getService(ITransformService.class);
  }
  try {
    ExportFileResource resouece=new ExportFileResource();
    BuildExportManager.getInstance().exportDependencies(resouece,processItem);
    if (!resouece.getAllResources().isEmpty()) {
      final Iterator<String> relativepath=resouece.getRelativePathList().iterator();
      while (relativepath.hasNext()) {
        String relativePath=relativepath.next();
        Set<URL> sources=resouece.getResourcesByRelativePath(relativePath);
        for (        URL sourceUrl : sources) {
          File currentResource=new File(org.talend.commons.utils.io.FilesUtils.getFileRealPath(sourceUrl.getPath()));
          if (currentResource.exists()) {
            IFolder targetFolder=((IFolder)itemsFolder.getParent()).getFolder(relativePath);
            if (!targetFolder.exists()) {
              targetFolder.create(true,true,new NullProgressMonitor());
            }
            FilesUtils.copyFile(currentResource,new File(targetFolder.getLocation().toPortableString() + File.separator + currentResource.getName()));
          }
        }
      }
    }
    itemsFolder.refreshLocal(IResource.DEPTH_INFINITE,null);
    for (    Item item : items) {
      if (tdmService != null && tdmService.isTransformItem(item)) {
        String itemProjectFolder=getProject(item).getTechnicalLabel();
        if (isProjectNameLowerCase()) {
          itemProjectFolder=itemProjectFolder.toLowerCase();
        }
        IPath targetSettingPath=new Path(itemProjectFolder).append(RepositoryConstants.SETTING_DIRECTORY);
        IFolder targetSettingsFolder=talendProcessJavaProject.createSubFolder(null,itemsFolder,targetSettingPath.toString());
        IProject sourceProject=getCorrespondingProjectRootFolder(item);
        if (sourceProject.exists()) {
          IFile targetTdmPropsFile=targetSettingsFolder.getFile(FileConstants.TDM_PROPS);
          IFile sourceTdmPropsFile=sourceProject.getFolder(RepositoryConstants.SETTING_DIRECTORY).getFile(FileConstants.TDM_PROPS);
          if (sourceTdmPropsFile.exists() && !targetTdmPropsFile.exists()) {
            sourceTdmPropsFile.copy(targetTdmPropsFile.getFullPath(),true,null);
          }
        }
        break;
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
/** 
 * DOC nrousseau Comment method "addTDMDependencies".
 * @param items
 * @param itemsFolder
 */
private void addTDMDependencies(IFolder itemsFolder,List<Item> items){
  ITransformService tdmService=null;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ITransformService.class)) {
    tdmService=(ITransformService)GlobalServiceRegister.getDefault().getService(ITransformService.class);
  }
  try {
    ExportFileResource resouece=new ExportFileResource();
    BuildExportManager.getInstance().exportDependencies(resouece,processItem);
    if (!resouece.getAllResources().isEmpty()) {
      final Iterator<String> relativepath=resouece.getRelativePathList().iterator();
      while (relativepath.hasNext()) {
        String relativePath=relativepath.next();
        Set<URL> sources=resouece.getResourcesByRelativePath(relativePath);
        for (        URL sourceUrl : sources) {
          File currentResource=new File(org.talend.commons.utils.io.FilesUtils.getFileRealPath(sourceUrl.getPath()));
          if (currentResource.exists()) {
            IFolder targetFolder=((IFolder)itemsFolder.getParent()).getFolder(relativePath);
            if (!targetFolder.exists()) {
              targetFolder.create(true,true,new NullProgressMonitor());
            }
            FilesUtils.copyFile(currentResource,new File(targetFolder.getLocation().toPortableString() + File.separator + currentResource.getName()));
          }
        }
      }
    }
    itemsFolder.refreshLocal(IResource.DEPTH_INFINITE,null);
    for (    Item item : items) {
      if (tdmService != null && tdmService.isTransformItem(item)) {
        setNeedItemDependencies(true);
        String itemProjectFolder=getProject(item).getTechnicalLabel();
        if (isProjectNameLowerCase()) {
          itemProjectFolder=itemProjectFolder.toLowerCase();
        }
        IPath targetSettingPath=new Path(itemProjectFolder).append(RepositoryConstants.SETTING_DIRECTORY);
        IFolder targetSettingsFolder=talendProcessJavaProject.createSubFolder(null,itemsFolder,targetSettingPath.toString());
        IProject sourceProject=getCorrespondingProjectRootFolder(item);
        if (sourceProject.exists()) {
          IFile targetTdmPropsFile=targetSettingsFolder.getFile(FileConstants.TDM_PROPS);
          IFile sourceTdmPropsFile=sourceProject.getFolder(RepositoryConstants.SETTING_DIRECTORY).getFile(FileConstants.TDM_PROPS);
          if (sourceTdmPropsFile.exists() && !targetTdmPropsFile.exists()) {
            sourceTdmPropsFile.copy(targetTdmPropsFile.getFullPath(),true,null);
          }
        }
        break;
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}