Program: 120848
Project: 120848
Buggy source:
@SuppressWarnings("String_Node_Str") public List<ItemRecord> importItemRecords(final ResourcesManager manager,final List<ItemRecord> itemRecords,final IProgressMonitor monitor,final boolean overwrite,final IPath destinationPath,final String contentType){
  TimeMeasure.display=CommonsPlugin.isDebugMode();
  TimeMeasure.displaySteps=CommonsPlugin.isDebugMode();
  TimeMeasure.measureActive=CommonsPlugin.isDebugMode();
  TimeMeasure.begin("String_Node_Str");
  hasJoblets=false;
  statAndLogsSettingsReloaded=false;
  implicitSettingsReloaded=false;
  restoreFolder=new RestoreFolderUtil();
  Collections.sort(itemRecords,new Comparator<ItemRecord>(){
    public int compare(    ItemRecord o1,    ItemRecord o2){
      if (o1.getProperty().getItem() instanceof RoutineItem && o2.getProperty().getItem() instanceof RoutineItem) {
        return 0;
      }
 else       if (!(o1.getProperty().getItem() instanceof RoutineItem) && !(o2.getProperty().getItem() instanceof RoutineItem)) {
        return 0;
      }
 else       if (o1.getProperty().getItem() instanceof RoutineItem) {
        return -1;
      }
 else {
        return 1;
      }
    }
  }
);
  monitor.beginTask(Messages.getString("String_Node_Str"),itemRecords.size() * 2 + 1);
  RepositoryWorkUnit repositoryWorkUnit=new RepositoryWorkUnit("String_Node_Str"){
    @Override public void run() throws PersistenceException {
      final IWorkspaceRunnable op=new IWorkspaceRunnable(){
        public void run(        IProgressMonitor monitor) throws CoreException {
          final IProxyRepositoryFactory factory=CorePlugin.getDefault().getProxyRepositoryFactory();
          final Set<String> overwriteDeletedItems=new HashSet<String>();
          final Set<String> idDeletedBeforeImport=new HashSet<String>();
          Map<String,String> nameToIdMap=new HashMap<String,String>();
          for (          ItemRecord itemRecord : itemRecords) {
            if (!monitor.isCanceled()) {
              if (itemRecord.isValid()) {
                if (itemRecord.getState() == State.ID_EXISTED) {
                  String id=nameToIdMap.get(itemRecord.getProperty().getLabel() + ERepositoryObjectType.getItemType(itemRecord.getProperty().getItem()).toString());
                  if (id == null) {
                    id=EcoreUtil.generateUUID();
                    nameToIdMap.put(itemRecord.getProperty().getLabel() + ERepositoryObjectType.getItemType(itemRecord.getProperty().getItem()).toString(),id);
                  }
                  itemRecord.getProperty().setId(id);
                }
              }
            }
          }
          for (          ItemRecord itemRecord : itemRecords) {
            if (!monitor.isCanceled()) {
              if (itemRecord.isValid()) {
                importItemRecord(manager,itemRecord,overwrite,destinationPath,overwriteDeletedItems,idDeletedBeforeImport,contentType,monitor);
                IRepositoryViewObject object;
                try {
                  Property property=itemRecord.getProperty();
                  if (property == null) {
                    object=factory.getSpecificVersion(itemRecord.getItemId(),itemRecord.getItemVersion(),true);
                    property=object.getProperty();
                  }
                  RelationshipItemBuilder.getInstance().addOrUpdateItem(property.getItem(),true);
                  itemRecord.setProperty(null);
                  ProxyRepositoryFactory.getInstance().unloadResources(property);
                }
 catch (                PersistenceException e) {
                  ExceptionHandler.process(e);
                }
                statAndLogsSettingsReloaded=false;
                implicitSettingsReloaded=false;
                monitor.worked(1);
              }
            }
          }
          if (!getRoutineExtModulesMap().isEmpty()) {
            Set<String> extRoutines=new HashSet<String>();
            for (            String id : getRoutineExtModulesMap().keySet()) {
              Set<String> set=getRoutineExtModulesMap().get(id);
              if (set != null) {
                extRoutines.addAll(set);
              }
            }
            if (manager instanceof ProviderManager || manager instanceof ZipFileManager) {
              deployJarToDesForArchive(manager,extRoutines);
            }
 else {
              deployJarToDes(manager,extRoutines);
            }
          }
          if (PluginChecker.isJobLetPluginLoaded()) {
            IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
            if (service != null) {
              service.loadComponentsFromProviders();
            }
          }
          checkDeletedFolders();
          monitor.done();
          TimeMeasure.step("String_Node_Str","String_Node_Str");
          if (RelationshipItemBuilder.getInstance().isNeedSaveRelations()) {
            RelationshipItemBuilder.getInstance().saveRelations();
            TimeMeasure.step("String_Node_Str","String_Node_Str");
          }
 else {
            try {
              factory.saveProject(ProjectManager.getInstance().getCurrentProject());
            }
 catch (            PersistenceException e) {
              throw new CoreException(new Status(IStatus.ERROR,FrameworkUtil.getBundle(this.getClass()).getSymbolicName(),"String_Node_Str",e));
            }
            TimeMeasure.step("String_Node_Str","String_Node_Str");
          }
        }
      }
;
      IWorkspace workspace=ResourcesPlugin.getWorkspace();
      try {
        ISchedulingRule schedulingRule=workspace.getRoot();
        workspace.run(op,schedulingRule,IWorkspace.AVOID_UPDATE,monitor);
      }
 catch (      CoreException e) {
      }
    }
  }
;
  repositoryWorkUnit.setAvoidUnloadResources(true);
  repositoryWorkUnit.setUnloadResourcesAfterRun(true);
  ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(repositoryWorkUnit);
  monitor.done();
  clearAllData();
  if (hasJoblets) {
    ComponentsFactoryProvider.getInstance().resetSpecificComponents();
  }
  TimeMeasure.end("String_Node_Str");
  TimeMeasure.display=false;
  TimeMeasure.displaySteps=false;
  TimeMeasure.measureActive=false;
  return itemRecords;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public List<ItemRecord> importItemRecords(final ResourcesManager manager,final List<ItemRecord> itemRecords,final IProgressMonitor monitor,final boolean overwrite,final IPath destinationPath,final String contentType){
  TimeMeasure.display=CommonsPlugin.isDebugMode();
  TimeMeasure.displaySteps=CommonsPlugin.isDebugMode();
  TimeMeasure.measureActive=CommonsPlugin.isDebugMode();
  TimeMeasure.begin("String_Node_Str");
  hasJoblets=false;
  statAndLogsSettingsReloaded=false;
  implicitSettingsReloaded=false;
  restoreFolder=new RestoreFolderUtil();
  Collections.sort(itemRecords,new Comparator<ItemRecord>(){
    @Override public int compare(    ItemRecord o1,    ItemRecord o2){
      if (o1.getProperty().getItem() instanceof RoutineItem && o2.getProperty().getItem() instanceof RoutineItem) {
        return 0;
      }
 else       if (!(o1.getProperty().getItem() instanceof RoutineItem) && !(o2.getProperty().getItem() instanceof RoutineItem)) {
        return 0;
      }
 else       if (o1.getProperty().getItem() instanceof RoutineItem) {
        return -1;
      }
 else {
        return 1;
      }
    }
  }
);
  monitor.beginTask(Messages.getString("String_Node_Str"),itemRecords.size() * 2 + 1);
  RepositoryWorkUnit repositoryWorkUnit=new RepositoryWorkUnit("String_Node_Str"){
    @Override public void run() throws PersistenceException {
      final IWorkspaceRunnable op=new IWorkspaceRunnable(){
        @Override public void run(        IProgressMonitor monitor) throws CoreException {
          final IProxyRepositoryFactory factory=CorePlugin.getDefault().getProxyRepositoryFactory();
          final Set<String> overwriteDeletedItems=new HashSet<String>();
          final Set<String> idDeletedBeforeImport=new HashSet<String>();
          Map<String,String> nameToIdMap=new HashMap<String,String>();
          for (          ItemRecord itemRecord : itemRecords) {
            if (!monitor.isCanceled()) {
              if (itemRecord.isValid()) {
                if (itemRecord.getState() == State.ID_EXISTED) {
                  String id=nameToIdMap.get(itemRecord.getProperty().getLabel() + ERepositoryObjectType.getItemType(itemRecord.getProperty().getItem()).toString());
                  if (id == null) {
                    id=EcoreUtil.generateUUID();
                    nameToIdMap.put(itemRecord.getProperty().getLabel() + ERepositoryObjectType.getItemType(itemRecord.getProperty().getItem()).toString(),id);
                  }
                  itemRecord.getProperty().setId(id);
                }
              }
            }
          }
          for (          ItemRecord itemRecord : itemRecords) {
            if (!monitor.isCanceled()) {
              if (itemRecord.isValid()) {
                importItemRecord(manager,itemRecord,overwrite,destinationPath,overwriteDeletedItems,idDeletedBeforeImport,contentType,monitor);
                IRepositoryViewObject object;
                try {
                  Property property=itemRecord.getProperty();
                  if (property == null) {
                    object=factory.getSpecificVersion(itemRecord.getItemId(),itemRecord.getItemVersion(),true);
                    property=object.getProperty();
                  }
                  RelationshipItemBuilder.getInstance().addOrUpdateItem(property.getItem(),true);
                  itemRecord.setProperty(null);
                  ProxyRepositoryFactory.getInstance().unloadResources(property);
                }
 catch (                PersistenceException e) {
                  ExceptionHandler.process(e);
                }
                statAndLogsSettingsReloaded=false;
                implicitSettingsReloaded=false;
                monitor.worked(1);
              }
            }
          }
          if (!getRoutineExtModulesMap().isEmpty()) {
            Set<String> extRoutines=new HashSet<String>();
            for (            String id : getRoutineExtModulesMap().keySet()) {
              Set<String> set=getRoutineExtModulesMap().get(id);
              if (set != null) {
                extRoutines.addAll(set);
              }
            }
            if (manager instanceof ProviderManager || manager instanceof ZipFileManager) {
              deployJarToDesForArchive(manager,extRoutines);
            }
 else {
              deployJarToDes(manager,extRoutines);
            }
          }
          if (PluginChecker.isJobLetPluginLoaded()) {
            IJobletProviderService service=(IJobletProviderService)GlobalServiceRegister.getDefault().getService(IJobletProviderService.class);
            if (service != null) {
              service.loadComponentsFromProviders();
            }
          }
          checkDeletedFolders();
          monitor.done();
          TimeMeasure.step("String_Node_Str","String_Node_Str");
          if (RelationshipItemBuilder.getInstance().isNeedSaveRelations()) {
            RelationshipItemBuilder.getInstance().saveRelations();
            TimeMeasure.step("String_Node_Str","String_Node_Str");
          }
 else {
            try {
              factory.saveProject(ProjectManager.getInstance().getCurrentProject());
            }
 catch (            PersistenceException e) {
              throw new CoreException(new Status(IStatus.ERROR,FrameworkUtil.getBundle(this.getClass()).getSymbolicName(),"String_Node_Str",e));
            }
            TimeMeasure.step("String_Node_Str","String_Node_Str");
          }
        }
      }
;
      IWorkspace workspace=ResourcesPlugin.getWorkspace();
      try {
        ISchedulingRule schedulingRule=workspace.getRoot();
        workspace.run(op,schedulingRule,IWorkspace.AVOID_UPDATE,monitor);
      }
 catch (      CoreException e) {
      }
    }
  }
;
  repositoryWorkUnit.setAvoidUnloadResources(true);
  repositoryWorkUnit.setUnloadResourcesAfterRun(true);
  ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(repositoryWorkUnit);
  monitor.done();
  clearAllData();
  if (hasJoblets) {
    ComponentsFactoryProvider.getInstance().resetSpecificComponents();
  }
  TimeMeasure.end("String_Node_Str");
  TimeMeasure.display=false;
  TimeMeasure.displaySteps=false;
  TimeMeasure.measureActive=false;
  return itemRecords;
}