Program: 121446
Project: 121446
Buggy source:
/** 
 * need to returns sorted items by version to correctly import them later.
 */
public List<ItemRecord> populateItems(ResourcesManager collector,boolean overwrite,IProgressMonitor progressMonitor){
  TimeMeasure.display=CommonsPlugin.isDebugMode();
  TimeMeasure.displaySteps=CommonsPlugin.isDebugMode();
  TimeMeasure.measureActive=CommonsPlugin.isDebugMode();
  TimeMeasure.begin("String_Node_Str");
  treeBuilder.clear();
  if ((!CommonsPlugin.isSameProjectLogonCommline() && CommonsPlugin.isHeadless()) || !CommonsPlugin.isHeadless() || !ProjectManager.getInstance().getCurrentProject().isLocal()) {
    cache.clear();
  }
  projects.clear();
  routineExtModulesMap.clear();
  List<ItemRecord> items=new ArrayList<ItemRecord>();
  List<String> localFolderList=new ArrayList<String>();
  for (  ERepositoryObjectType type : (ERepositoryObjectType[])ERepositoryObjectType.values()) {
    if (type.getFolder() != null && !type.getFolder().equals("String_Node_Str")) {
      localFolderList.add(type.getFolder());
    }
  }
  Iterator it=collector.getPaths().iterator();
  while (it.hasNext()) {
    IPath path=(IPath)it.next();
    boolean flag=false;
    for (    String folderName : localFolderList) {
      if (path.toOSString().contains(folderName) || path.toOSString().contains(xmiResourceManager.getProjectFilename())) {
        flag=true;
        break;
      }
    }
    if (!flag) {
      it.remove();
    }
  }
  int nbItems=0;
  for (  IPath path : collector.getPaths()) {
    if (isPropertyPath(path)) {
      nbItems++;
    }
  }
  progressMonitor.beginTask("String_Node_Str",nbItems);
  for (  IPath path : collector.getPaths()) {
    if (!progressMonitor.isCanceled()) {
      if (isPropertyPath(path)) {
        ItemRecord itemRecord=computeItemRecord(collector,path);
        if (itemRecord.getProperty() != null) {
          boolean alreadyInList=false;
          for (          ItemRecord currentItemRecord : items) {
            if (StringUtils.equals(currentItemRecord.getProperty().getId(),itemRecord.getProperty().getId()) && StringUtils.equals(currentItemRecord.getProperty().getVersion(),itemRecord.getProperty().getVersion())) {
              alreadyInList=true;
              break;
            }
          }
          if (alreadyInList) {
            continue;
          }
          items.add(itemRecord);
          if (checkItem(itemRecord,overwrite)) {
            InternalEObject author=(InternalEObject)itemRecord.getProperty().getAuthor();
            URI uri=null;
            if (author != null) {
              uri=author.eProxyURI();
            }
            IPath projectFilePath=getValidProjectFilePath(collector,path,uri);
            if (projectFilePath != null) {
              Project project=computeProject(collector,itemRecord,projectFilePath);
              if (checkProject(project,itemRecord)) {
                treeBuilder.addItem(project,itemRecord);
                itemRecord.setItemProject(project);
                if (uri != null) {
                  User user=(User)project.eResource().getEObject(uri.fragment());
                  itemRecord.getProperty().setAuthor(user);
                }
              }
            }
 else {
              ERepositoryObjectType itemType=ERepositoryObjectType.getItemType(itemRecord.getItem());
              if (itemType.isDIItemType()) {
                itemRecord.addError(Messages.getString("String_Node_Str"));
              }
            }
          }
        }
        progressMonitor.worked(1);
      }
    }
 else {
      break;
    }
  }
  Collections.sort(items,new Comparator<ItemRecord>(){
    public int compare(    ItemRecord o1,    ItemRecord o2){
      return VersionUtils.compareTo(o1.getProperty().getVersion(),o2.getProperty().getVersion());
    }
  }
);
  if (!CommonsPlugin.isHeadless() || !ProjectManager.getInstance().getCurrentProject().isLocal()) {
    for (    List<IRepositoryViewObject> list : cache.getItemsFromRepository().values()) {
      list.clear();
    }
    cache.getItemsFromRepository().clear();
  }
  TimeMeasure.end("String_Node_Str");
  TimeMeasure.display=false;
  TimeMeasure.displaySteps=false;
  TimeMeasure.measureActive=false;
  return items;
}

