Program: 49557
Project: 49557
Buggy source:
/** 
 * List entitlement pools. Pools will be refreshed from the underlying subscription service. If a consumer is specified, a pass through the rules will be done for each potentially usable pool.
 * @param c
 * @param o
 * @param productId
 * @param activeOnly
 * @return List of entitlement pools.
 */
@SuppressWarnings("String_Node_Str") @Transactional @EnforceAccessControl public List<Pool> listAvailableEntitlementPools(Consumer c,Owner o,String productId,boolean activeOnly){
  if (o == null && c != null) {
    o=c.getOwner();
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
    log.debug("String_Node_Str" + c);
    log.debug("String_Node_Str" + o);
    log.debug("String_Node_Str" + productId);
  }
  List<Pool> results=null;
  Criteria crit=currentSession().createCriteria(Pool.class);
  if (activeOnly) {
    crit.add(Restrictions.eq("String_Node_Str",Boolean.TRUE));
  }
  if (c != null) {
    crit.add(Restrictions.eq("String_Node_Str",c.getOwner()));
  }
  if (o != null) {
    crit.add(Restrictions.eq("String_Node_Str",o));
  }
  crit.add(Restrictions.lt("String_Node_Str",new Date()));
  crit.add(Restrictions.gt("String_Node_Str",new Date()));
  results=crit.list();
  log.debug("String_Node_Str" + results.size());
  if (results == null) {
    log.debug("String_Node_Str");
    return new ArrayList<Pool>();
  }
  if (productId != null) {
    List<Pool> newResults=new LinkedList<Pool>();
    for (    Pool p : results) {
      if (p.provides(productId)) {
        newResults.add(p);
        if (log.isDebugEnabled()) {
          log.debug("String_Node_Str" + productId + "String_Node_Str"+ p);
        }
      }
    }
    results=newResults;
  }
  addProductNames(results);
  if (c != null) {
    List<Pool> newResults=new LinkedList<Pool>();
    for (    Pool p : results) {
      PreEntHelper helper=enforcer.pre(c,p,1);
      if (helper.getResult().isSuccessful() && !helper.getResult().hasWarnings()) {
        newResults.add(p);
      }
 else {
        log.info("String_Node_Str" + p.getId());
        log.info(helper.getResult().getErrors());
        log.info(helper.getResult().getWarnings());
      }
    }
    results=newResults;
  }
  return results;
}

Fixed version (ground truth):
/** 
 * List entitlement pools. Pools will be refreshed from the underlying subscription service. If a consumer is specified, a pass through the rules will be done for each potentially usable pool.
 * @param c
 * @param o
 * @param productId
 * @param activeOnly
 * @return List of entitlement pools.
 */
@SuppressWarnings("String_Node_Str") @Transactional @EnforceAccessControl public List<Pool> listAvailableEntitlementPools(Consumer c,Owner o,String productId,boolean activeOnly){
  if (o == null && c != null) {
    o=c.getOwner();
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
    log.debug("String_Node_Str" + c);
    log.debug("String_Node_Str" + o);
    log.debug("String_Node_Str" + productId);
  }
  Criteria crit=currentSession().createCriteria(Pool.class);
  if (activeOnly) {
    crit.add(Restrictions.eq("String_Node_Str",Boolean.TRUE));
  }
  if (c != null) {
    crit.add(Restrictions.eq("String_Node_Str",c.getOwner()));
  }
  if (o != null) {
    crit.add(Restrictions.eq("String_Node_Str",o));
  }
  crit.add(Restrictions.lt("String_Node_Str",new Date()));
  crit.add(Restrictions.gt("String_Node_Str",new Date()));
  List<Pool> results=crit.list();
  log.debug("String_Node_Str" + results.size());
  if (results == null) {
    log.debug("String_Node_Str");
    return new ArrayList<Pool>();
  }
  if (productId != null) {
    List<Pool> newResults=new LinkedList<Pool>();
    for (    Pool p : results) {
      if (p.provides(productId)) {
        newResults.add(p);
        if (log.isDebugEnabled()) {
          log.debug("String_Node_Str" + productId + "String_Node_Str"+ p);
        }
      }
    }
    results=newResults;
  }
  addProductNames(results);
  if (c != null) {
    List<Pool> newResults=new LinkedList<Pool>();
    for (    Pool p : results) {
      PreEntHelper helper=enforcer.pre(c,p,1);
      if (helper.getResult().isSuccessful() && !helper.getResult().hasWarnings()) {
        newResults.add(p);
      }
 else {
        log.info("String_Node_Str" + p.getId());
        log.info(helper.getResult().getErrors());
        log.info(helper.getResult().getWarnings());
      }
    }
    results=newResults;
  }
  return results;
}