Program: 112249
Project: 112249
Buggy source:
private void searchForIdsWithAndOr(SearchParameterMap theParams,DateRangeParam theLastUpdated){
  SearchParameterMap params=theParams;
  if (params == null) {
    params=new SearchParameterMap();
  }
  myParams=theParams;
  doInitializeSearch();
  for (  Entry<String,List<List<? extends IQueryParameterType>>> nextParamEntry : params.entrySet()) {
    String nextParamName=nextParamEntry.getKey();
    if (nextParamName.equals(BaseResource.SP_RES_ID)) {
      if (nextParamEntry.getValue().isEmpty()) {
        continue;
      }
 else {
        for (        List<? extends IQueryParameterType> nextValue : nextParamEntry.getValue()) {
          Set<Long> joinPids=new HashSet<Long>();
          if (nextValue == null || nextValue.size() == 0) {
            continue;
          }
 else {
            for (            IQueryParameterType next : nextValue) {
              String value=next.getValueAsQueryToken(myContext);
              IIdType valueId=new IdDt(value);
              try {
                BaseHasResource entity=myCallingDao.readEntity(valueId);
                if (entity.getDeleted() != null) {
                  continue;
                }
                joinPids.add(entity.getId());
              }
 catch (              ResourceNotFoundException e) {
              }
            }
            if (joinPids.isEmpty()) {
              doSetPids(new HashSet<Long>());
              return;
            }
          }
          addPredicateId(joinPids);
          if (doHaveNoResults()) {
            return;
          }
        }
      }
    }
 else     if (nextParamName.equals(BaseResource.SP_RES_LANGUAGE)) {
      addPredicateLanguage(nextParamEntry.getValue());
    }
 else     if (nextParamName.equals(Constants.PARAM_HAS)) {
      addPredicateHas(nextParamEntry.getValue(),theLastUpdated);
    }
 else     if (nextParamName.equals(Constants.PARAM_TAG) || nextParamName.equals(Constants.PARAM_PROFILE) || nextParamName.equals(Constants.PARAM_SECURITY)) {
      addPredicateTag(nextParamEntry.getValue(),nextParamName,theLastUpdated);
    }
 else {
      RuntimeSearchParam nextParamDef=mySearchParamRegistry.getActiveSearchParam(myResourceName,nextParamName);
      if (nextParamDef != null) {
switch (nextParamDef.getParamType()) {
case DATE:
          for (          List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
            addPredicateDate(nextParamName,nextAnd);
            if (doHaveNoResults()) {
              return;
            }
          }
        break;
case QUANTITY:
      for (      List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
        addPredicateQuantity(nextParamName,nextAnd);
        if (doHaveNoResults()) {
          return;
        }
      }
    break;
case REFERENCE:
  for (  List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
    addPredicateReference(nextParamName,nextAnd);
    if (doHaveNoResults()) {
      return;
    }
  }
break;
case STRING:
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
addPredicateString(nextParamName,nextAnd);
if (doHaveNoResults()) {
  return;
}
}
break;
case TOKEN:
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
addPredicateToken(nextParamName,nextAnd);
if (doHaveNoResults()) {
return;
}
}
break;
case NUMBER:
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
addPredicateNumber(nextParamName,nextAnd);
if (doHaveNoResults()) {
return;
}
}
break;
case COMPOSITE:
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
addPredicateComposite(nextParamDef,nextAnd);
if (doHaveNoResults()) {
return;
}
}
break;
case URI:
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
addPredicateUri(nextParamName,nextAnd);
if (doHaveNoResults()) {
return;
}
}
break;
}
}
}
if (doHaveNoResults()) {
return;
}
}
}

Fixed version (ground truth):
private void searchForIdsWithAndOr(SearchParameterMap theParams,DateRangeParam theLastUpdated){
  SearchParameterMap params=theParams;
  if (params == null) {
    params=new SearchParameterMap();
  }
  myParams=theParams;
  doInitializeSearch();
  for (  Entry<String,List<List<? extends IQueryParameterType>>> nextParamEntry : params.entrySet()) {
    String nextParamName=nextParamEntry.getKey();
    if (nextParamName.equals(BaseResource.SP_RES_ID)) {
      if (nextParamEntry.getValue().isEmpty()) {
        continue;
      }
 else {
        for (        List<? extends IQueryParameterType> nextValue : nextParamEntry.getValue()) {
          Set<Long> joinPids=new HashSet<Long>();
          if (nextValue == null || nextValue.size() == 0) {
            continue;
          }
 else {
            for (            IQueryParameterType next : nextValue) {
              String value=next.getValueAsQueryToken(myContext);
              IIdType valueId=new IdDt(value);
              try {
                BaseHasResource entity=myCallingDao.readEntity(valueId);
                if (entity.getDeleted() != null) {
                  continue;
                }
                joinPids.add(entity.getId());
              }
 catch (              ResourceNotFoundException e) {
              }
            }
            if (joinPids.isEmpty()) {
              doSetPids(new HashSet<Long>());
              return;
            }
          }
          addPredicateId(joinPids);
          if (doHaveNoResults()) {
            return;
          }
        }
      }
    }
 else     if (nextParamName.equals(BaseResource.SP_RES_LANGUAGE)) {
      addPredicateLanguage(nextParamEntry.getValue());
    }
 else     if (nextParamName.equals(Constants.PARAM_HAS)) {
      addPredicateHas(nextParamEntry.getValue(),theLastUpdated);
    }
 else     if (nextParamName.equals(Constants.PARAM_TAG) || nextParamName.equals(Constants.PARAM_PROFILE) || nextParamName.equals(Constants.PARAM_SECURITY)) {
      addPredicateTag(nextParamEntry.getValue(),nextParamName,theLastUpdated);
    }
 else {
      RuntimeSearchParam nextParamDef=mySearchParamRegistry.getActiveSearchParam(myResourceName,nextParamName);
      if (nextParamDef != null) {
switch (nextParamDef.getParamType()) {
case DATE:
          for (          List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
            addPredicateDate(nextParamName,nextAnd);
            if (doHaveNoResults()) {
              return;
            }
          }
        break;
case QUANTITY:
      for (      List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
        addPredicateQuantity(nextParamName,nextAnd);
        if (doHaveNoResults()) {
          return;
        }
      }
    break;
case REFERENCE:
  for (  List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
    addPredicateReference(nextParamName,nextAnd);
    if (doHaveNoResults()) {
      return;
    }
  }
break;
case STRING:
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
addPredicateString(nextParamName,nextAnd);
if (doHaveNoResults()) {
  return;
}
}
break;
case TOKEN:
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
addPredicateToken(nextParamName,nextAnd);
if (doHaveNoResults()) {
return;
}
}
break;
case NUMBER:
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
addPredicateNumber(nextParamName,nextAnd);
if (doHaveNoResults()) {
return;
}
}
break;
case COMPOSITE:
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
addPredicateComposite(nextParamDef,nextAnd);
if (doHaveNoResults()) {
return;
}
}
break;
case URI:
for (List<? extends IQueryParameterType> nextAnd : nextParamEntry.getValue()) {
addPredicateUri(nextParamName,nextAnd);
if (doHaveNoResults()) {
return;
}
}
break;
case HAS:
break;
}
}
}
if (doHaveNoResults()) {
return;
}
}
}