Program: 120414
Project: 120414
Buggy source:
/** 
 * DOC qwei Comment method "addDepencies".
 */
protected void addDependencies(ExportFileResource[] allResources,ProcessItem processItem,Boolean needDependencies,ExportFileResource resource){
  if (!needDependencies) {
    return;
  }
  BuildExportManager.getInstance().exportDependencies(resource,processItem);
  Collection<IRepositoryViewObject> allDependencies=ProcessUtils.getAllProcessDependencies(Arrays.asList(new Item[]{processItem}),false);
  try {
    for (    IRepositoryViewObject object : allDependencies) {
      Item item=object.getProperty().getItem();
      ERepositoryObjectType itemType=ERepositoryObjectType.getItemType(item);
      IPath typeFolderPath=new Path(ERepositoryObjectType.getFolderName(itemType));
      String itemName=item.getProperty().getLabel();
      String itemVersion=item.getProperty().getVersion();
      String itemPath=item.getState().getPath();
      itemPath=(itemPath == null || itemPath.equals("String_Node_Str")) ? "String_Node_Str" : itemPath;
      IPath projectRootPath=getCorrespondingProjectRootPath(item);
      String projectName=getCorrespondingProjectName(item);
      IPath projectFilePath=getCorrespondingProjectRootPath(item).append(FileConstants.LOCAL_PROJECT_FILENAME);
      checkAndAddProjectResource(allResources,resource,JOB_ITEMS_FOLDER_NAME + PATH_SEPARATOR + projectName,FileLocator.toFileURL(projectFilePath.toFile().toURL()));
      IPath itemFilePath;
      String itemVersionString=(itemVersion == null) ? "String_Node_Str" : "String_Node_Str" + itemVersion;
      if (item.getFileExtension() == null || "String_Node_Str".equals(item.getFileExtension())) {
        itemFilePath=projectRootPath.append(typeFolderPath).append(itemPath).append(itemName + itemVersionString + "String_Node_Str"+ FileConstants.ITEM_EXTENSION);
      }
 else {
        itemFilePath=projectRootPath.append(typeFolderPath).append(itemPath).append(itemName + itemVersionString + "String_Node_Str"+ item.getFileExtension());
      }
      IPath propertiesFilePath=projectRootPath.append(typeFolderPath).append(itemPath).append(itemName + itemVersionString + "String_Node_Str"+ FileConstants.PROPERTIES_EXTENSION);
      List<URL> metadataNameFileUrls=new ArrayList<URL>();
      metadataNameFileUrls.add(FileLocator.toFileURL(itemFilePath.toFile().toURL()));
      metadataNameFileUrls.add(FileLocator.toFileURL(propertiesFilePath.toFile().toURL()));
      String basePath=JOB_ITEMS_FOLDER_NAME + PATH_SEPARATOR + projectName+ PATH_SEPARATOR+ typeFolderPath.toString();
      if (itemPath != null && !"String_Node_Str".equals(itemPath)) {
        basePath=basePath + PATH_SEPARATOR + itemPath;
      }
      resource.addResources(basePath,metadataNameFileUrls);
      BuildExportManager.getInstance().exportDependencies(resource,item);
    }
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQItemService.class)) {
      ITDQItemService tdqItemService=(ITDQItemService)GlobalServiceRegister.getDefault().getService(ITDQItemService.class);
      if (tdqItemService != null && tdqItemService.hasProcessItemDependencies(Arrays.asList(new Item[]{processItem}))) {
        String defIdxFolderName="String_Node_Str";
        String defIdxFileName="String_Node_Str";
        IProject project=ReponsitoryContextBridge.getRootProject();
        IFile defIdxFile=project.getFile(defIdxFolderName + PATH_SEPARATOR + defIdxFileName);
        if (defIdxFile.exists()) {
          String defIdxBasePath=JOB_ITEMS_FOLDER_NAME + PATH_SEPARATOR + project.getName().toLowerCase()+ PATH_SEPARATOR+ defIdxFolderName;
          List<URL> defIdxUrls=new ArrayList<URL>();
          defIdxUrls.add(project.getLocation().makeAbsolute().append(defIdxFolderName).append(defIdxFileName).toFile().toURI().toURL());
          resource.addResources(defIdxBasePath,defIdxUrls);
        }
        String reportingBundlePath=PluginChecker.getBundlePath("String_Node_Str");
        List<URL> reportResourceUrls=new ArrayList<URL>();
        File imageFolder=new File(reportingBundlePath + PATH_SEPARATOR + "String_Node_Str");
        if (imageFolder.exists()) {
          reportResourceUrls.add(imageFolder.toURI().toURL());
        }
        File templateFolder=new File(reportingBundlePath + PATH_SEPARATOR + "String_Node_Str");
        if (templateFolder.exists() && templateFolder.isDirectory()) {
          reportResourceUrls.add(templateFolder.toURI().toURL());
        }
        resource.addResources(JOB_ITEMS_FOLDER_NAME + PATH_SEPARATOR,reportResourceUrls);
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}

Fixed version (ground truth):
/** 
 * DOC qwei Comment method "addDepencies".
 */
protected void addDependencies(ExportFileResource[] allResources,ProcessItem processItem,Boolean needDependencies,ExportFileResource resource){
  if (!needDependencies) {
    return;
  }
  if (!exportCaculatedItems.contains(processItem)) {
    BuildExportManager.getInstance().exportDependencies(resource,processItem);
    exportCaculatedItems.add(processItem);
  }
  Collection<IRepositoryViewObject> allDependencies=ProcessUtils.getAllProcessDependencies(Arrays.asList(new Item[]{processItem}),false);
  try {
    for (    IRepositoryViewObject object : allDependencies) {
      Item item=object.getProperty().getItem();
      ERepositoryObjectType itemType=ERepositoryObjectType.getItemType(item);
      IPath typeFolderPath=new Path(ERepositoryObjectType.getFolderName(itemType));
      String itemName=item.getProperty().getLabel();
      String itemVersion=item.getProperty().getVersion();
      String itemPath=item.getState().getPath();
      itemPath=(itemPath == null || itemPath.equals("String_Node_Str")) ? "String_Node_Str" : itemPath;
      IPath projectRootPath=getCorrespondingProjectRootPath(item);
      String projectName=getCorrespondingProjectName(item);
      IPath projectFilePath=getCorrespondingProjectRootPath(item).append(FileConstants.LOCAL_PROJECT_FILENAME);
      checkAndAddProjectResource(allResources,resource,JOB_ITEMS_FOLDER_NAME + PATH_SEPARATOR + projectName,FileLocator.toFileURL(projectFilePath.toFile().toURL()));
      IPath itemFilePath;
      String itemVersionString=(itemVersion == null) ? "String_Node_Str" : "String_Node_Str" + itemVersion;
      if (item.getFileExtension() == null || "String_Node_Str".equals(item.getFileExtension())) {
        itemFilePath=projectRootPath.append(typeFolderPath).append(itemPath).append(itemName + itemVersionString + "String_Node_Str"+ FileConstants.ITEM_EXTENSION);
      }
 else {
        itemFilePath=projectRootPath.append(typeFolderPath).append(itemPath).append(itemName + itemVersionString + "String_Node_Str"+ item.getFileExtension());
      }
      IPath propertiesFilePath=projectRootPath.append(typeFolderPath).append(itemPath).append(itemName + itemVersionString + "String_Node_Str"+ FileConstants.PROPERTIES_EXTENSION);
      List<URL> metadataNameFileUrls=new ArrayList<URL>();
      metadataNameFileUrls.add(FileLocator.toFileURL(itemFilePath.toFile().toURL()));
      metadataNameFileUrls.add(FileLocator.toFileURL(propertiesFilePath.toFile().toURL()));
      String basePath=JOB_ITEMS_FOLDER_NAME + PATH_SEPARATOR + projectName+ PATH_SEPARATOR+ typeFolderPath.toString();
      if (itemPath != null && !"String_Node_Str".equals(itemPath)) {
        basePath=basePath + PATH_SEPARATOR + itemPath;
      }
      resource.addResources(basePath,metadataNameFileUrls);
      if (!exportCaculatedItems.contains(item)) {
        BuildExportManager.getInstance().exportDependencies(resource,item);
        exportCaculatedItems.add(item);
      }
    }
    if (GlobalServiceRegister.getDefault().isServiceRegistered(ITDQItemService.class)) {
      ITDQItemService tdqItemService=(ITDQItemService)GlobalServiceRegister.getDefault().getService(ITDQItemService.class);
      if (tdqItemService != null && tdqItemService.hasProcessItemDependencies(Arrays.asList(new Item[]{processItem}))) {
        String defIdxFolderName="String_Node_Str";
        String defIdxFileName="String_Node_Str";
        IProject project=ReponsitoryContextBridge.getRootProject();
        IFile defIdxFile=project.getFile(defIdxFolderName + PATH_SEPARATOR + defIdxFileName);
        if (defIdxFile.exists()) {
          String defIdxBasePath=JOB_ITEMS_FOLDER_NAME + PATH_SEPARATOR + project.getName().toLowerCase()+ PATH_SEPARATOR+ defIdxFolderName;
          List<URL> defIdxUrls=new ArrayList<URL>();
          defIdxUrls.add(project.getLocation().makeAbsolute().append(defIdxFolderName).append(defIdxFileName).toFile().toURI().toURL());
          resource.addResources(defIdxBasePath,defIdxUrls);
        }
        String reportingBundlePath=PluginChecker.getBundlePath("String_Node_Str");
        List<URL> reportResourceUrls=new ArrayList<URL>();
        File imageFolder=new File(reportingBundlePath + PATH_SEPARATOR + "String_Node_Str");
        if (imageFolder.exists()) {
          reportResourceUrls.add(imageFolder.toURI().toURL());
        }
        File templateFolder=new File(reportingBundlePath + PATH_SEPARATOR + "String_Node_Str");
        if (templateFolder.exists() && templateFolder.isDirectory()) {
          reportResourceUrls.add(templateFolder.toURI().toURL());
        }
        resource.addResources(JOB_ITEMS_FOLDER_NAME + PATH_SEPARATOR,reportResourceUrls);
      }
    }
  }
 catch (  Exception e) {
    ExceptionHandler.process(e);
  }
}