Program: 126576
Project: 126576
Buggy source:
private void importItemRecordsWithRelations(final IProgressMonitor monitor,final ResourcesManager manager,final List<ImportItem> processingItemRecords,final boolean overwriting,ImportItem[] allPopulatedImportItemRecords,IPath destinationPath,final Set<String> overwriteDeletedItems,final Set<String> idDeletedBeforeImport) throws Exception {
  for (  ImportItem itemRecord : processingItemRecords) {
    if (monitor.isCanceled()) {
      return;
    }
    if (itemRecord.isImported()) {
      return;
    }
    final IImportItemsHandler importHandler=itemRecord.getImportHandler();
    if (importHandler != null && itemRecord.isValid()) {
      List<ImportItem> relatedItemRecord=importHandler.findRelatedImportItems(monitor,manager,itemRecord,allPopulatedImportItemRecords);
      if (importHandler.isPriorImportRelatedItem()) {
        if (!relatedItemRecord.isEmpty()) {
          importItemRecordsWithRelations(monitor,manager,relatedItemRecord,overwriting,allPopulatedImportItemRecords,destinationPath,overwriteDeletedItems,idDeletedBeforeImport);
        }
      }
      if (monitor.isCanceled()) {
        return;
      }
      importHandler.doImport(monitor,manager,itemRecord,overwriting,destinationPath,overwriteDeletedItems,idDeletedBeforeImport);
      if (monitor.isCanceled()) {
        return;
      }
      if (!importHandler.isPriorImportRelatedItem()) {
        if (!relatedItemRecord.isEmpty()) {
          importItemRecordsWithRelations(monitor,manager,relatedItemRecord,overwriting,allPopulatedImportItemRecords,destinationPath,overwriteDeletedItems,idDeletedBeforeImport);
        }
      }
      importHandler.afterImportingItems(monitor,manager,itemRecord);
      ImportCacheHelper.getInstance().getImportedItemRecords().add(itemRecord);
      monitor.worked(1);
    }
  }
}

Fixed version (ground truth):
private void importItemRecordsWithRelations(final IProgressMonitor monitor,final ResourcesManager manager,final List<ImportItem> processingItemRecords,final boolean overwriting,ImportItem[] allPopulatedImportItemRecords,IPath destinationPath,final Set<String> overwriteDeletedItems,final Set<String> idDeletedBeforeImport) throws Exception {
  for (  ImportItem itemRecord : processingItemRecords) {
    if (monitor.isCanceled()) {
      return;
    }
    if (itemRecord.isImported()) {
      return;
    }
    try {
      final IImportItemsHandler importHandler=itemRecord.getImportHandler();
      if (importHandler != null && itemRecord.isValid()) {
        List<ImportItem> relatedItemRecord=importHandler.findRelatedImportItems(monitor,manager,itemRecord,allPopulatedImportItemRecords);
        if (importHandler.isPriorImportRelatedItem()) {
          if (!relatedItemRecord.isEmpty()) {
            importItemRecordsWithRelations(monitor,manager,relatedItemRecord,overwriting,allPopulatedImportItemRecords,destinationPath,overwriteDeletedItems,idDeletedBeforeImport);
          }
        }
        if (monitor.isCanceled()) {
          return;
        }
        importHandler.doImport(monitor,manager,itemRecord,overwriting,destinationPath,overwriteDeletedItems,idDeletedBeforeImport);
        if (monitor.isCanceled()) {
          return;
        }
        if (!importHandler.isPriorImportRelatedItem()) {
          if (!relatedItemRecord.isEmpty()) {
            importItemRecordsWithRelations(monitor,manager,relatedItemRecord,overwriting,allPopulatedImportItemRecords,destinationPath,overwriteDeletedItems,idDeletedBeforeImport);
          }
        }
        importHandler.afterImportingItems(monitor,manager,itemRecord);
        ImportCacheHelper.getInstance().getImportedItemRecords().add(itemRecord);
        monitor.worked(1);
      }
    }
 catch (    Exception e) {
      if (Platform.inDebugMode()) {
        itemRecord.addError(e.getMessage());
        ImportCacheHelper.getInstance().setImportingError(true);
        ExceptionHandler.process(e);
      }
    }
  }
}