Program: 61513
Project: 61513
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;
  boolean continueSearching=true;
  int elementsFromFixSpace=getSpaceSize(modificationPoint,operationType);
  Stats.currentStat.initializeIngCounter(variant_id);
  while (continueSearching && attempts < elementsFromFixSpace) {
    Ingredient randomIngredient=super.getFixIngredient(modificationPoint,operationType);
    if (randomIngredient == null || randomIngredient.getCode() == null) {
      return null;
    }
    CtElement elementFromIngredient=randomIngredient.getCode();
    attempts++;
    boolean alreadyApplied=alreadySelected(modificationPoint,elementFromIngredient,operationType);
    if (alreadyApplied) {
      log.debug("String_Node_Str");
      continue;
    }
    boolean sameCode=elementFromIngredient.toString().equals(modificationPoint.getCodeElement().toString());
    if (sameCode) {
      log.debug("String_Node_Str");
      continue;
    }
    boolean transformIngredient=ConfigurationProperties.getPropertyBool("String_Node_Str");
    if (transformIngredient) {
      if (modificationPoint.getContextOfModificationPoint().isEmpty()) {
        log.debug("String_Node_Str");
      }
      VarMapping mapping=VariableResolver.mapVariables(modificationPoint.getContextOfModificationPoint(),elementFromIngredient);
      if (mapping.getNotMappedVariables().isEmpty()) {
        if (mapping.getMappedVariables().isEmpty()) {
          log.debug("String_Node_Str");
          continueSearching=false;
        }
 else {
          log.debug("String_Node_Str" + elementFromIngredient);
          List<Map<String,CtVariable>> allCombinations=VariableResolver.findAllVarMappingCombination(mapping.getMappedVariables());
          if (allCombinations.size() > 0) {
            Map<String,CtVariable> selectedTransformation=allCombinations.get(0);
            log.debug("String_Node_Str" + selectedTransformation);
            Map<CtVariableAccess,CtVariableReference> originalMap=VariableResolver.convertIngredient(mapping,selectedTransformation);
            log.debug("String_Node_Str" + elementFromIngredient);
            continueSearching=!VariableResolver.fitInPlace(modificationPoint.getContextOfModificationPoint(),elementFromIngredient);
          }
        }
      }
 else {
        log.debug("String_Node_Str" + mapping.getNotMappedVariables());
      }
    }
 else {
      continueSearching=!VariableResolver.fitInPlace(modificationPoint.getContextOfModificationPoint(),elementFromIngredient);
    }
    Stats.currentStat.incrementIngCounter(variant_id);
    if (!continueSearching) {
      IngredientSpaceScope scope=determineIngredientScope(modificationPoint.getCodeElement(),elementFromIngredient);
      int ingCounter=Stats.currentStat.temporalIngCounter.get(variant_id);
      log.debug("String_Node_Str" + ingCounter);
      return new Ingredient(elementFromIngredient,scope);
    }
  }
  log.debug("String_Node_Str" + 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;
  boolean continueSearching=true;
  int elementsFromFixSpace=getSpaceSize(modificationPoint,operationType);
  Stats.currentStat.initializeIngCounter(variant_id);
  while (continueSearching && attempts < elementsFromFixSpace) {
    Ingredient randomIngredient=super.getFixIngredient(modificationPoint,operationType);
    if (randomIngredient == null || randomIngredient.getCode() == null) {
      return null;
    }
    CtElement elementFromIngredient=randomIngredient.getCode();
    attempts++;
    boolean alreadyApplied=alreadySelected(modificationPoint,elementFromIngredient,operationType);
    if (alreadyApplied) {
      log.debug("String_Node_Str");
      continue;
    }
    boolean sameCode=elementFromIngredient.toString().equals(modificationPoint.getCodeElement().toString());
    if (sameCode) {
      log.debug("String_Node_Str");
      continue;
    }
    boolean transformIngredient=ConfigurationProperties.getPropertyBool("String_Node_Str");
    if (transformIngredient) {
      if (modificationPoint.getContextOfModificationPoint().isEmpty()) {
        log.debug("String_Node_Str");
      }
      VarMapping mapping=VariableResolver.mapVariables(modificationPoint.getContextOfModificationPoint(),elementFromIngredient);
      if (mapping.getNotMappedVariables().isEmpty()) {
        if (mapping.getMappedVariables().isEmpty()) {
          log.debug("String_Node_Str");
          continueSearching=false;
        }
 else {
          log.debug("String_Node_Str" + elementFromIngredient);
          List<Map<String,CtVariable>> allCombinations=VariableResolver.findAllVarMappingCombination(mapping.getMappedVariables());
          if (allCombinations.size() > 0) {
            Map<String,CtVariable> selectedTransformation=allCombinations.get(0);
            log.debug("String_Node_Str" + selectedTransformation);
            Map<VarAccessWrapper,CtVariableAccess> originalMap=VariableResolver.convertIngredient(mapping,selectedTransformation);
            log.debug("String_Node_Str" + elementFromIngredient);
            continueSearching=!VariableResolver.fitInPlace(modificationPoint.getContextOfModificationPoint(),elementFromIngredient);
          }
        }
      }
 else {
        log.debug("String_Node_Str" + mapping.getNotMappedVariables());
      }
    }
 else {
      continueSearching=!VariableResolver.fitInPlace(modificationPoint.getContextOfModificationPoint(),elementFromIngredient);
    }
    Stats.currentStat.incrementIngCounter(variant_id);
    if (!continueSearching) {
      IngredientSpaceScope scope=determineIngredientScope(modificationPoint.getCodeElement(),elementFromIngredient);
      int ingCounter=Stats.currentStat.temporalIngCounter.get(variant_id);
      log.debug("String_Node_Str" + ingCounter);
      return new Ingredient(elementFromIngredient,scope);
    }
  }
  log.debug("String_Node_Str" + modificationPoint.getCodeElement().getShortRepresentation() + "String_Node_Str"+ elementsFromFixSpace);
  return null;
}