Program: 130168
Project: 130168
Buggy source:
public List<ImportItem> populateImportingItems(ResourcesManager resManager,boolean overwrite,IProgressMonitor progressMonitor,boolean enableProductChecking) throws Exception {
  IProgressMonitor monitor=progressMonitor;
  if (monitor == null) {
    monitor=new NullProgressMonitor();
  }
  TimeMeasure.display=CommonsPlugin.isDebugMode();
  TimeMeasure.displaySteps=CommonsPlugin.isDebugMode();
  TimeMeasure.measureActive=CommonsPlugin.isDebugMode();
  TimeMeasure.begin("String_Node_Str");
  try {
    prePopulate(monitor,resManager);
    ImportCacheHelper.getInstance().beforePopulateItems();
    if (resManager == null) {
      return Collections.emptyList();
    }
    Set<IPath> resPaths=resManager.getPaths();
    monitor.beginTask(Messages.getString("String_Node_Str"),resPaths.size());
    List<ImportItem> items=new ArrayList<ImportItem>();
    ImportHandlerHelper importHandlerHelper=new ImportHandlerHelper();
    for (    IPath path : resPaths) {
      if (monitor.isCanceled()) {
        return Collections.emptyList();
      }
      ImportItem importItem=importHandlerHelper.computeImportItem(monitor,resManager,path,overwrite);
      if (importItem != null) {
        IImportItemsHandler importHandler=findValidImportHandler(importItem,enableProductChecking);
        if (importHandler != null) {
          if (importHandler instanceof ImportBasicHandler) {
            ImportBasicHandler importBasicHandler=(ImportBasicHandler)importHandler;
            if (importBasicHandler.checkItem(resManager,importItem,overwrite)) {
              importBasicHandler.checkAndSetProject(resManager,importItem);
            }
          }
        }
 else {
          importItem=null;
        }
      }
      if (importItem == null) {
        IImportItemsHandler importHandler=findValidImportHandler(resManager,path,enableProductChecking);
        if (importHandler != null) {
          importItem=importHandler.createImportItem(progressMonitor,resManager,path,overwrite,items);
        }
      }
      if (importItem != null && !items.contains(importItem)) {
        items.add(importItem);
      }
      monitor.worked(1);
    }
    postPopulate(monitor,resManager,items.toArray(new ImportItem[0]));
    return items;
  }
  finally {
    ImportCacheHelper.getInstance().afterPopulateItems();
    TimeMeasure.end("String_Node_Str");
    TimeMeasure.display=false;
    TimeMeasure.displaySteps=false;
    TimeMeasure.measureActive=false;
  }
}

Fixed version (ground truth):
public List<ImportItem> populateImportingItems(ResourcesManager resManager,boolean overwrite,IProgressMonitor progressMonitor,boolean enableProductChecking) throws Exception {
  IProgressMonitor monitor=progressMonitor;
  if (monitor == null) {
    monitor=new NullProgressMonitor();
  }
  TimeMeasure.display=CommonsPlugin.isDebugMode();
  TimeMeasure.displaySteps=CommonsPlugin.isDebugMode();
  TimeMeasure.measureActive=CommonsPlugin.isDebugMode();
  TimeMeasure.begin("String_Node_Str");
  try {
    prePopulate(monitor,resManager);
    ImportCacheHelper.getInstance().beforePopulateItems();
    if (resManager == null) {
      return Collections.emptyList();
    }
    Set<IPath> resPaths=resManager.getPaths();
    monitor.beginTask(Messages.getString("String_Node_Str"),resPaths.size());
    List<ImportItem> items=new ArrayList<ImportItem>();
    List<IPath> resourcesPathsList=new ArrayList<IPath>(resPaths);
    Collections.sort(resourcesPathsList,new Comparator<IPath>(){
      @Override public int compare(      IPath o1,      IPath o2){
        return o1.toPortableString().compareTo(o2.toPortableString());
      }
    }
);
    List<IPath> doneList=new ArrayList<IPath>();
    ImportHandlerHelper importHandlerHelper=new ImportHandlerHelper();
    for (    IPath path : resourcesPathsList) {
      if (monitor.isCanceled()) {
        return Collections.emptyList();
      }
      if (!importHandlerHelper.validResourcePath(path)) {
        IImportItemsHandler importHandler=findValidImportHandler(resManager,path,enableProductChecking);
        if (importHandler != null) {
          ImportItem importItem=importHandler.createImportItem(progressMonitor,resManager,path,overwrite,items);
          if (importItem != null && !items.contains(importItem)) {
            items.add(importItem);
            doneList.add(path);
          }
        }
        monitor.worked(1);
      }
    }
    resourcesPathsList.removeAll(doneList);
    for (    IPath path : resPaths) {
      if (monitor.isCanceled()) {
        return Collections.emptyList();
      }
      ImportItem importItem=importHandlerHelper.computeImportItem(monitor,resManager,path,overwrite);
      if (importItem != null) {
        IImportItemsHandler importHandler=findValidImportHandler(importItem,enableProductChecking);
        if (importHandler != null) {
          if (importHandler instanceof ImportBasicHandler) {
            ImportBasicHandler importBasicHandler=(ImportBasicHandler)importHandler;
            if (importBasicHandler.checkItem(resManager,importItem,overwrite)) {
              importBasicHandler.checkAndSetProject(resManager,importItem);
            }
          }
        }
 else {
          importItem=null;
        }
      }
      if (importItem != null && !items.contains(importItem)) {
        items.add(importItem);
      }
      monitor.worked(1);
    }
    postPopulate(monitor,resManager,items.toArray(new ImportItem[0]));
    return items;
  }
  finally {
    ImportCacheHelper.getInstance().afterPopulateItems();
    TimeMeasure.end("String_Node_Str");
    TimeMeasure.display=false;
    TimeMeasure.displaySteps=false;
    TimeMeasure.measureActive=false;
  }
}