Program: 49251
Project: 49251
Buggy source:
@Transactional @SuppressWarnings("String_Node_Str") void refreshPoolsWithRegeneration(SubscriptionServiceAdapter subAdapter,Owner owner,boolean lazy){
  long start=System.currentTimeMillis();
  owner=this.refreshOwner(owner);
  log.info("String_Node_Str",owner);
  Map<String,Subscription> subscriptionMap=new HashMap<String,Subscription>();
  Map<String,ProductData> productMap=new HashMap<String,ProductData>();
  Map<String,ContentData> contentMap=new HashMap<String,ContentData>();
  SubscriptionReconciler reconciler=new SubscriptionReconciler();
  for (  Subscription subscription : reconciler.reconcile(owner,subAdapter.getSubscriptions(owner),poolCurator)) {
    if (subscription == null) {
      continue;
    }
    Subscription existingSub=subscriptionMap.get(subscription.getId());
    if (existingSub != null && !existingSub.equals(subscription)) {
      log.warn("String_Node_Str" + "String_Node_Str",subscription.getId(),existingSub,subscription);
      continue;
    }
    subscriptionMap.put(subscription.getId(),subscription);
    List<ProductData> products=new LinkedList<ProductData>();
    products.add(subscription.getProduct());
    products.add(subscription.getDerivedProduct());
    products.addAll(subscription.getProvidedProducts());
    products.addAll(subscription.getDerivedProvidedProducts());
    for (    ProductData product : products) {
      if (product == null) {
        continue;
      }
      if (product.getId() == null) {
        log.error("String_Node_Str",product);
        throw new IllegalStateException("String_Node_Str" + product);
      }
      product.setLocked(true);
      ProductData existingProduct=productMap.get(product.getId());
      if (existingProduct != null && !existingProduct.equals(product)) {
        log.warn("String_Node_Str" + "String_Node_Str",product.getId(),existingProduct,product);
      }
 else {
        productMap.put(product.getId(),product);
        Collection<ProductContentData> pcdCollection=product.getProductContent();
        if (pcdCollection != null) {
          for (          ProductContentData pcd : pcdCollection) {
            if (pcd == null) {
              log.error("String_Node_Str",product);
              throw new IllegalStateException("String_Node_Str" + product);
            }
            ContentData content=pcd.getContent();
            if (content == null || content.getId() == null) {
              log.error("String_Node_Str" + "String_Node_Str",product);
              throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + product);
            }
            ContentData existingContent=contentMap.get(content.getId());
            if (existingContent != null && !existingContent.equals(content)) {
              log.warn("String_Node_Str" + "String_Node_Str",content.getId(),existingContent,content);
            }
 else {
              contentMap.put(content.getId(),content);
            }
          }
        }
      }
    }
  }
  log.debug("String_Node_Str",contentMap.size());
  for (  ContentData cdata : contentMap.values()) {
    cdata.setLocked(true);
  }
  Map<String,Content> importedContent=this.contentManager.importContent(owner,contentMap,productMap.keySet());
  Set<Product> changedProducts=new HashSet<Product>();
  Set<String> existingProductIds=this.ownerProductCurator.filterUnknownProductIds(owner,productMap.keySet());
  log.debug("String_Node_Str",productMap.size());
  Map<String,Product> importedProducts=this.productManager.importProducts(owner,productMap,importedContent);
  for (  String pid : existingProductIds) {
    changedProducts.add(importedProducts.get(pid));
  }
  log.debug("String_Node_Str",subscriptionMap.size());
  Iterator<Map.Entry<String,Subscription>> subsIterator=subscriptionMap.entrySet().iterator();
  while (subsIterator.hasNext()) {
    Map.Entry<String,Subscription> entry=subsIterator.next();
    Subscription sub=entry.getValue();
    if (this.isExpired(sub)) {
      log.info("String_Node_Str",sub);
      subsIterator.remove();
      continue;
    }
    log.debug("String_Node_Str",sub);
    Pool pool=this.convertToMasterPoolImpl(sub,owner,importedProducts);
    this.refreshPoolsForMasterPool(pool,false,lazy,changedProducts);
  }
  Pool ueberPool=this.findUeberPool(owner);
  String ueberPoolId=ueberPool != null ? ueberPool.getId() : null;
  log.debug("String_Node_Str");
  List<Pool> poolsToDelete=new ArrayList<Pool>();
  for (  Pool pool : poolCurator.getPoolsFromBadSubs(owner,subscriptionMap.keySet())) {
    if (pool.getSourceSubscription() != null && !pool.getType().isDerivedType() && (ueberPoolId == null || !ueberPoolId.equals(pool.getId()))) {
      poolsToDelete.add(pool);
    }
  }
  deletePools(poolsToDelete);
  log.debug("String_Node_Str");
  List<Pool> floatingPools=poolCurator.getOwnersFloatingPools(owner);
  updateFloatingPools(floatingPools,lazy,changedProducts);
  log.info("String_Node_Str",owner.getKey(),System.currentTimeMillis() - start);
}

