Program: 49504
Project: 49504
Buggy source:
@Transactional(rollbackOn={IOException.class,ImporterException.class,RuntimeException.class,ImportConflictException.class}) ConsumerDto importObjects(Owner owner,Map<String,File> importFiles,ConflictOverrides overrides) throws IOException, ImporterException {
  File metadata=importFiles.get(ImportFile.META.fileName());
  if (metadata == null) {
    throw new ImporterException(i18n.tr("String_Node_Str" + "String_Node_Str"));
  }
  File consumerTypes=importFiles.get(ImportFile.CONSUMER_TYPE.fileName());
  if (consumerTypes == null) {
    throw new ImporterException(i18n.tr("String_Node_Str" + "String_Node_Str"));
  }
  File consumerFile=importFiles.get(ImportFile.CONSUMER.fileName());
  if (consumerFile == null) {
    throw new ImporterException(i18n.tr("String_Node_Str" + "String_Node_Str"));
  }
  File products=importFiles.get(ImportFile.PRODUCTS.fileName());
  File entitlements=importFiles.get(ImportFile.ENTITLEMENTS.fileName());
  if (products != null && entitlements == null) {
    throw new ImporterException(i18n.tr("String_Node_Str" + "String_Node_Str"));
  }
  List<ImportConflictException> conflictExceptions=new LinkedList<ImportConflictException>();
  File rules=importFiles.get(ImportFile.RULES_FILE.fileName());
  importRules(rules,metadata);
  importConsumerTypes(consumerTypes.listFiles());
  try {
    validateMetadata(ExporterMetadata.TYPE_PER_USER,owner,metadata,overrides);
  }
 catch (  ImportConflictException e) {
    conflictExceptions.add(e);
  }
  ConsumerDto consumer=null;
  try {
    Meta m=mapper.readValue(metadata,Meta.class);
    File upstreamFile=importFiles.get(ImportFile.UPSTREAM_CONSUMER.fileName());
    File[] dafiles=new File[0];
    if (upstreamFile != null) {
      dafiles=upstreamFile.listFiles();
    }
    consumer=importConsumer(owner,consumerFile,dafiles,overrides,m);
  }
 catch (  ImportConflictException e) {
    conflictExceptions.add(e);
  }
  if (!conflictExceptions.isEmpty()) {
    log.error("String_Node_Str");
    for (    ImportConflictException e : conflictExceptions) {
      log.error(e.message().getConflicts());
    }
    throw new ImportConflictException(conflictExceptions);
  }
  if (importFiles.get(ImportFile.PRODUCTS.fileName()) != null) {
    Refresher refresher=poolManager.getRefresher();
    ProductImporter importer=new ProductImporter(productCurator,contentCurator,poolManager);
    Set<Product> productsToImport=importProducts(importFiles.get(ImportFile.PRODUCTS.fileName()).listFiles(),importer);
    Set<Product> modifiedProducts=importer.getChangedProducts(productsToImport);
    for (    Product product : modifiedProducts) {
      refresher.add(product);
    }
    importer.store(productsToImport);
    importEntitlements(owner,productsToImport,entitlements.listFiles(),consumer);
    refresher.add(owner);
    refresher.run();
  }
 else {
    log.warn("String_Node_Str");
  }
  return consumer;
}

Fixed version (ground truth):
@Transactional(rollbackOn={IOException.class,ImporterException.class,RuntimeException.class,ImportConflictException.class}) ConsumerDto importObjects(Owner owner,Map<String,File> importFiles,ConflictOverrides overrides) throws IOException, ImporterException {
  File metadata=importFiles.get(ImportFile.META.fileName());
  if (metadata == null) {
    throw new ImporterException(i18n.tr("String_Node_Str" + "String_Node_Str"));
  }
  File consumerTypes=importFiles.get(ImportFile.CONSUMER_TYPE.fileName());
  if (consumerTypes == null) {
    throw new ImporterException(i18n.tr("String_Node_Str" + "String_Node_Str"));
  }
  File consumerFile=importFiles.get(ImportFile.CONSUMER.fileName());
  if (consumerFile == null) {
    throw new ImporterException(i18n.tr("String_Node_Str" + "String_Node_Str"));
  }
  File products=importFiles.get(ImportFile.PRODUCTS.fileName());
  File entitlements=importFiles.get(ImportFile.ENTITLEMENTS.fileName());
  if (products != null && entitlements == null) {
    throw new ImporterException(i18n.tr("String_Node_Str" + "String_Node_Str"));
  }
  List<ImportConflictException> conflictExceptions=new LinkedList<ImportConflictException>();
  File rules=importFiles.get(ImportFile.RULES_FILE.fileName());
  importRules(rules,metadata);
  importConsumerTypes(consumerTypes.listFiles());
  try {
    validateMetadata(ExporterMetadata.TYPE_PER_USER,owner,metadata,overrides);
  }
 catch (  ImportConflictException e) {
    conflictExceptions.add(e);
  }
  ConsumerDto consumer=null;
  try {
    Meta m=mapper.readValue(metadata,Meta.class);
    File upstreamFile=importFiles.get(ImportFile.UPSTREAM_CONSUMER.fileName());
    File[] dafiles=new File[0];
    if (upstreamFile != null) {
      dafiles=upstreamFile.listFiles();
    }
    consumer=importConsumer(owner,consumerFile,dafiles,overrides,m);
  }
 catch (  ImportConflictException e) {
    conflictExceptions.add(e);
  }
  if (!conflictExceptions.isEmpty()) {
    log.error("String_Node_Str");
    for (    ImportConflictException e : conflictExceptions) {
      log.error(e.message().getConflicts());
    }
    throw new ImportConflictException(conflictExceptions);
  }
  if (importFiles.get(ImportFile.PRODUCTS.fileName()) != null) {
    Refresher refresher=poolManager.getRefresher();
    ProductImporter importer=new ProductImporter(productCurator,contentCurator);
    Set<Product> productsToImport=importProducts(importFiles.get(ImportFile.PRODUCTS.fileName()).listFiles(),importer);
    Set<Product> modifiedProducts=importer.getChangedProducts(productsToImport);
    for (    Product product : modifiedProducts) {
      refresher.add(product);
    }
    importer.store(productsToImport);
    importEntitlements(owner,productsToImport,entitlements.listFiles(),consumer);
    refresher.add(owner);
    refresher.run();
  }
 else {
    log.warn("String_Node_Str");
  }
  return consumer;
}