Program: 61484
Project: 61484
Buggy source:
/** 
 * Return an ingredient. As it has a cache, it never returns twice the same ingredient.
 * @param modificationPoint
 * @param targetStmt
 * @param operationType
 * @param elementsFromFixSpace
 * @return
 */
@Override public Ingredient getFixIngredient(ModificationPoint modificationPoint,AstorOperator operationType){
  int variant_id=modificationPoint.getProgramVariant().getId();
  int attempts=0;
  int elementsFromFixSpace=getSpaceSize(modificationPoint,operationType);
  Stats.currentStat.initializeIngCounter(variant_id);
  while (attempts < elementsFromFixSpace) {
    Ingredient randomIngredient=super.getFixIngredient(modificationPoint,operationType);
    if (randomIngredient == null || randomIngredient.getCode() == null) {
      return null;
    }
    CtElement elementFromIngredient=randomIngredient.getCode();
    boolean alreadyApplied=alreadySelected(modificationPoint,elementFromIngredient,operationType);
    attempts=appliedCache.get(getKey(modificationPoint,operationType)).size();
    log.debug(String.format("String_Node_Str",attempts,elementsFromFixSpace));
    if (alreadyApplied) {
      log.debug("String_Node_Str");
      continue;
    }
    boolean sameCode=elementFromIngredient.toString().equals(modificationPoint.getCodeElement().toString());
    if (sameCode) {
      log.debug("String_Node_Str");
      continue;
    }
    IngredientSpaceScope scope=VariableResolver.determineIngredientScope(modificationPoint.getCodeElement(),elementFromIngredient);
    randomIngredient.setScope(scope);
    return randomIngredient;
  }
  log.debug("String_Node_Str" + StringUtil.trunc(modificationPoint.getCodeElement().getShortRepresentation()) + "String_Node_Str"+ elementsFromFixSpace);
  return null;
}

Fixed version (ground truth):
/** 
 * Return an ingredient. As it has a cache, it never returns twice the same ingredient.
 * @param modificationPoint
 * @param targetStmt
 * @param operationType
 * @param elementsFromFixSpace
 * @return
 */
@Override public Ingredient getFixIngredient(ModificationPoint modificationPoint,AstorOperator operationType){
  int variant_id=modificationPoint.getProgramVariant().getId();
  int attempts=0;
  int alreadyAnalyzed=0;
  int elementsFromFixSpace=getSpaceSize(modificationPoint,operationType);
  Stats.currentStat.initializeIngCounter(variant_id);
  while (alreadyAnalyzed < elementsFromFixSpace) {
    Ingredient randomIngredient=super.getFixIngredient(modificationPoint,operationType);
    if (randomIngredient == null || randomIngredient.getCode() == null) {
      return null;
    }
    CtElement elementFromIngredient=randomIngredient.getCode();
    boolean alreadyApplied=alreadySelected(modificationPoint,elementFromIngredient,operationType);
    alreadyAnalyzed=appliedCache.get(getKey(modificationPoint,operationType)).size();
    log.debug(String.format("String_Node_Str",alreadyAnalyzed,elementsFromFixSpace));
    attempts++;
    if (attempts > (elementsFromFixSpace * 3)) {
      log.error("String_Node_Str" + attempts);
      return null;
    }
    if (alreadyApplied) {
      log.debug("String_Node_Str");
      continue;
    }
    boolean sameCode=elementFromIngredient.toString().equals(modificationPoint.getCodeElement().toString());
    if (sameCode) {
      log.debug("String_Node_Str");
      continue;
    }
    return randomIngredient;
  }
  log.debug("String_Node_Str" + StringUtil.trunc(modificationPoint.getCodeElement().getShortRepresentation()) + "String_Node_Str"+ elementsFromFixSpace);
  return null;
}