Fixed version (ground truth):
/** 
 * need to returns sorted items by version to correctly import them later.
 */
public List<ItemRecord> populateItems(ResourcesManager collector,boolean overwrite,IProgressMonitor progressMonitor){
  TimeMeasure.display=CommonsPlugin.isDebugMode();
  TimeMeasure.displaySteps=CommonsPlugin.isDebugMode();
  TimeMeasure.measureActive=CommonsPlugin.isDebugMode();
  TimeMeasure.begin("String_Node_Str");
  treeBuilder.clear();
  if ((!CommonsPlugin.isSameProjectLogonCommline() && CommonsPlugin.isHeadless()) || !CommonsPlugin.isHeadless() || !ProjectManager.getInstance().getCurrentProject().isLocal()) {
    cache.clear();
  }
  projects.clear();
  routineExtModulesMap.clear();
  List<ItemRecord> items=new ArrayList<ItemRecord>();
  int nbItems=0;
  for (  IPath path : collector.getPaths()) {
    if (isPropertyPath(path)) {
      nbItems++;
    }
  }
  progressMonitor.beginTask("String_Node_Str",nbItems);
  for (  IPath path : collector.getPaths()) {
    if (!progressMonitor.isCanceled()) {
      if (isPropertyPath(path)) {
        ItemRecord itemRecord=computeItemRecord(collector,path);
        if (itemRecord.getProperty() != null) {
          boolean alreadyInList=false;
          for (          ItemRecord currentItemRecord : items) {
            if (StringUtils.equals(currentItemRecord.getProperty().getId(),itemRecord.getProperty().getId()) && StringUtils.equals(currentItemRecord.getProperty().getVersion(),itemRecord.getProperty().getVersion())) {
              alreadyInList=true;
              break;
            }
          }
          if (alreadyInList) {
            continue;
          }
          items.add(itemRecord);
          if (checkItem(itemRecord,overwrite)) {
            InternalEObject author=(InternalEObject)itemRecord.getProperty().getAuthor();
            URI uri=null;
            if (author != null) {
              uri=author.eProxyURI();
            }
            IPath projectFilePath=getValidProjectFilePath(collector,path,uri);
            if (projectFilePath != null) {
              Project project=computeProject(collector,itemRecord,projectFilePath);
              if (checkProject(project,itemRecord)) {
                treeBuilder.addItem(project,itemRecord);
                itemRecord.setItemProject(project);
                if (uri != null) {
                  User user=(User)project.eResource().getEObject(uri.fragment());
                  itemRecord.getProperty().setAuthor(user);
                }
              }
            }
 else {
              ERepositoryObjectType itemType=ERepositoryObjectType.getItemType(itemRecord.getItem());
              if (itemType.isDIItemType()) {
                itemRecord.addError(Messages.getString("String_Node_Str"));
              }
            }
          }
        }
        progressMonitor.worked(1);
      }
    }
 else {
      break;
    }
  }
  Collections.sort(items,new Comparator<ItemRecord>(){
    public int compare(    ItemRecord o1,    ItemRecord o2){
      return VersionUtils.compareTo(o1.getProperty().getVersion(),o2.getProperty().getVersion());
    }
  }
);
  if (!CommonsPlugin.isHeadless() || !ProjectManager.getInstance().getCurrentProject().isLocal()) {
    for (    List<IRepositoryViewObject> list : cache.getItemsFromRepository().values()) {
      list.clear();
    }
    cache.getItemsFromRepository().clear();
  }
  TimeMeasure.end("String_Node_Str");
  TimeMeasure.display=false;
  TimeMeasure.displaySteps=false;
  TimeMeasure.measureActive=false;
  return items;
}