Program: 50545
Project: 50545
Buggy source:
public void calcMaltTotals(){
  double maltPoints=0;
  double mcu=0;
  totalMaltLbs=0;
  totalMaltCost=0;
  totalMashLbs=0;
  for (int i=0; i < fermentables.size(); i++) {
    Fermentable m=((Fermentable)fermentables.get(i));
    totalMaltLbs+=(m.getAmountAs("String_Node_Str"));
    if (m.getMashed()) {
      maltPoints+=(m.getPppg() - 1) * m.getAmountAs("String_Node_Str") * efficiency / postBoilVol.getValueAs("String_Node_Str");
      totalMashLbs+=(m.getAmountAs("String_Node_Str"));
    }
 else     maltPoints+=(m.getPppg() - 1) * m.getAmountAs("String_Node_Str") * 100 / postBoilVol.getValueAs("String_Node_Str");
    mcu+=m.getLov() * m.getAmountAs("String_Node_Str") / postBoilVol.getValueAs("String_Node_Str");
    totalMaltCost+=m.getCostPerU() * m.getAmountAs("String_Node_Str");
  }
  for (int i=0; i < fermentables.size(); i++) {
    Fermentable m=((Fermentable)fermentables.get(i));
    m.setPercent((m.getAmountAs("String_Node_Str") / totalMaltLbs * 100));
  }
  estOg=(maltPoints / 100) + 1;
  estFg=1 + ((estOg - 1) * ((100 - attenuation) / 100));
  srm=calcColour(mcu);
  mash.setMaltWeight(totalMashLbs);
  calcAlcohol(getAlcMethod());
  chillShrinkQTS=getPostBoilVol("String_Node_Str") * 0.03;
  spargeQTS=getPreBoilVol("String_Node_Str") - (mash.getTotalWaterQts() - mash.getAbsorbedQts());
  totalWaterQTS=mash.getTotalWaterQts() + spargeQTS;
  finalWortVolQTS=postBoilVol.getValueAs("String_Node_Str") - (chillShrinkQTS + Quantity.convertUnit(getVolUnits(),"String_Node_Str",kettleLoss) + Quantity.convertUnit(getVolUnits(),"String_Node_Str",trubLoss)+ Quantity.convertUnit(getVolUnits(),"String_Node_Str",miscLoss));
}

Fixed version (ground truth):
public void calcMaltTotals(){
  double maltPoints=0;
  double mcu=0;
  totalMaltLbs=0;
  totalMaltCost=0;
  totalMashLbs=0;
  for (int i=0; i < fermentables.size(); i++) {
    Fermentable m=((Fermentable)fermentables.get(i));
    totalMaltLbs+=(m.getAmountAs("String_Node_Str"));
    if (m.getMashed()) {
      maltPoints+=(m.getPppg() - 1) * m.getAmountAs("String_Node_Str") * efficiency / postBoilVol.getValueAs("String_Node_Str");
      totalMashLbs+=(m.getAmountAs("String_Node_Str"));
    }
 else     maltPoints+=(m.getPppg() - 1) * m.getAmountAs("String_Node_Str") * 100 / postBoilVol.getValueAs("String_Node_Str");
    mcu+=m.getLov() * m.getAmountAs("String_Node_Str") / postBoilVol.getValueAs("String_Node_Str");
    totalMaltCost+=m.getCostPerU() * m.getAmountAs(m.getUnits());
  }
  for (int i=0; i < fermentables.size(); i++) {
    Fermentable m=((Fermentable)fermentables.get(i));
    m.setPercent((m.getAmountAs("String_Node_Str") / totalMaltLbs * 100));
  }
  estOg=(maltPoints / 100) + 1;
  estFg=1 + ((estOg - 1) * ((100 - attenuation) / 100));
  srm=calcColour(mcu);
  mash.setMaltWeight(totalMashLbs);
  calcAlcohol(getAlcMethod());
  chillShrinkQTS=getPostBoilVol("String_Node_Str") * 0.03;
  spargeQTS=getPreBoilVol("String_Node_Str") - (mash.getTotalWaterQts() - mash.getAbsorbedQts());
  totalWaterQTS=mash.getTotalWaterQts() + spargeQTS;
  finalWortVolQTS=postBoilVol.getValueAs("String_Node_Str") - (chillShrinkQTS + Quantity.convertUnit(getVolUnits(),"String_Node_Str",kettleLoss) + Quantity.convertUnit(getVolUnits(),"String_Node_Str",trubLoss)+ Quantity.convertUnit(getVolUnits(),"String_Node_Str",miscLoss));
}