Program: 49386
Project: 49386
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());
  File distributorVersions=importFiles.get(ImportFile.DISTRIBUTOR_VERSIONS.fileName());
  if (distributorVersions != null) {
    importDistributorVersions(distributorVersions.listFiles());
  }
  File cdns=importFiles.get(ImportFile.CONTENT_DELIVERY_NETWORKS.fileName());
  if (cdns != null) {
    importContentDeliveryNetworks(cdns.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("String_Node_Str",e.message().getConflicts());
    }
    throw new ImportConflictException(conflictExceptions);
  }
  SubscriptionServiceAdapter adapter=new ImportSubscriptionServiceAdapter(new ArrayList<Subscription>());
  Refresher refresher=poolManager.getRefresher(adapter);
  Meta meta=mapper.readValue(metadata,Meta.class);
  if (importFiles.get(ImportFile.PRODUCTS.fileName()) != null) {
    ProductImporter importer=new ProductImporter(productCurator,contentCurator);
    Set<Product> productsToImport=importProducts(importFiles.get(ImportFile.PRODUCTS.fileName()).listFiles(),importer);
    importer.store(productsToImport);
    meta=mapper.readValue(metadata,Meta.class);
    importEntitlements(owner,productsToImport,entitlements.listFiles(),consumer,meta);
    refresher.add(owner);
    refresher.run();
  }
 else {
    log.warn("String_Node_Str");
    log.warn("String_Node_Str");
    importEntitlements(owner,new HashSet<Product>(),new File[]{},consumer,meta);
    refresher.add(owner);
    refresher.run();
  }
  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());
  File distributorVersions=importFiles.get(ImportFile.DISTRIBUTOR_VERSIONS.fileName());
  if (distributorVersions != null) {
    importDistributorVersions(distributorVersions.listFiles());
  }
  File cdns=importFiles.get(ImportFile.CONTENT_DELIVERY_NETWORKS.fileName());
  if (cdns != null) {
    importContentDeliveryNetworks(cdns.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("String_Node_Str",e.message().getConflicts());
    }
    throw new ImportConflictException(conflictExceptions);
  }
  SubscriptionServiceAdapter adapter=new ImportSubscriptionServiceAdapter(new ArrayList<Subscription>());
  Refresher refresher=poolManager.getRefresher(adapter);
  Meta meta=mapper.readValue(metadata,Meta.class);
  if (importFiles.get(ImportFile.PRODUCTS.fileName()) != null) {
    ProductImporter importer=new ProductImporter(productCurator,contentCurator);
    Set<Product> productsToImport=importProducts(importFiles.get(ImportFile.PRODUCTS.fileName()).listFiles(),importer);
    importer.store(productsToImport,owner);
    meta=mapper.readValue(metadata,Meta.class);
    importEntitlements(owner,productsToImport,entitlements.listFiles(),consumer,meta);
    refresher.add(owner);
    refresher.run();
  }
 else {
    log.warn("String_Node_Str");
    log.warn("String_Node_Str");
    importEntitlements(owner,new HashSet<Product>(),new File[]{},consumer,meta);
    refresher.add(owner);
    refresher.run();
  }
  return consumer;
}