Program: 49203
Project: 49203
Buggy source:
/** 
 * Create a pool only for virt guests of a particular host consumer.
 * @param pools Pools these host restricted pools are being derived from.
 * @return pools the created pools
 */
public static List<Pool> createHostRestrictedPools(PoolManager poolManager,Consumer consumer,List<Pool> pools,Map<String,Entitlement> sourceEntitlements,Map<String,Map<String,String>> attributeMaps,ProductCurator productCurator){
  List<Pool> poolsToCreate=new ArrayList<Pool>();
  List<Pool> poolsToUpdateFromStack=new ArrayList<Pool>();
  for (  Pool pool : pools) {
    Product product=pool.getProduct();
    Pool consumerSpecificPool=null;
    Map<String,String> attributes=attributeMaps.get(pool.getId());
    String quantity=attributes.get("String_Node_Str");
    if (pool.getDerivedProduct() == null) {
      consumerSpecificPool=createPool(product,pool.getOwner(),quantity,pool.getStartDate(),pool.getEndDate(),pool.getContractNumber(),pool.getAccountNumber(),pool.getOrderNumber(),productCurator.getPoolProvidedProductsCached(pool),sourceEntitlements.get(pool.getId()),pool.hasSharedAncestor());
    }
 else {
      consumerSpecificPool=createPool(pool.getDerivedProduct(),pool.getOwner(),quantity,pool.getStartDate(),pool.getEndDate(),pool.getContractNumber(),pool.getAccountNumber(),pool.getOrderNumber(),productCurator.getPoolDerivedProvidedProductsCached(pool),sourceEntitlements.get(pool.getId()),pool.hasSharedAncestor());
    }
    consumerSpecificPool.setAttribute(Pool.Attributes.REQUIRES_HOST,consumer.getUuid());
    consumerSpecificPool.setAttribute(Pool.Attributes.DERIVED_POOL,"String_Node_Str");
    consumerSpecificPool.setAttribute(Pool.Attributes.VIRT_ONLY,"String_Node_Str");
    consumerSpecificPool.setAttribute(Pool.Attributes.PHYSICAL_ONLY,"String_Node_Str");
    if (pool.isStacked()) {
      poolsToUpdateFromStack.add(consumerSpecificPool);
    }
 else {
      consumerSpecificPool.setAttribute(Pool.Attributes.SOURCE_POOL_ID,pool.getId());
      consumerSpecificPool.setSourceSubscription(new SourceSubscription(pool.getSubscriptionId(),sourceEntitlements.get(pool.getId()).getId()));
    }
    poolsToCreate.add(consumerSpecificPool);
  }
  if (CollectionUtils.isNotEmpty(poolsToUpdateFromStack)) {
    poolManager.updatePoolsFromStack(consumer,poolsToUpdateFromStack);
  }
  return poolManager.createPools(poolsToCreate);
}

Fixed version (ground truth):
/** 
 * Create a pool only for virt guests of a particular host consumer.
 * @param pools Pools these host restricted pools are being derived from.
 * @return pools the created pools
 */
public static List<Pool> createHostRestrictedPools(PoolManager poolManager,Consumer consumer,List<Pool> pools,Map<String,Entitlement> sourceEntitlements,Map<String,Map<String,String>> attributeMaps,ProductCurator productCurator){
  List<Pool> poolsToCreate=new ArrayList<Pool>();
  List<Pool> poolsToUpdateFromStack=new ArrayList<Pool>();
  for (  Pool pool : pools) {
    Product product=pool.getProduct();
    Pool consumerSpecificPool=null;
    Map<String,String> attributes=attributeMaps.get(pool.getId());
    String quantity=attributes.get("String_Node_Str");
    if (pool.getDerivedProduct() == null) {
      consumerSpecificPool=createPool(product,pool.getOwner(),quantity,pool.getStartDate(),pool.getEndDate(),pool.getContractNumber(),pool.getAccountNumber(),pool.getOrderNumber(),productCurator.getPoolProvidedProductsCached(pool),sourceEntitlements.get(pool.getId()),pool.hasSharedAncestor());
    }
 else {
      consumerSpecificPool=createPool(pool.getDerivedProduct(),pool.getOwner(),quantity,pool.getStartDate(),pool.getEndDate(),pool.getContractNumber(),pool.getAccountNumber(),pool.getOrderNumber(),productCurator.getPoolDerivedProvidedProductsCached(pool),sourceEntitlements.get(pool.getId()),pool.hasSharedAncestor());
    }
    consumerSpecificPool.setAttribute(Pool.Attributes.REQUIRES_HOST,consumer.getUuid());
    consumerSpecificPool.setAttribute(Pool.Attributes.DERIVED_POOL,"String_Node_Str");
    consumerSpecificPool.setAttribute(Pool.Attributes.VIRT_ONLY,"String_Node_Str");
    consumerSpecificPool.setAttribute(Pool.Attributes.PHYSICAL_ONLY,"String_Node_Str");
    if (pool.isStacked()) {
      poolsToUpdateFromStack.add(consumerSpecificPool);
    }
 else {
      consumerSpecificPool.setAttribute(Pool.Attributes.SOURCE_POOL_ID,pool.getId());
      String subscriptionId=pool.getSubscriptionId();
      if (subscriptionId != null && !subscriptionId.isEmpty()) {
        consumerSpecificPool.setSourceSubscription(new SourceSubscription(subscriptionId,sourceEntitlements.get(pool.getId()).getId()));
      }
    }
    poolsToCreate.add(consumerSpecificPool);
  }
  if (CollectionUtils.isNotEmpty(poolsToUpdateFromStack)) {
    poolManager.updatePoolsFromStack(consumer,poolsToUpdateFromStack);
  }
  return poolManager.createPools(poolsToCreate);
}