Program: 49204
Project: 49204
Buggy source:
/** 
 * Create any pools that need to be created for the given pool. In some scenarios, due to attribute changes, pools may need to be created even though pools already exist for the subscription. A list of pre-existing pools for the given sub are provided to help this method determine if something needs to be done or not. For a genuine new pool, the existing pools list will be empty.
 * @param masterPool
 * @param existingPools
 * @return a list of pools created for the given pool
 */
public List<Pool> createAndEnrichPools(Pool masterPool,List<Pool> existingPools){
  List<Pool> pools=new LinkedList<Pool>();
  long calculated=this.calculateQuantity(masterPool.getQuantity() != null ? masterPool.getQuantity() : 1,masterPool.getProduct(),masterPool.getUpstreamPoolId());
  masterPool.setQuantity(calculated);
  String virtOnly=masterPool.getProductAttributeValue(Product.Attributes.VIRT_ONLY);
  if (virtOnly != null && !virtOnly.isEmpty()) {
    masterPool.setAttribute(Pool.Attributes.VIRT_ONLY,virtOnly);
  }
 else {
    masterPool.removeAttribute(Pool.Attributes.VIRT_ONLY);
  }
  log.info("String_Node_Str",masterPool);
  if (!hasMasterPool(existingPools)) {
    if (masterPool.getSourceSubscription() != null && masterPool.getSourceSubscription().getSubscriptionSubKey().contentEquals("String_Node_Str")) {
      throw new IllegalStateException("String_Node_Str");
    }
    pools.add(masterPool);
    log.info("String_Node_Str",masterPool);
  }
  Pool bonusPool=createBonusPool(masterPool,existingPools);
  if (bonusPool != null) {
    pools.add(bonusPool);
  }
  return pools;
}

Fixed version (ground truth):
/** 
 * Create any pools that need to be created for the given pool. In some scenarios, due to attribute changes, pools may need to be created even though pools already exist for the subscription. A list of pre-existing pools for the given sub are provided to help this method determine if something needs to be done or not. For a genuine new pool, the existing pools list will be empty.
 * @param masterPool
 * @param existingPools
 * @return a list of pools created for the given pool
 */
public List<Pool> createAndEnrichPools(Pool masterPool,List<Pool> existingPools){
  List<Pool> pools=new LinkedList<Pool>();
  long calculated=this.calculateQuantity(masterPool.getQuantity() != null ? masterPool.getQuantity() : 1,masterPool.getProduct(),masterPool.getUpstreamPoolId());
  masterPool.setQuantity(calculated);
  String virtOnly=masterPool.getProductAttributeValue(Product.Attributes.VIRT_ONLY);
  if (virtOnly != null && !virtOnly.isEmpty()) {
    masterPool.setAttribute(Pool.Attributes.VIRT_ONLY,virtOnly);
  }
 else {
    masterPool.removeAttribute(Pool.Attributes.VIRT_ONLY);
  }
  log.info("String_Node_Str",masterPool);
  if (masterPool.getSubscriptionId() != null) {
    if (!hasMasterPool(existingPools)) {
      if (masterPool.getSubscriptionSubKey() != null && masterPool.getSubscriptionSubKey().contentEquals("String_Node_Str")) {
        throw new IllegalStateException("String_Node_Str");
      }
      pools.add(masterPool);
      log.info("String_Node_Str",masterPool);
    }
  }
 else   if (masterPool.getId() == null) {
    pools.add(masterPool);
  }
  Pool bonusPool=createBonusPool(masterPool,existingPools);
  if (bonusPool != null) {
    pools.add(bonusPool);
  }
  return pools;
}