Fixed version (ground truth):
@Transactional @SuppressWarnings("String_Node_Str") void refreshPoolsWithRegeneration(SubscriptionServiceAdapter subAdapter,Owner owner,boolean lazy){
  long start=System.currentTimeMillis();
  owner=this.refreshOwner(owner);
  log.info("String_Node_Str",owner);
  Map<String,Subscription> subscriptionMap=new HashMap<String,Subscription>();
  Map<String,ProductData> productMap=new HashMap<String,ProductData>();
  Map<String,ContentData> contentMap=new HashMap<String,ContentData>();
  SubscriptionReconciler reconciler=new SubscriptionReconciler();
  for (  Subscription subscription : reconciler.reconcile(owner,subAdapter.getSubscriptions(owner),poolCurator)) {
    if (subscription == null) {
      continue;
    }
    Subscription existingSub=subscriptionMap.get(subscription.getId());
    if (existingSub != null && !existingSub.equals(subscription)) {
      log.warn("String_Node_Str" + "String_Node_Str",subscription.getId(),existingSub,subscription);
      continue;
    }
    subscriptionMap.put(subscription.getId(),subscription);
    List<ProductData> products=new LinkedList<ProductData>();
    products.add(subscription.getProduct());
    products.add(subscription.getDerivedProduct());
    products.addAll(subscription.getProvidedProducts());
    products.addAll(subscription.getDerivedProvidedProducts());
    for (    ProductData product : products) {
      if (product == null) {
        continue;
      }
      if (product.getId() == null) {
        log.error("String_Node_Str",product);
        throw new IllegalStateException("String_Node_Str" + product);
      }
      product.setLocked(true);
      ProductData existingProduct=productMap.get(product.getId());
      if (existingProduct != null && !existingProduct.equals(product)) {
        log.warn("String_Node_Str" + "String_Node_Str",product.getId(),existingProduct,product);
      }
 else {
        productMap.put(product.getId(),product);
        Collection<ProductContentData> pcdCollection=product.getProductContent();
        if (pcdCollection != null) {
          for (          ProductContentData pcd : pcdCollection) {
            if (pcd == null) {
              log.error("String_Node_Str",product);
              throw new IllegalStateException("String_Node_Str" + product);
            }
            ContentData content=pcd.getContent();
            if (content == null || content.getId() == null) {
              log.error("String_Node_Str" + "String_Node_Str",product);
              throw new IllegalStateException("String_Node_Str" + "String_Node_Str" + product);
            }
            ContentData existingContent=contentMap.get(content.getId());
            if (existingContent != null && !existingContent.equals(content)) {
              log.warn("String_Node_Str" + "String_Node_Str",content.getId(),existingContent,content);
            }
 else {
              contentMap.put(content.getId(),content);
            }
          }
        }
      }
    }
  }
  log.debug("String_Node_Str",contentMap.size());
  for (  ContentData cdata : contentMap.values()) {
    cdata.setLocked(true);
  }
  Map<String,Content> importedContent=this.contentManager.importContent(owner,contentMap,productMap.keySet()).getImportedEntities();
  log.debug("String_Node_Str",productMap.size());
  ImportResult<Product> importResult=this.productManager.importProducts(owner,productMap,importedContent);
  Map<String,Product> importedProducts=importResult.getImportedEntities();
  Set<Product> changedProducts=new HashSet<Product>();
  changedProducts.addAll(importResult.getUpdatedEntities().values());
  log.debug("String_Node_Str",subscriptionMap.size());
  Iterator<Map.Entry<String,Subscription>> subsIterator=subscriptionMap.entrySet().iterator();
  while (subsIterator.hasNext()) {
    Map.Entry<String,Subscription> entry=subsIterator.next();
    Subscription sub=entry.getValue();
    if (this.isExpired(sub)) {
      log.info("String_Node_Str",sub);
      subsIterator.remove();
      continue;
    }
    log.debug("String_Node_Str",sub);
    Pool pool=this.convertToMasterPoolImpl(sub,owner,importedProducts);
    this.refreshPoolsForMasterPool(pool,false,lazy,changedProducts);
  }
  Pool ueberPool=this.findUeberPool(owner);
  String ueberPoolId=ueberPool != null ? ueberPool.getId() : null;
  log.debug("String_Node_Str");
  List<Pool> poolsToDelete=new ArrayList<Pool>();
  for (  Pool pool : poolCurator.getPoolsFromBadSubs(owner,subscriptionMap.keySet())) {
    if (pool.getSourceSubscription() != null && !pool.getType().isDerivedType() && (ueberPoolId == null || !ueberPoolId.equals(pool.getId()))) {
      poolsToDelete.add(pool);
    }
  }
  deletePools(poolsToDelete);
  log.debug("String_Node_Str");
  List<Pool> floatingPools=poolCurator.getOwnersFloatingPools(owner);
  updateFloatingPools(floatingPools,lazy,changedProducts);
  log.info("String_Node_Str",owner.getKey(),System.currentTimeMillis() - start);
}