Program: 122753
Project: 122753
Buggy source:
/** 
 * Gets required java jars.
 * @param process
 * @param boolean1
 * @return
 */
protected List<URL> getExternalLibraries(boolean needLibraries,ExportFileResource[] process,Set<String> neededLibraries){
  List<URL> list=new ArrayList<URL>();
  if (!needLibraries) {
    return list;
  }
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  IProject prj=root.getProject(JavaUtils.JAVA_PROJECT_NAME);
  IJavaProject project=JavaCore.create(prj);
  IPath libPath=project.getResource().getLocation().append(JavaUtils.JAVA_LIB_DIRECTORY);
  File file=libPath.toFile();
  if (!file.exists()) {
    file.mkdir();
  }
  File[] files=file.listFiles(FilesUtils.getAcceptModuleFilesFilter());
  Set<String> listModulesReallyNeeded=new HashSet<String>();
  if (neededLibraries == null) {
    IDesignerCoreService designerService=RepositoryPlugin.getDefault().getDesignerCoreService();
    for (int i=0; i < process.length; i++) {
      ExportFileResource resource=process[i];
      ProcessItem item=(ProcessItem)resource.getItem();
      String version=item.getProperty().getVersion();
      if (!isMultiNodes() && this.getSelectedJobVersion() != null) {
        version=this.getSelectedJobVersion();
      }
      ProcessItem selectedProcessItem;
      if (resource.getNode() != null) {
        selectedProcessItem=ItemCacheManager.getProcessItem(resource.getNode().getRoot().getProject(),item.getProperty().getId(),version);
      }
 else {
        selectedProcessItem=ItemCacheManager.getProcessItem(item.getProperty().getId(),version);
      }
      IProcess iProcess=designerService.getProcessFromProcessItem(selectedProcessItem);
      neededLibraries=iProcess.getNeededLibraries(true);
      if (neededLibraries != null) {
        listModulesReallyNeeded.addAll(neededLibraries);
      }
    }
  }
 else {
    listModulesReallyNeeded.addAll(neededLibraries);
  }
  List<IRepositoryViewObject> collectRoutines=new ArrayList<IRepositoryViewObject>();
  boolean useBeans=false;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
    ICamelDesignerCoreService camelService=(ICamelDesignerCoreService)GlobalServiceRegister.getDefault().getService(ICamelDesignerCoreService.class);
    if (camelService.isInstanceofCamel(process[0].getItem())) {
      useBeans=true;
    }
  }
  collectRoutines.addAll(collectRoutines(process,useBeans));
  for (  IRepositoryViewObject object : collectRoutines) {
    Item item=object.getProperty().getItem();
    if (item instanceof RoutineItem) {
      RoutineItem routine=(RoutineItem)item;
      EList imports=routine.getImports();
      for (      Object o : imports) {
        IMPORTType type=(IMPORTType)o;
        listModulesReallyNeeded.add(type.getMODULE());
      }
    }
  }
  for (int i=0; i < files.length; i++) {
    File tempFile=files[i];
    try {
      if (listModulesReallyNeeded.contains(tempFile.getName())) {
        list.add(tempFile.toURL());
      }
    }
 catch (    MalformedURLException e) {
      ExceptionHandler.process(e);
    }
  }
  return list;
}

Fixed version (ground truth):
/** 
 * Gets required java jars.
 * @param process
 * @param boolean1
 * @return
 */
protected List<URL> getExternalLibraries(boolean needLibraries,ExportFileResource[] process,Set<String> neededLibraries){
  List<URL> list=new ArrayList<URL>();
  if (!needLibraries) {
    return list;
  }
  IWorkspaceRoot root=ResourcesPlugin.getWorkspace().getRoot();
  IProject prj=root.getProject(JavaUtils.JAVA_PROJECT_NAME);
  IJavaProject project=JavaCore.create(prj);
  IPath libPath=project.getResource().getLocation().append(JavaUtils.JAVA_LIB_DIRECTORY);
  File file=libPath.toFile();
  if (!file.exists()) {
    file.mkdir();
  }
  File[] files=file.listFiles(FilesUtils.getAcceptModuleFilesFilter());
  Set<String> listModulesReallyNeeded=new HashSet<String>();
  if (neededLibraries == null) {
    IDesignerCoreService designerService=RepositoryPlugin.getDefault().getDesignerCoreService();
    for (    ExportFileResource resource : process) {
      ProcessItem item=(ProcessItem)resource.getItem();
      String version=item.getProperty().getVersion();
      if (!isMultiNodes() && this.getSelectedJobVersion() != null) {
        version=this.getSelectedJobVersion();
      }
      ProcessItem selectedProcessItem;
      if (resource.getNode() != null) {
        selectedProcessItem=ItemCacheManager.getProcessItem(resource.getNode().getRoot().getProject(),item.getProperty().getId(),version);
      }
 else {
        selectedProcessItem=ItemCacheManager.getProcessItem(item.getProperty().getId(),version);
      }
      IProcess iProcess=designerService.getProcessFromProcessItem(selectedProcessItem);
      neededLibraries=iProcess.getNeededLibraries(true);
      if (neededLibraries != null) {
        listModulesReallyNeeded.addAll(neededLibraries);
      }
    }
  }
 else {
    listModulesReallyNeeded.addAll(neededLibraries);
  }
  List<IRepositoryViewObject> collectRoutines=new ArrayList<IRepositoryViewObject>();
  boolean useBeans=false;
  if (GlobalServiceRegister.getDefault().isServiceRegistered(ICamelDesignerCoreService.class)) {
    ICamelDesignerCoreService camelService=(ICamelDesignerCoreService)GlobalServiceRegister.getDefault().getService(ICamelDesignerCoreService.class);
    if (camelService.isInstanceofCamel(process[0].getItem())) {
      useBeans=true;
    }
  }
  collectRoutines.addAll(collectRoutines(process,useBeans));
  for (  IRepositoryViewObject object : collectRoutines) {
    Item item=object.getProperty().getItem();
    if (item instanceof RoutineItem) {
      RoutineItem routine=(RoutineItem)item;
      EList imports=routine.getImports();
      for (      Object o : imports) {
        IMPORTType type=(IMPORTType)o;
        listModulesReallyNeeded.add(type.getMODULE());
      }
    }
  }
  for (  File tempFile : files) {
    try {
      if (listModulesReallyNeeded.contains(tempFile.getName())) {
        list.add(tempFile.toURL());
      }
    }
 catch (    MalformedURLException e) {
      ExceptionHandler.process(e);
    }
  }
  return list;
}