Program: 122752
Project: 122752
Buggy source:
/** 
 * DOC hywang Comment method "initUrlForDrlFiles".
 * @param process
 * @param talendDrlFiles
 * @throws PersistenceException
 * @throws CoreException
 * @throws MalformedURLException
 */
private Map<String,List<URL>> initUrlForRulesFiles(ExportFileResource[] process) throws PersistenceException, CoreException, MalformedURLException {
  Map<String,List<URL>> map=new HashMap<String,List<URL>>();
  List<URL> urlList=new ArrayList<URL>();
  String processLabelAndVersion=null;
  IFile file;
  Item item=null;
  ProcessItem pi=null;
  if (PluginChecker.isRulesPluginLoaded()) {
    IProxyRepositoryFactory factory=CorePlugin.getDefault().getProxyRepositoryFactory();
    IRulesProviderService rulesService=(IRulesProviderService)GlobalServiceRegister.getDefault().getService(IRulesProviderService.class);
    for (int i=0; i < process.length; i++) {
      if (!urlList.isEmpty()) {
        urlList=new ArrayList<URL>();
      }
      item=((ExportFileResource)process[i]).getItem();
      if (item instanceof ProcessItem) {
        pi=(ProcessItem)item;
        processLabelAndVersion=JavaResourcesHelper.getJobFolderName(pi.getProperty().getLabel(),pi.getProperty().getVersion());
      }
      for (int j=0; j < pi.getProcess().getNode().size(); j++) {
        if (pi.getProcess().getNode().get(j) instanceof NodeType) {
          NodeType node=(NodeType)pi.getProcess().getNode().get(j);
          if (rulesService.isRuleComponent(node)) {
            for (            Object obj : node.getElementParameter()) {
              if (obj instanceof ElementParameterType) {
                ElementParameterType elementParameter=(ElementParameterType)obj;
                if (elementParameter.getName().equals("String_Node_Str")) {
                  String id=elementParameter.getValue();
                  if (factory.getLastVersion(id).getProperty().getItem() != null) {
                    if (factory.getLastVersion(id).getProperty().getItem() instanceof RulesItem) {
                      RulesItem rulesItem=(RulesItem)factory.getLastVersion(id).getProperty().getItem();
                      file=rulesService.getFinalRuleFile(rulesItem,processLabelAndVersion);
                      URL url=file.getLocationURI().toURL();
                      urlList.add(url);
                    }
                  }
                }
              }
            }
          }
        }
      }
      map.put(processLabelAndVersion,urlList);
    }
  }
  return map;
}

Fixed version (ground truth):
/** 
 * DOC hywang Comment method "initUrlForDrlFiles".
 * @param process
 * @param talendDrlFiles
 * @throws PersistenceException
 * @throws CoreException
 * @throws MalformedURLException
 */
private Map<String,List<URL>> initUrlForRulesFiles(ExportFileResource[] process) throws PersistenceException, CoreException, MalformedURLException {
  Map<String,List<URL>> map=new HashMap<String,List<URL>>();
  List<URL> urlList=new ArrayList<URL>();
  String processLabelAndVersion=null;
  IFile file;
  Item item=null;
  ProcessItem pi=null;
  if (PluginChecker.isRulesPluginLoaded()) {
    IProxyRepositoryFactory factory=CorePlugin.getDefault().getProxyRepositoryFactory();
    IRulesProviderService rulesService=(IRulesProviderService)GlobalServiceRegister.getDefault().getService(IRulesProviderService.class);
    for (    ExportFileResource proces : process) {
      if (!urlList.isEmpty()) {
        urlList=new ArrayList<URL>();
      }
      item=(proces).getItem();
      if (item instanceof ProcessItem) {
        pi=(ProcessItem)item;
        processLabelAndVersion=JavaResourcesHelper.getJobFolderName(pi.getProperty().getLabel(),pi.getProperty().getVersion());
      }
      for (int j=0; j < pi.getProcess().getNode().size(); j++) {
        if (pi.getProcess().getNode().get(j) instanceof NodeType) {
          NodeType node=(NodeType)pi.getProcess().getNode().get(j);
          if (rulesService.isRuleComponent(node)) {
            for (            Object obj : node.getElementParameter()) {
              if (obj instanceof ElementParameterType) {
                ElementParameterType elementParameter=(ElementParameterType)obj;
                if (elementParameter.getName().equals("String_Node_Str")) {
                  String id=elementParameter.getValue();
                  if (factory.getLastVersion(id).getProperty().getItem() != null) {
                    if (factory.getLastVersion(id).getProperty().getItem() instanceof RulesItem) {
                      RulesItem rulesItem=(RulesItem)factory.getLastVersion(id).getProperty().getItem();
                      file=rulesService.getFinalRuleFile(rulesItem,processLabelAndVersion);
                      URL url=file.getLocationURI().toURL();
                      urlList.add(url);
                    }
                  }
                }
              }
            }
          }
        }
      }
      map.put(processLabelAndVersion,urlList);
    }
  }
  return map;
}