Program: 112300
Project: 112300
Buggy source:
private Set<Long> addPredicateString(String theParamName,Set<Long> thePids,List<? extends IQueryParameterType> theList){
  if (theList == null || theList.isEmpty()) {
    return thePids;
  }
  if (Boolean.TRUE.equals(theList.get(0).getMissing())) {
    return addPredicateParamMissing(thePids,"String_Node_Str");
  }
  CriteriaBuilder builder=myEntityManager.getCriteriaBuilder();
  CriteriaQuery<Long> cq=builder.createQuery(Long.class);
  Root<ResourceIndexedSearchParamString> from=cq.from(ResourceIndexedSearchParamString.class);
  cq.select(from.get("String_Node_Str").as(Long.class));
  List<Predicate> codePredicates=new ArrayList<Predicate>();
  for (  IQueryParameterType nextOr : theList) {
    IQueryParameterType theParameter=nextOr;
    if (addPredicateMissingFalseIfPresent(theParamName,from,codePredicates,nextOr)) {
      continue;
    }
    Predicate singleCode=createPredicateString(theParameter,theParamName,builder,from);
    codePredicates.add(singleCode);
  }
  Predicate masterCodePredicate=builder.or(codePredicates.toArray(new Predicate[0]));
  Predicate type=builder.equal(from.get("String_Node_Str"),myResourceName);
  Predicate name=builder.equal(from.get("String_Node_Str"),theParamName);
  if (thePids.size() > 0) {
    Predicate inPids=(from.get("String_Node_Str").in(thePids));
    cq.where(builder.and(type,name,masterCodePredicate,inPids));
  }
 else {
    cq.where(builder.and(type,name,masterCodePredicate));
  }
  TypedQuery<Long> q=myEntityManager.createQuery(cq);
  return new HashSet<Long>(q.getResultList());
}

Fixed version (ground truth):
private Set<Long> addPredicateString(String theParamName,Set<Long> thePids,List<? extends IQueryParameterType> theList){
  if (theList == null || theList.isEmpty()) {
    return thePids;
  }
  if (Boolean.TRUE.equals(theList.get(0).getMissing())) {
    return addPredicateParamMissing(thePids,"String_Node_Str",theParamName,ResourceIndexedSearchParamString.class);
  }
  CriteriaBuilder builder=myEntityManager.getCriteriaBuilder();
  CriteriaQuery<Long> cq=builder.createQuery(Long.class);
  Root<ResourceIndexedSearchParamString> from=cq.from(ResourceIndexedSearchParamString.class);
  cq.select(from.get("String_Node_Str").as(Long.class));
  List<Predicate> codePredicates=new ArrayList<Predicate>();
  for (  IQueryParameterType nextOr : theList) {
    IQueryParameterType theParameter=nextOr;
    if (addPredicateMissingFalseIfPresent(builder,theParamName,from,codePredicates,nextOr)) {
      continue;
    }
    Predicate singleCode=createPredicateString(theParameter,theParamName,builder,from);
    codePredicates.add(singleCode);
  }
  Predicate masterCodePredicate=builder.or(codePredicates.toArray(new Predicate[0]));
  Predicate type=builder.equal(from.get("String_Node_Str"),myResourceName);
  Predicate name=builder.equal(from.get("String_Node_Str"),theParamName);
  if (thePids.size() > 0) {
    Predicate inPids=(from.get("String_Node_Str").in(thePids));
    cq.where(builder.and(type,name,masterCodePredicate,inPids));
  }
 else {
    cq.where(builder.and(type,name,masterCodePredicate));
  }
  TypedQuery<Long> q=myEntityManager.createQuery(cq);
  return new HashSet<Long>(q.getResultList());
}