Program: 112331
Project: 112331
Buggy source:
@Override public Set<Long> searchForIdsWithAndOr(Map<String,List<List<IQueryParameterType>>> theParams){
  Map<String,List<List<IQueryParameterType>>> params=theParams;
  if (params == null) {
    params=Collections.emptyMap();
  }
  RuntimeResourceDefinition resourceDef=getContext().getResourceDefinition(myResourceType);
  Set<Long> pids=new HashSet<Long>();
  for (  Entry<String,List<List<IQueryParameterType>>> nextParamEntry : params.entrySet()) {
    String nextParamName=nextParamEntry.getKey();
    if (nextParamName.equals("String_Node_Str")) {
      if (nextParamEntry.getValue().isEmpty()) {
        continue;
      }
 else       if (nextParamEntry.getValue().size() > 1) {
        throw new InvalidRequestException("String_Node_Str");
      }
 else {
        Set<Long> joinPids=new HashSet<Long>();
        List<IQueryParameterType> nextValue=nextParamEntry.getValue().get(0);
        if (nextValue == null || nextValue.size() == 0) {
          continue;
        }
 else {
          for (          IQueryParameterType next : nextValue) {
            String value=next.getValueAsQueryToken();
            long valueLong=Long.parseLong(value);
            joinPids.add(valueLong);
          }
          if (joinPids.isEmpty()) {
            continue;
          }
        }
        if (pids.isEmpty()) {
          pids.addAll(joinPids);
        }
 else {
          pids.retainAll(joinPids);
        }
      }
    }
    RuntimeSearchParam nextParamDef=resourceDef.getSearchParam(nextParamName);
    if (nextParamDef != null) {
      if (nextParamDef.getParamType() == SearchParamTypeEnum.TOKEN) {
        for (        List<IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
          pids=addPredicateToken(pids,nextAnd);
          if (pids.isEmpty()) {
            return new HashSet<Long>();
          }
        }
      }
 else       if (nextParamDef.getParamType() == SearchParamTypeEnum.STRING) {
        for (        List<IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
          pids=addPredicateString(pids,nextAnd);
          if (pids.isEmpty()) {
            return new HashSet<Long>();
          }
        }
      }
 else       if (nextParamDef.getParamType() == SearchParamTypeEnum.QUANTITY) {
        for (        List<IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
          pids=addPredicateQuantity(pids,nextAnd);
          if (pids.isEmpty()) {
            return new HashSet<Long>();
          }
        }
      }
 else       if (nextParamDef.getParamType() == SearchParamTypeEnum.DATE) {
        for (        List<IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
          pids=addPredicateDate(pids,nextAnd);
          if (pids.isEmpty()) {
            return new HashSet<Long>();
          }
        }
      }
 else       if (nextParamDef.getParamType() == SearchParamTypeEnum.REFERENCE) {
        for (        List<IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
          pids=addPredicateReference(nextParamName,pids,nextAnd);
          if (pids.isEmpty()) {
            return new HashSet<Long>();
          }
        }
      }
 else {
        throw new IllegalArgumentException("String_Node_Str" + nextParamDef.getParamType());
      }
    }
  }
  return pids;
}

Fixed version (ground truth):
@Override public Set<Long> searchForIdsWithAndOr(Map<String,List<List<IQueryParameterType>>> theParams){
  Map<String,List<List<IQueryParameterType>>> params=theParams;
  if (params == null) {
    params=Collections.emptyMap();
  }
  RuntimeResourceDefinition resourceDef=getContext().getResourceDefinition(myResourceType);
  Set<Long> pids=new HashSet<Long>();
  for (  Entry<String,List<List<IQueryParameterType>>> nextParamEntry : params.entrySet()) {
    String nextParamName=nextParamEntry.getKey();
    if (nextParamName.equals("String_Node_Str")) {
      if (nextParamEntry.getValue().isEmpty()) {
        continue;
      }
 else       if (nextParamEntry.getValue().size() > 1) {
        throw new InvalidRequestException("String_Node_Str");
      }
 else {
        Set<Long> joinPids=new HashSet<Long>();
        List<IQueryParameterType> nextValue=nextParamEntry.getValue().get(0);
        if (nextValue == null || nextValue.size() == 0) {
          continue;
        }
 else {
          for (          IQueryParameterType next : nextValue) {
            String value=next.getValueAsQueryToken();
            long valueLong=Long.parseLong(value);
            joinPids.add(valueLong);
          }
          if (joinPids.isEmpty()) {
            continue;
          }
        }
        if (pids.isEmpty()) {
          pids.addAll(joinPids);
        }
 else {
          pids.retainAll(joinPids);
        }
      }
    }
    RuntimeSearchParam nextParamDef=resourceDef.getSearchParam(nextParamName);
    if (nextParamDef != null) {
      if (nextParamDef.getParamType() == SearchParamTypeEnum.TOKEN) {
        for (        List<IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
          pids=addPredicateToken(nextParamName,pids,nextAnd);
          if (pids.isEmpty()) {
            return new HashSet<Long>();
          }
        }
      }
 else       if (nextParamDef.getParamType() == SearchParamTypeEnum.STRING) {
        for (        List<IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
          pids=addPredicateString(nextParamName,pids,nextAnd);
          if (pids.isEmpty()) {
            return new HashSet<Long>();
          }
        }
      }
 else       if (nextParamDef.getParamType() == SearchParamTypeEnum.QUANTITY) {
        for (        List<IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
          pids=addPredicateQuantity(nextParamName,pids,nextAnd);
          if (pids.isEmpty()) {
            return new HashSet<Long>();
          }
        }
      }
 else       if (nextParamDef.getParamType() == SearchParamTypeEnum.DATE) {
        for (        List<IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
          pids=addPredicateDate(nextParamName,pids,nextAnd);
          if (pids.isEmpty()) {
            return new HashSet<Long>();
          }
        }
      }
 else       if (nextParamDef.getParamType() == SearchParamTypeEnum.REFERENCE) {
        for (        List<IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
          pids=addPredicateReference(nextParamName,pids,nextAnd);
          if (pids.isEmpty()) {
            return new HashSet<Long>();
          }
        }
      }
 else {
        throw new IllegalArgumentException("String_Node_Str" + nextParamDef.getParamType());
      }
    }
  }
  return pids;
}