nus-yam/ex-repair huggingface dataset:
Program: 35093
Project: 35093
Buggy source:
/** 
 * Solves a given Expression Cleans off the expression, adds missing parentheses, then loads in more accurate result values if possible into expression Iterates over expression using PEMAS order of operations
 * @param exp is the Expression to solve
 * @param mcSolve is the rounding to use to solve
 * @return the expression before conversion (potentially used for result list)
 */
public Result solve(Expression exp){
  exp.cleanDanglingOps();
  exp.closeOpenPar();
  String cleanedQuery=exp.toString();
  if (exp.isEmpty())   return null;
  exp.loadPreciseResult();
  System.out.println(exp.toString());
  exp.replacePercentOps();
  String strExp=collapsePara(exp.toString());
  exp.replaceExpression(strExp);
  roundAndClean(exp);
  exp.setSolved(true);
  return new Result(cleanedQuery,exp.toString());
}

Fixed version (ground truth):
/** 
 * Solves a given Expression Cleans off the expression, adds missing parentheses, then loads in more accurate result values if possible into expression Iterates over expression using PEMAS order of operations
 * @param exp is the Expression to solve
 * @param mcSolve is the rounding to use to solve
 * @return the expression before conversion (potentially used for result list)
 */
public Result solve(Expression exp){
  exp.cleanDanglingOps();
  exp.closeOpenPar();
  String cleanedQuery=exp.toString();
  if (exp.isEmpty())   return null;
  exp.loadPreciseResult();
  exp.replacePercentOps();
  exp.groupPowerOperand();
  String strExp=collapsePara(exp.toString());
  exp.replaceExpression(strExp);
  roundAndClean(exp);
  exp.setSolved(true);
  return new Result(cleanedQuery,exp.toString());
}
Program: 35095
Project: 35095
Buggy source:
/** 
 * Passed a key from calculator (num/op/back/clear/eq) and distributes it to its proper function
 * @param sKey is either single character (but still a String) or a string from result list
 */
public void parseKeyPressed(String sKey){
  if (mExpression.isInvalid())   mExpression.replaceExpression("String_Node_Str");
  if (sKey.equals("String_Node_Str")) {
    boolean solveSuccess=solveAndLoadIntoResultList();
    if (!solveSuccess)     return;
    try {
      mExpression.roundAndCleanExpression();
    }
 catch (    NumberFormatException e) {
      mExpression.replaceExpression(strSyntaxError);
    }
    mResultList.get(mResultList.size() - 1).setAnswer(mExpression.toString());
  }
 else   if (sKey.equals("String_Node_Str"))   backspace();
 else   if (sKey.equals("String_Node_Str"))   clear();
 else {
    if (mExpression.isSolved() && sKey.matches("String_Node_Str"))     mUnitTypeArray.get(mUnitTypePos).clearUnitSelection();
    mExpression.keyPresses(sKey);
  }
}

Fixed version (ground truth):
/** 
 * Passed a key from calculator (num/op/back/clear/eq) and distributes it to its proper function
 * @param sKey is either single character (but still a String) or a string from result list
 */
public void parseKeyPressed(String sKey){
  if (isExpressionInvalid())   mExpression.clearExpression();
  if (sKey.equals("String_Node_Str")) {
    boolean solveSuccess=solveAndLoadIntoResultList();
    if (!solveSuccess)     return;
    try {
      mExpression.roundAndCleanExpression();
    }
 catch (    NumberFormatException e) {
      mExpression.replaceExpression(strSyntaxError);
    }
    mResultList.get(mResultList.size() - 1).setAnswer(mExpression.toString());
  }
 else   if (sKey.equals("String_Node_Str"))   backspace();
 else   if (sKey.equals("String_Node_Str"))   clear();
 else {
    if (mExpression.isSolved() && sKey.matches("String_Node_Str"))     mUnitTypeArray.get(mUnitTypePos).clearUnitSelection();
    mExpression.keyPresses(sKey);
  }
}
Program: 35096
Project: 35096
Buggy source:
/** 
 * Function used to convert from one unit to another
 * @param fromValue is standardized value of the unit being converted from
 * @param toValue is standardized value of the unit being converted to
 */
public void convertFromTo(Unit fromUnit,Unit toUnit){
  if (mExpression.isEmpty() || mExpression.isInvalid())   return;
  boolean solveSuccess=solveAndLoadIntoResultList();
  if (!solveSuccess)   return;
  try {
    BigDecimal bdToUnit=new BigDecimal(toUnit.getValue(),mMcOperate);
    BigDecimal bdCurrUnit=new BigDecimal(fromUnit.getValue(),mMcOperate);
    BigDecimal bdCurrUnitIntercept=new BigDecimal(fromUnit.getIntercept(),mMcOperate);
    BigDecimal bdResult=new BigDecimal(mExpression.toString(),mMcOperate);
    mExpression.replaceExpression(bdCurrUnitIntercept.add(bdResult.multiply(bdToUnit.divide(bdCurrUnit,mMcOperate),mMcOperate)).toString());
  }
 catch (  NumberFormatException e) {
    mExpression.replaceExpression(strSyntaxError);
    return;
  }
  try {
    mExpression.roundAndCleanExpression();
  }
 catch (  NumberFormatException e) {
    mExpression.replaceExpression(strSyntaxError);
    return;
  }
  mResultList.get(mResultList.size() - 1).setResultUnit(fromUnit,toUnit,mUnitTypePos);
  mResultList.get(mResultList.size() - 1).setAnswer(mExpression.toString());
}

Fixed version (ground truth):
/** 
 * Function used to convert from one unit to another
 * @param fromValue is standardized value of the unit being converted from
 * @param toValue is standardized value of the unit being converted to
 */
public void convertFromTo(Unit fromUnit,Unit toUnit){
  if (isExpressionEmpty() || isExpressionInvalid())   return;
  boolean solveSuccess=solveAndLoadIntoResultList();
  if (!solveSuccess)   return;
  try {
    BigDecimal bdToUnit=new BigDecimal(toUnit.getValue(),mMcOperate);
    BigDecimal bdCurrUnit=new BigDecimal(fromUnit.getValue(),mMcOperate);
    BigDecimal bdCurrUnitIntercept=new BigDecimal(fromUnit.getIntercept(),mMcOperate);
    BigDecimal bdResult=new BigDecimal(mExpression.toString(),mMcOperate);
    BigDecimal bdScaled=bdResult.multiply(bdToUnit.divide(bdCurrUnit,mMcOperate),mMcOperate);
    if (bdScaled.scale() < -9000 || bdCurrUnitIntercept.scale() < -9000)     throw new NumberFormatException(strInfinityError);
    mExpression.replaceExpression(bdCurrUnitIntercept.add(bdScaled,mMcOperate).toString());
  }
 catch (  NumberFormatException e) {
    if (e.getMessage().equals(strInfinityError))     mExpression.replaceExpression(strInfinityError);
 else     mExpression.replaceExpression(strSyntaxError);
    return;
  }
  try {
    mExpression.roundAndCleanExpression();
  }
 catch (  NumberFormatException e) {
    mExpression.replaceExpression(strSyntaxError);
    return;
  }
  mResultList.get(mResultList.size() - 1).setResultUnit(fromUnit,toUnit,mUnitTypePos);
  mResultList.get(mResultList.size() - 1).setAnswer(mExpression.toString());
}
Program: 35097
Project: 35097
Buggy source:
/** 
 * Updates the text with current value from calc. Preserves calc's cursor selections
 */
public void updateTextFromCalc(){
  int selStart=mCalc.getSelectionStart();
  int selEnd=mCalc.getSelectionEnd();
  String text=mCalc.toString();
  if (!mCalc.toString().equals("String_Node_Str") && mCalc.getCurrUnitType().isUnitSelected())   text=text + "String_Node_Str" + mCalc.getCurrUnitType().getSelectedUnit().toString();
  setText(text);
  setSelection(selStart,selEnd);
  if (selStart == mCalc.toString().length())   setCursorVisible(false);
 else   setCursorVisible(true);
}

Fixed version (ground truth):
/** 
 * Updates the text with current value from calc. Preserves calc's cursor selections
 */
public void updateTextFromCalc(){
  int selStart=mCalc.getSelectionStart();
  int selEnd=mCalc.getSelectionEnd();
  String text=mCalc.toString();
  if (!mCalc.isExpressionInvalid() && !mCalc.isExpressionEmpty() && mCalc.getCurrUnitType().isUnitSelected())   text=text + "String_Node_Str" + mCalc.getCurrUnitType().getSelectedUnit().toString();
  setText(text);
  setSelection(selStart,selEnd);
  if (selStart == mCalc.toString().length())   setCursorVisible(false);
 else   setCursorVisible(true);
}
Program: 35098
Project: 35098
Buggy source:
/** 
 * Replaces % operators their respective evaluable operators
 */
public void replacePercentOps(){
  String str=mExpression.toString();
  String subStr="String_Node_Str";
  for (int i=0; i < str.length(); i++) {
    if (str.charAt(i) == '%') {
      subStr=str.substring(0,i);
      String lastNum=getLastNumb(subStr);
      subStr=subStr.substring(0,subStr.length() - lastNum.length());
      if (!subStr.equals("String_Node_Str")) {
        String lastOp=subStr.substring(subStr.length() - 1,subStr.length());
        subStr=subStr.substring(0,subStr.length() - 1);
        if (lastOp.matches(regexGroupedAddSub) && !subStr.equals("String_Node_Str"))         subStr="String_Node_Str" + subStr + "String_Node_Str"+ lastOp+ lastNum+ "String_Node_Str";
 else         subStr=subStr + lastOp + "String_Node_Str"+ lastNum+ "String_Node_Str";
      }
 else       subStr="String_Node_Str" + lastNum + "String_Node_Str";
      str=subStr + str.substring(i + 1,str.length());
      i=subStr.length();
      System.out.println("String_Node_Str" + i);
      System.out.println("String_Node_Str" + str);
      System.out.println("String_Node_Str" + subStr);
    }
  }
  replaceExpression(str);
}

Fixed version (ground truth):
/** 
 * Replaces % operators their respective operators 
 */
public void replacePercentOps(){
  String str=mExpression.toString();
  String subStr="String_Node_Str";
  for (int i=0; i < str.length(); i++) {
    if (str.charAt(i) == '%') {
      subStr=str.substring(0,i);
      String lastNum=getLastNumb(subStr);
      subStr=subStr.substring(0,subStr.length() - lastNum.length());
      if (!subStr.equals("String_Node_Str")) {
        String lastOp=subStr.substring(subStr.length() - 1,subStr.length());
        subStr=subStr.substring(0,subStr.length() - 1);
        if (lastOp.matches(regexGroupedAddSub) && !subStr.equals("String_Node_Str"))         subStr="String_Node_Str" + subStr + "String_Node_Str"+ lastOp+ lastNum+ "String_Node_Str";
 else         subStr=subStr + lastOp + "String_Node_Str"+ lastNum+ "String_Node_Str";
      }
 else       subStr="String_Node_Str" + lastNum + "String_Node_Str";
      str=subStr + str.substring(i + 1,str.length());
      i=subStr.length();
    }
  }
  replaceExpression(str);
}
Program: 35099
Project: 35099
Buggy source:
public Expression(JSONObject json,int displayPrecision) throws JSONException {
  this(displayPrecision);
  replaceExpression(json.getString(JSON_EXPRESSION));
  mPreciseResult=json.getString(JSON_PRECISE);
  System.out.println("String_Node_Str");
  System.out.println("String_Node_Str" + mSelectionStart);
  System.out.println("String_Node_Str" + mSelectionEnd);
  setSolved(json.getBoolean(JSON_SOLVED));
}

Fixed version (ground truth):
public Expression(JSONObject json,int displayPrecision) throws JSONException {
  this(displayPrecision);
  replaceExpression(json.getString(JSON_EXPRESSION));
  mPreciseResult=json.getString(JSON_PRECISE);
  System.out.println("String_Node_Str" + mSelectionStart);
  System.out.println("String_Node_Str" + mSelectionEnd);
  setSolved(json.getBoolean(JSON_SOLVED));
}
Program: 35100
Project: 35100
Buggy source:
/** 
 * Rounds expression down by a MathContext mcDisp
 * @throws NumberFormatException if Expression not formatted correctly
 */
public void roundAndCleanExpression(){
  if (isInvalid() || mExpression.equals("String_Node_Str"))   return;
  BigDecimal bd;
  bd=new BigDecimal(mExpression,mMcDisp);
  mPreciseResult=mExpression;
  if (lastNumbExponent() < mIntDisplayPrecision)   replaceExpression(bd.toPlainString());
 else   replaceExpression(bd.toString());
  replaceExpression(cleanFormatting(mExpression));
}

Fixed version (ground truth):
/** 
 * Rounds expression down by a MathContext mcDisp
 * @throws NumberFormatException if Expression not formatted correctly
 */
public void roundAndCleanExpression(){
  if (isInvalid() || isEmpty())   return;
  BigDecimal bd;
  bd=new BigDecimal(mExpression,mMcDisp);
  mPreciseResult=mExpression;
  if (lastNumbExponent() < mIntDisplayPrecision)   replaceExpression(bd.toPlainString());
 else   replaceExpression(bd.toString());
  replaceExpression(cleanFormatting(mExpression));
}
Program: 35102
Project: 35102
Buggy source:
@Override public void onPageSelected(int pos){
  mCalc.setUnitTypePos(pos);
  DisplayMetrics metrics=getResources().getDisplayMetrics();
  int padLeft=(int)(metrics.density * 8f + 0.5f);
  int padRight=(int)(metrics.density * 8f + 0.5f);
  mConvKeysViewPager.setPadding(padLeft,0,padRight,0);
  int currConvKeyPos=mConvKeysViewPager.getCurrentItem();
  clearConvKeyForFragPos(currConvKeyPos - 1);
  clearConvKeyForFragPos(currConvKeyPos + 1);
  if (unitToSelectAfterScroll != null) {
    getConvKeyFrag(mConvKeysViewPager.getCurrentItem()).selectUnit(unitToSelectAfterScroll);
    unitToSelectAfterScroll=null;
  }
}

Fixed version (ground truth):
@Override public void onPageSelected(int pos){
  mCalc.setUnitTypePos(pos);
  DisplayMetrics metrics=getResources().getDisplayMetrics();
  int padLeft=(int)(metrics.density * 8f + 0.5f);
  int padRight=(int)(metrics.density * 8f + 0.5f);
  mConvKeysViewPager.setPadding(padLeft,0,padRight,0);
  int currConvKeyPos=mConvKeysViewPager.getCurrentItem();
  clearConvKeyForFragPos(currConvKeyPos - 1);
  clearConvKeyForFragPos(currConvKeyPos);
  clearConvKeyForFragPos(currConvKeyPos + 1);
  mCalc.getCurrUnitType().clearUnitSelection();
  if (unitToSelectAfterScroll != null) {
    getConvKeyFrag(mConvKeysViewPager.getCurrentItem()).selectUnit(unitToSelectAfterScroll);
    unitToSelectAfterScroll=null;
  }
  updateScreen(false);
}
Program: 35103
Project: 35103
Buggy source:
/** 
 * Clear the unit selection for convert key fragment at position pos
 * @param pos the position of the desired convert key fragment to clear selected units from 
 */
private void clearConvKeyForFragPos(int pos){
  ConvKeysFragment currFragLeft=getConvKeyFrag(pos);
  if (currFragLeft != null)   currFragLeft.clearButtonSelection();
}

Fixed version (ground truth):
/** 
 * Clear the unit selection for convert key fragment at position pos
 * @param pos the position of the desired convert key fragment to clear selected units from 
 */
private void clearConvKeyForFragPos(int pos){
  ConvKeysFragment currFragAtPos=getConvKeyFrag(pos);
  if (currFragAtPos != null)   currFragAtPos.clearButtonSelection();
}
Program: 35104
Project: 35104
Buggy source:
public void clearButtonSelection(){
  if (mConvButton == null)   return;
  Button prevSelected=mConvButton.get(mUnitType.getCurrUnitPos());
  prevSelected.setSelected(false);
}

Fixed version (ground truth):
/** 
 * Clears the button unit selection 
 */
public void clearButtonSelection(){
  if (mConvButton == null)   return;
  Button prevSelected=mConvButton.get(mUnitType.getCurrUnitPos());
  prevSelected.setSelected(false);
}
Program: 35105
Project: 35105
Buggy source:
/** 
 * Used to pass selected unit to the UnitType model class
 * @param buttonPos the position in the list of buttons to select 
 */
private void clickUnitButton(int buttonPos){
  clearButtonSelection();
  boolean didConvert=mUnitType.selectUnit(buttonPos);
  if (didConvert)   mCallback.updateScreen(true);
  colorSelectedButton();
}

Fixed version (ground truth):
/** 
 * Used to pass selected unit to the UnitType model class
 * @param buttonPos the position in the list of buttons to select 
 */
private void clickUnitButton(int buttonPos){
  clearButtonSelection();
  boolean didConvert=mUnitType.selectUnit(buttonPos);
  mCallback.updateScreen(true);
  colorSelectedButton();
}
Program: 35106
Project: 35106
Buggy source:
@Override protected void onSelectionChanged(int selStart,int selEnd){
  if (mCalc != null) {
    if (mCalc.toString().equals("String_Node_Str"))     return;
    int expLen=mCalc.toString().length();
    if (selEnd > expLen) {
      setSelection(selStart,expLen);
      return;
    }
    if (selStart > expLen) {
      setSelection(expLen,selEnd);
      return;
    }
    mCalc.setSelection(selStart,selEnd);
    setCursorVisible(true);
  }
}

Fixed version (ground truth):
@Override protected void onSelectionChanged(int selStart,int selEnd){
  if (mCalc != null) {
    int expLen=mCalc.toString().length();
    if (selEnd > expLen) {
      setSelection(selStart,expLen);
      return;
    }
    if (selStart > expLen) {
      setSelection(expLen,selEnd);
      return;
    }
    mCalc.setSelection(selStart,selEnd);
    setCursorVisible(true);
  }
}
Program: 35107
Project: 35107
Buggy source:
/** 
 * Updates the text with current value from calc. Preserves calc's cursor selections
 */
public void updateTextFromCalc(){
  int selStart=mCalc.getSelectionStart();
  int selEnd=mCalc.getSelectionEnd();
  String text=mCalc.toString();
  if (mCalc.getCurrUnitType().isUnitSelected())   text=text + "String_Node_Str" + mCalc.getCurrUnitType().getSelectedUnit().toString();
  setText(text);
  setSelection(selStart,selEnd);
  if (selStart == mCalc.toString().length())   setCursorVisible(false);
 else   setCursorVisible(true);
}

Fixed version (ground truth):
/** 
 * Updates the text with current value from calc. Preserves calc's cursor selections
 */
public void updateTextFromCalc(){
  int selStart=mCalc.getSelectionStart();
  int selEnd=mCalc.getSelectionEnd();
  String text=mCalc.toString();
  if (!mCalc.toString().equals("String_Node_Str") && mCalc.getCurrUnitType().isUnitSelected())   text=text + "String_Node_Str" + mCalc.getCurrUnitType().getSelectedUnit().toString();
  setText(text);
  setSelection(selStart,selEnd);
  if (selStart == mCalc.toString().length())   setCursorVisible(false);
 else   setCursorVisible(true);
}
Program: 35109
Project: 35109
Buggy source:
public Expression(JSONObject json,int displayPrecision) throws JSONException {
  this(displayPrecision);
  replaceExpression(json.getString(JSON_EXPRESSION));
  mPreciseResult=json.getString(JSON_PRECISE);
  System.out.println("String_Node_Str" + mSelectionStart);
  System.out.println("String_Node_Str" + mSelectionEnd);
  setSolved(json.getBoolean(JSON_SOLVED));
}

Fixed version (ground truth):
public Expression(JSONObject json,int displayPrecision) throws JSONException {
  this(displayPrecision);
  replaceExpression(json.getString(JSON_EXPRESSION));
  mPreciseResult=json.getString(JSON_PRECISE);
  setSolved(json.getBoolean(JSON_SOLVED));
}
Program: 35110
Project: 35110
Buggy source:
/** 
 * Gets the last double (returned as a String) at selection in current expression
 * @return anything after last valid operator, or "" if expression empty, or entire expression if doesn't contain regexAnyValidOperator. Note if expression is "1+-5" it will return "-5"
 */
private String getLastPartialNumb(){
  String[] strA=expresssionToSelection().split("String_Node_Str" + regexAnyValidOperator);
  if (strA.length == 0)   return "String_Node_Str";
 else {
    if (expresssionToSelection().matches("String_Node_Str" + regexAnyValidOperator + regexAnyValidOperator+ regexGroupedNumber))     return expresssionToSelection().replaceAll("String_Node_Str" + regexAnyValidOperator + regexGroupedNumber+ "String_Node_Str","String_Node_Str");
    return strA[strA.length - 1];
  }
}

Fixed version (ground truth):
/** 
 * Gets the last partial number (returned as a String) at selection in current expression
 * @return last partial number, invalid or not, or "" if expression empty, or entire expression if doesn't contain regexAnyValidOperator. Note if expression is "1+-5*" it will return "-5" This number might be valid (eg "1E3") or invalid, (eg "1E", "1.E-" or "34)")
 */
private String getLastPartialNumb(){
  String[] strA=expresssionToSelection().split("String_Node_Str" + regexAnyValidOperator);
  if (strA.length == 0)   return "String_Node_Str";
 else   return strA[strA.length - 1];
}
Program: 35111
Project: 35111
Buggy source:
/** 
 * Solves a given Expression Cleans off the expression, adds missing parentheses, then loads in more accurate result values if possible into expression Iterates over expression using PEMAS order of operations
 * @param exp is the Expression to solve
 * @param mcSolve is the rounding to use to solve
 * @return the expression before conversion (potentially used for result list)
 */
public Result solve(Expression exp){
  exp.cleanDanglingOps();
  exp.closeOpenPar();
  String cleanedQuery=exp.toString();
  if (exp.isEmpty())   return null;
  exp.loadPreciseResult();
  exp.replacePercentOps();
  exp.groupPowerOperand();
  String strExp=collapsePara(exp.toString());
  exp.replaceExpression(strExp);
  roundAndClean(exp);
  exp.setSolved(true);
  return new Result(cleanedQuery,exp.toString());
}

Fixed version (ground truth):
/** 
 * Solves a given Expression Cleans off the expression, adds missing parentheses, then loads in more accurate result values if possible into expression Iterates over expression using PEMAS order of operations
 * @param exp is the Expression to solve
 * @param mcSolve is the rounding to use to solve
 * @return the expression before conversion (potentially used for result list)
 */
public Result solve(Expression exp){
  exp.cleanDanglingOps();
  exp.closeOpenPar();
  String cleanedQuery=exp.toString();
  if (exp.isEmpty())   return null;
  exp.loadPreciseResult();
  exp.replacePercentOps();
  exp.groupPowerOperands();
  String strExp=collapsePara(exp.toString());
  exp.replaceExpression(strExp);
  roundAndClean(exp);
  exp.setSolved(true);
  return new Result(cleanedQuery,exp.toString());
}
Program: 35112
Project: 35112
Buggy source:
/** 
 * Updates the current and previous answers
 * @param updatePrev whether or not to update previous answer
 */
public void updateScreen(boolean updatePrev){
  updateScreenWithInstaScrollOption(updatePrev,false);
  if (!calc.currUnitIsSet()) {
    FragmentStatePagerAdapter tempAdapter=(FragmentStatePagerAdapter)mViewPager.getAdapter();
    ConvertKeysFragment currFrag=(ConvertKeysFragment)tempAdapter.instantiateItem(mViewPager,mViewPager.getCurrentItem());
    currFrag.clearKeySelection();
  }
}

Fixed version (ground truth):
/** 
 * Updates the current and previous answers
 * @param updatePrev whether or not to update previous answer
 */
public void updateScreen(boolean updatePrev){
  updateScreenWithInstaScrollOption(updatePrev,false);
  if (!calc.isUnitIsSet()) {
    FragmentStatePagerAdapter tempAdapter=(FragmentStatePagerAdapter)mViewPager.getAdapter();
    ConvertKeysFragment currFrag=(ConvertKeysFragment)tempAdapter.instantiateItem(mViewPager,mViewPager.getCurrentItem());
    currFrag.clearKeySelection();
  }
}
Program: 35113
Project: 35113
Buggy source:
/** 
 * Function that is called after user hits the "=" key Called by calculator for solving current expression
 * @param exp
 * @return solved expression
 */
private boolean solveAndLoadIntoPrevExpression(){
  String prevEx=solve(mExpression,mMcOperate);
  if (!prevEx.equals("String_Node_Str")) {
    mPrevExpressions.add(new PrevExpression(prevEx));
    return true;
  }
 else   return false;
}

Fixed version (ground truth):
/** 
 * Function that is called after user hits the "=" key Called by calculator for solving current expression
 * @param exp
 * @return solved expression
 */
private boolean solveAndLoadIntoPrevExpression(){
  String prevEx=solve(mExpression,mMcOperate);
  if (!prevEx.equals("String_Node_Str")) {
    mPrevExpressions.add(new PrevExpression(prevEx));
    if (isUnitIsSet()) {
      Unit toUnit=getCurrUnitType().getSelectedUnit();
      mPrevExpressions.get(mPrevExpressions.size() - 1).setQuerryUnit(toUnit);
      mPrevExpressions.get(mPrevExpressions.size() - 1).setAnswerUnit(toUnit);
    }
    return true;
  }
 else   return false;
}
Program: 35114
Project: 35114
Buggy source:
@Override public void onClick(View view){
  int position=getListView().getPositionForView((View)view.getParent());
  Calculator calc=Calculator.getCalculator(getActivity());
  PrevExpression thisPrevExp=mResultArray.get(position);
  String textPassBack="String_Node_Str";
  int viewID=view.getId();
  if (viewID == R.id.list_item_result_textPrevQuery)   textPassBack=thisPrevExp.getQuerry();
  if (viewID == R.id.list_item_result_textPrevAnswer)   textPassBack=thisPrevExp.getAnswer();
  if (!calc.currUnitIsSet() && thisPrevExp.containsUnits()) {
    Unit unitPassBack=new Unit();
    if (viewID == R.id.list_item_result_textPrevQuery)     unitPassBack=thisPrevExp.getQuerryUnit();
    if (viewID == R.id.list_item_result_textPrevAnswer)     unitPassBack=thisPrevExp.getAnswerUnit();
    mCallback.selectUnit(unitPassBack);
  }
  calc.parseKeyPressed(textPassBack);
  mCallback.updateScreen(false);
}

Fixed version (ground truth):
@Override public void onClick(View view){
  int position=getListView().getPositionForView((View)view.getParent());
  Calculator calc=Calculator.getCalculator(getActivity());
  PrevExpression thisPrevExp=mResultArray.get(position);
  String textPassBack="String_Node_Str";
  int viewID=view.getId();
  if (viewID == R.id.list_item_result_textPrevQuery)   textPassBack=thisPrevExp.getQuerry();
  if (viewID == R.id.list_item_result_textPrevAnswer)   textPassBack=thisPrevExp.getAnswer();
  if (!calc.isUnitIsSet() && thisPrevExp.containsUnits()) {
    Unit unitPassBack=new Unit();
    if (viewID == R.id.list_item_result_textPrevQuery)     unitPassBack=thisPrevExp.getQuerryUnit();
    if (viewID == R.id.list_item_result_textPrevAnswer)     unitPassBack=thisPrevExp.getAnswerUnit();
    mCallback.selectUnit(unitPassBack);
  }
  calc.parseKeyPressed(textPassBack);
  mCallback.updateScreen(false);
}
Program: 35115
Project: 35115
Buggy source:
/** 
 * Helper function to reduce repeated code. Sets up the query and answer textViews
 * @param textView the TextView to setup
 * @param text the previous query or answer String
 */
private void setUpResultTextView(TextView textView,String text){
  textView.setClickable(true);
  textView.setText(text);
  textView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      int position=getListView().getPositionForView((View)view.getParent());
      Calculator calc=Calculator.getCalculator(getActivity());
      PrevExpression thisPrevExp=mResultArray.get(position);
      String textPassBack="String_Node_Str";
      int viewID=view.getId();
      if (viewID == R.id.list_item_result_textPrevQuery)       textPassBack=thisPrevExp.getQuerry();
      if (viewID == R.id.list_item_result_textPrevAnswer)       textPassBack=thisPrevExp.getAnswer();
      if (!calc.currUnitIsSet() && thisPrevExp.containsUnits()) {
        Unit unitPassBack=new Unit();
        if (viewID == R.id.list_item_result_textPrevQuery)         unitPassBack=thisPrevExp.getQuerryUnit();
        if (viewID == R.id.list_item_result_textPrevAnswer)         unitPassBack=thisPrevExp.getAnswerUnit();
        mCallback.selectUnit(unitPassBack);
      }
      calc.parseKeyPressed(textPassBack);
      mCallback.updateScreen(false);
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Helper function to reduce repeated code. Sets up the query and answer textViews
 * @param textView the TextView to setup
 * @param text the previous query or answer String
 */
private void setUpResultTextView(TextView textView,String text){
  textView.setClickable(true);
  textView.setText(text);
  textView.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      int position=getListView().getPositionForView((View)view.getParent());
      Calculator calc=Calculator.getCalculator(getActivity());
      PrevExpression thisPrevExp=mResultArray.get(position);
      String textPassBack="String_Node_Str";
      int viewID=view.getId();
      if (viewID == R.id.list_item_result_textPrevQuery)       textPassBack=thisPrevExp.getQuerry();
      if (viewID == R.id.list_item_result_textPrevAnswer)       textPassBack=thisPrevExp.getAnswer();
      if (!calc.isUnitIsSet() && thisPrevExp.containsUnits()) {
        Unit unitPassBack=new Unit();
        if (viewID == R.id.list_item_result_textPrevQuery)         unitPassBack=thisPrevExp.getQuerryUnit();
        if (viewID == R.id.list_item_result_textPrevAnswer)         unitPassBack=thisPrevExp.getAnswerUnit();
        mCallback.selectUnit(unitPassBack);
      }
      calc.parseKeyPressed(textPassBack);
      mCallback.updateScreen(false);
    }
  }
);
}
Program: 35119
Project: 35119
Buggy source:
@Override public void onPageSelected(int pos){
  calc.getCurrUnitType().clearUnitSelection();
  updateScreen(false);
  calc.setUnitTypePos(pos);
}

Fixed version (ground truth):
@Override public void onPageSelected(int pos){
  mCalc.getCurrUnitType().clearUnitSelection();
  updateScreen(false);
  mCalc.setUnitTypePos(pos);
}
Program: 35120
Project: 35120
Buggy source:
@Override public void onResume(){
  super.onResume();
  if (calc.toString().equals("String_Node_Str") && calc.getPrevExpressions().size() == 0)   mDisplay.setText(R.string.app_name);
 else   updateScreenWithInstaScrollOption(true,true);
}

Fixed version (ground truth):
@Override public void onResume(){
  super.onResume();
  if (mCalc.toString().equals("String_Node_Str") && mCalc.getPrevExpressions().size() == 0)   mDisplay.setText(R.string.app_name);
 else   updateScreenWithInstaScrollOption(true,true);
}
Program: 35121
Project: 35121
Buggy source:
/** 
 * Updates the current and previous answers
 * @param updatePrev whether or not to update previous answer
 */
public void updateScreen(boolean updatePrev){
  updateScreenWithInstaScrollOption(updatePrev,false);
  if (!calc.isUnitIsSet()) {
    FragmentStatePagerAdapter tempAdapter=(FragmentStatePagerAdapter)mViewPager.getAdapter();
    ConvertKeysFragment currFrag=(ConvertKeysFragment)tempAdapter.instantiateItem(mViewPager,mViewPager.getCurrentItem());
    currFrag.clearKeySelection();
  }
}

Fixed version (ground truth):
/** 
 * Updates the current and previous answers
 * @param updatePrev whether or not to update previous answer
 */
public void updateScreen(boolean updatePrev){
  updateScreenWithInstaScrollOption(updatePrev,false);
  if (!mCalc.isUnitIsSet()) {
    FragmentStatePagerAdapter tempAdapter=(FragmentStatePagerAdapter)mViewPager.getAdapter();
    ConvertKeysFragment currFrag=(ConvertKeysFragment)tempAdapter.instantiateItem(mViewPager,mViewPager.getCurrentItem());
    currFrag.clearKeySelection();
  }
}
Program: 35122
Project: 35122
Buggy source:
private void updateScreenWithInstaScrollOption(boolean updatePrev,boolean instaScroll){
  int selStart=calc.getSelectionStart();
  int selEnd=calc.getSelectionEnd();
  Log.d("String_Node_Str","String_Node_Str");
  mDisplay.setText(calc.toString());
  Log.d("String_Node_Str","String_Node_Str");
  mDisplay.setSelection(selStart,selEnd);
  if (updatePrev) {
    FragmentManager fm=getSupportFragmentManager();
    ResultListFragment prevResultFragment=(ResultListFragment)fm.findFragmentById(R.id.resultListfragmentContainer);
    prevResultFragment.refresh(instaScroll);
  }
}

Fixed version (ground truth):
private void updateScreenWithInstaScrollOption(boolean updatePrev,boolean instaScroll){
  int selStart=mCalc.getSelectionStart();
  int selEnd=mCalc.getSelectionEnd();
  Log.d("String_Node_Str","String_Node_Str");
  mDisplay.setText(mCalc.toString());
  Log.d("String_Node_Str","String_Node_Str");
  mDisplay.setSelection(selStart,selEnd);
  if (selStart == mCalc.toString().length())   mDisplay.setCursorVisible(false);
 else   mDisplay.setCursorVisible(true);
  if (updatePrev) {
    FragmentManager fm=getSupportFragmentManager();
    ResultListFragment prevResultFragment=(ResultListFragment)fm.findFragmentById(R.id.resultListfragmentContainer);
    prevResultFragment.refresh(instaScroll);
  }
}
Program: 35123
Project: 35123
Buggy source:
public void numButtonPressed(String keyPressed){
  calc.parseKeyPressed(keyPressed);
  updateScreen(keyPressed.equals("String_Node_Str"));
}

Fixed version (ground truth):
public void numButtonPressed(String keyPressed){
  mCalc.parseKeyPressed(keyPressed);
  updateScreen(keyPressed.equals("String_Node_Str"));
}
Program: 35124
Project: 35124
Buggy source:
@Override public int getCount(){
  return calc.getUnitTypeSize();
}

Fixed version (ground truth):
@Override public int getCount(){
  return mCalc.getUnitTypeSize();
}
Program: 35125
Project: 35125
Buggy source:
@Override protected void onSelectionChanged(int selStart,int selEnd){
  if (mCalc != null)   mCalc.setSelection(selStart,selEnd);
  Log.d("String_Node_Str","String_Node_Str" + String.valueOf(selStart));
}

Fixed version (ground truth):
@Override protected void onSelectionChanged(int selStart,int selEnd){
  if (mCalc != null) {
    mCalc.setSelection(selStart,selEnd);
    if (selStart == mCalc.toString().length())     setCursorVisible(false);
 else     setCursorVisible(true);
  }
}
Program: 35126
Project: 35126
Buggy source:
public void setSelection(int selectionStart,int selectionEnd){
  if (selectionEnd > mExpression.length() || selectionStart > mExpression.length())   throw new IllegalArgumentException("String_Node_Str");
  if (selectionEnd < selectionStart)   throw new IllegalArgumentException("String_Node_Str");
  mSelectionStart=selectionStart;
  mSelectionEnd=selectionEnd;
}

Fixed version (ground truth):
public void setSelection(int selectionStart,int selectionEnd){
  if (selectionEnd > mExpression.length() || selectionStart > mExpression.length())   throw new IllegalArgumentException("String_Node_Str");
  if (selectionEnd < selectionStart) {
    int temp=selectionEnd;
    selectionEnd=selectionStart;
    selectionStart=temp;
  }
  mSelectionStart=selectionStart;
  mSelectionEnd=selectionEnd;
}
Program: 35127
Project: 35127
Buggy source:
/** 
 * Passed a key from caculator (num/op/back/clear/eq) and distributes it to its proper function
 * @param sKey is either single character (but still a String) or a string from prevExpression
 */
public void parseKeyPressed(String sKey){
  if (expression.matches(regexInvalidChars))   expression="String_Node_Str";
  if (sKey.equals("String_Node_Str")) {
    solve();
    roundExpressionResult();
    expression=cleanNum(expression);
  }
 else   if (sKey.equals("String_Node_Str"))   backspace();
 else   if (sKey.equals("String_Node_Str"))   clear();
 else   addToExpression(sKey);
}

Fixed version (ground truth):
/** 
 * Passed a key from calculator (num/op/back/clear/eq) and distributes it to its proper function
 * @param sKey is either single character (but still a String) or a string from prevExpression
 */
public void parseKeyPressed(String sKey){
  if (expression.matches(regexInvalidChars))   expression="String_Node_Str";
  if (sKey.equals("String_Node_Str")) {
    String prevExp=solve();
    if (prevExp.equals("String_Node_Str"))     return;
    roundAndCleanExpression();
    prevExpressions.add(prevExp + "String_Node_Str" + expression);
  }
 else   if (sKey.equals("String_Node_Str"))   backspace();
 else   if (sKey.equals("String_Node_Str"))   clear();
 else   addToExpression(sKey);
}
Program: 35128
Project: 35128
Buggy source:
/** 
 * Function used to convert from one unit to another
 * @param fromValue is standardized value of the unit being converted from
 * @param toValue is standardized value of the unit being converted to
 */
public void convertFromTo(double fromValue,double toValue){
  if (expression.equals("String_Node_Str") || expression.matches(regexInvalidChars))   return;
  solve();
  try {
    BigDecimal bdToUnit=new BigDecimal(toValue,mcOperate);
    BigDecimal bdCurrUnit=new BigDecimal(fromValue,mcOperate);
    BigDecimal bdResult=new BigDecimal(expression,mcOperate);
    expression=bdResult.multiply(bdCurrUnit.divide(bdToUnit,mcOperate),mcOperate).toString();
  }
 catch (  NumberFormatException e) {
    expression=strSyntaxError;
    return;
  }
  roundExpressionResult();
  expression=cleanNum(expression);
}

Fixed version (ground truth):
/** 
 * Function used to convert from one unit to another
 * @param fromValue is standardized value of the unit being converted from
 * @param toValue is standardized value of the unit being converted to
 */
public void convertFromTo(double fromValue,double toValue,String fromName,String toName){
  if (expression.equals("String_Node_Str") || expression.matches(regexInvalidChars))   return;
  String prevExp=solve();
  if (prevExp.equals("String_Node_Str"))   return;
  try {
    BigDecimal bdToUnit=new BigDecimal(toValue,mcOperate);
    BigDecimal bdCurrUnit=new BigDecimal(fromValue,mcOperate);
    BigDecimal bdResult=new BigDecimal(expression,mcOperate);
    expression=bdResult.multiply(bdCurrUnit.divide(bdToUnit,mcOperate),mcOperate).toString();
  }
 catch (  NumberFormatException e) {
    expression=strSyntaxError;
    return;
  }
  roundAndCleanExpression();
  prevExpressions.add(prevExp + "String_Node_Str" + fromName+ "String_Node_Str"+ expression+ "String_Node_Str"+ toName);
}
Program: 35129
Project: 35129
Buggy source:
/** 
 * Function that is called after user hits the "=" key
 */
private void solve(){
  expression=expression.replaceAll(regexAnyOperatorOrE + "String_Node_Str","String_Node_Str");
  if (expression.equals("String_Node_Str"))   return;
  int numCloseParaToAdd=numOpenPara();
  for (int i=0; i < numCloseParaToAdd; i++) {
    expression=expression + "String_Node_Str";
  }
  String prevExp=expression;
  if (!precResult.equals("String_Node_Str")) {
    BigDecimal lessPrec=new BigDecimal(precResult,mcDisp);
    String lessPrecCleaned=cleanNum(lessPrec.toString());
    if (firstNumb().equals(lessPrecCleaned)) {
      expression=expression.replaceFirst(regexGroupedNumber,precResult.toString());
    }
  }
  expression=collapsePara(expression);
  String prevAns=expression;
  prevExpressions.add(prevExp + "String_Node_Str" + prevAns);
  solved=true;
}

Fixed version (ground truth):
/** 
 * Function that is called after user hits the "=" key Cleans off the expression, adds missing parentheses, then loads in more accurate result values if possible into expression Iterates over expression using PEMAS order of operations, then sets solved flag to true
 * @return the cleaned previous expression for loading into prevExpression
 */
private String solve(){
  expression=expression.replaceAll(regexAnyOperatorOrE + "String_Node_Str","String_Node_Str");
  if (expression.equals("String_Node_Str"))   return "String_Node_Str";
  int numCloseParaToAdd=numOpenPara();
  for (int i=0; i < numCloseParaToAdd; i++) {
    expression=expression + "String_Node_Str";
  }
  String prevExp=expression;
  if (!precResult.equals("String_Node_Str")) {
    BigDecimal lessPrec=new BigDecimal(precResult,mcDisp);
    String lessPrecCleaned=cleanNum(lessPrec.toString());
    if (firstNumb().equals(lessPrecCleaned)) {
      expression=expression.replaceFirst(regexGroupedNumber,precResult.toString());
    }
  }
  expression=collapsePara(expression);
  solved=true;
  return prevExp;
}
Program: 35130
Project: 35130
Buggy source:
/** 
 * Used to gather values to convert to and from and then call parent class to do raw conversion Convert from unit is specified by the current Unit
 * @param newUnitPos is the Unit position to convert to
 */
private void convert(int newUnitPos){
  double fromValue=mUnitArray.get(mCurrUnitPos).getValue();
  double toValue=mUnitArray.get(newUnitPos).getValue();
  mCallback.convertFromTo(fromValue,toValue);
}

Fixed version (ground truth):
/** 
 * Used to gather values to convert to and from and then call parent class to do raw conversion Convert from unit is specified by the current Unit
 * @param newUnitPos is the Unit position to convert to
 */
private void convert(int newUnitPos){
  double fromValue=mUnitArray.get(mCurrUnitPos).getValue();
  String fromName=mUnitArray.get(mCurrUnitPos).getDispName();
  double toValue=mUnitArray.get(newUnitPos).getValue();
  String toName=mUnitArray.get(newUnitPos).getDispName();
  mCallback.convertFromTo(fromValue,toValue,fromName,toName);
}
Program: 35131
Project: 35131
Buggy source:
public void convertFromTo(double fromValue,double toValue);

Fixed version (ground truth):
public void convertFromTo(double fromValue,double toValue,String fromName,String toName);
Program: 35133
Project: 35133
Buggy source:
/** 
 * Function that is called after user hits the "=" key Called by calculator for solving current expression
 * @param exp
 * @return solved expression
 */
private boolean solveAndLoadIntoPrevExpression(){
  String prevEx=solve(mExpression,mMcOperate);
  if (!prevEx.equals("String_Node_Str")) {
    mPrevExpressions.add(new PrevExpression(prevEx));
    if (isUnitIsSet()) {
      Unit toUnit=getCurrUnitType().getSelectedUnit();
      mPrevExpressions.get(mPrevExpressions.size() - 1).setQuerryUnit(toUnit);
      mPrevExpressions.get(mPrevExpressions.size() - 1).setAnswerUnit(toUnit);
    }
    return true;
  }
 else   return false;
}

Fixed version (ground truth):
/** 
 * Function that is called after user hits the "=" key Called by calculator for solving current expression
 * @param exp
 * @return solved expression
 */
private boolean solveAndLoadIntoPrevExpression(){
  String prevEx=solve(mExpression,mMcOperate);
  System.out.println("String_Node_Str" + isUnitIsSet());
  System.out.println("String_Node_Str" + mUnitTypePos);
  if (!prevEx.equals("String_Node_Str")) {
    mPrevExpressions.add(new PrevExpression(prevEx));
    if (isUnitIsSet()) {
      Unit toUnit=getCurrUnitType().getSelectedUnit();
      mPrevExpressions.get(mPrevExpressions.size() - 1).setQuerryUnit(toUnit);
      mPrevExpressions.get(mPrevExpressions.size() - 1).setAnswerUnit(toUnit);
    }
    return true;
  }
 else   return false;
}
Program: 35135
Project: 35135
Buggy source:
@Override public void onPageSelected(int pos){
  mCalc.getCurrUnitType().clearUnitSelection();
  updateScreen(false);
  mCalc.setUnitTypePos(pos);
  DisplayMetrics metrics=getResources().getDisplayMetrics();
  int padLeft=(int)(metrics.density * 8f + 0.5f);
  int padRight=(int)(metrics.density * 8f + 0.5f);
  mConvKeysViewPager.setPadding(padLeft,0,padRight,0);
  if (unitToSelectAfterScroll != null) {
    FragmentStatePagerAdapter tempAdapter=(FragmentStatePagerAdapter)mConvKeysViewPager.getAdapter();
    ConvKeysFragment currFrag=(ConvKeysFragment)tempAdapter.instantiateItem(mConvKeysViewPager,mConvKeysViewPager.getCurrentItem());
    currFrag.selectUnit(unitToSelectAfterScroll);
    unitToSelectAfterScroll=null;
  }
}

Fixed version (ground truth):
@Override public void onPageSelected(int pos){
  mCalc.setUnitTypePos(pos);
  DisplayMetrics metrics=getResources().getDisplayMetrics();
  int padLeft=(int)(metrics.density * 8f + 0.5f);
  int padRight=(int)(metrics.density * 8f + 0.5f);
  mConvKeysViewPager.setPadding(padLeft,0,padRight,0);
  int currConvKeyPos=mConvKeysViewPager.getCurrentItem();
  clearConvKeyForFragPos(currConvKeyPos - 1);
  clearConvKeyForFragPos(currConvKeyPos + 1);
  if (unitToSelectAfterScroll != null) {
    getConvKeyFrag(mConvKeysViewPager.getCurrentItem()).selectUnit(unitToSelectAfterScroll);
    unitToSelectAfterScroll=null;
  }
}
Program: 35136
Project: 35136
Buggy source:
/** 
 * Selects the a unit (used by prev result list)
 * @see com.llamacorp.unitcalc.ResultListFragment.OnResultSelectedListener#selectUnit(int)
 */
public void selectUnit(Unit unit,int unitTypePos){
  FragmentStatePagerAdapter tempAdapter=(FragmentStatePagerAdapter)mConvKeysViewPager.getAdapter();
  ConvKeysFragment currFrag=(ConvKeysFragment)tempAdapter.instantiateItem(mConvKeysViewPager,mConvKeysViewPager.getCurrentItem());
  if (unitTypePos != mConvKeysViewPager.getCurrentItem()) {
    unitToSelectAfterScroll=unit;
    mConvKeysViewPager.setCurrentItem(unitTypePos);
  }
 else   currFrag.selectUnit(unit);
}

Fixed version (ground truth):
/** 
 * Selects the a unit (used by prev result list)
 * @see com.llamacorp.unitcalc.ResultListFragment.OnResultSelectedListener#selectUnit(int)
 */
public void selectUnit(Unit unit,int unitTypePos){
  if (unitTypePos != mConvKeysViewPager.getCurrentItem()) {
    unitToSelectAfterScroll=unit;
    mConvKeysViewPager.setCurrentItem(unitTypePos);
  }
 else   getConvKeyFrag(mConvKeysViewPager.getCurrentItem()).selectUnit(unit);
}
Program: 35137
Project: 35137
Buggy source:
/** 
 * Updates the current and previous answers
 * @param updatePrev whether or not to update previous answer
 */
public void updateScreen(boolean updatePrev){
  updateScreenWithInstaScrollOption(updatePrev,false);
  if (!mCalc.isUnitIsSet()) {
    FragmentStatePagerAdapter tempAdapter=(FragmentStatePagerAdapter)mConvKeysViewPager.getAdapter();
    ConvKeysFragment currFrag=(ConvKeysFragment)tempAdapter.instantiateItem(mConvKeysViewPager,mConvKeysViewPager.getCurrentItem());
    currFrag.clearButtonSelection();
  }
}

Fixed version (ground truth):
/** 
 * Updates the current and previous answers
 * @param updatePrev whether or not to update previous answer
 */
public void updateScreen(boolean updatePrev){
  updateScreenWithInstaScrollOption(updatePrev,false);
  if (!mCalc.isUnitIsSet())   clearConvKeyForFragPos(mConvKeysViewPager.getCurrentItem());
}
Program: 35138
Project: 35138
Buggy source:
public void setIncludeAll(boolean includeAll){
  this.includeAll=includeAll;
}

Fixed version (ground truth):
public void setIncludeAll(Boolean includeAll){
  this.includeAll=includeAll;
}
Program: 35139
Project: 35139
Buggy source:
public boolean getIncludeAll(){
  return includeAll;
}

Fixed version (ground truth):
public Boolean getIncludeAll(){
  return includeAll;
}
Program: 35140
Project: 35140
Buggy source:
public void setIncludeAll(boolean includeAll){
  this.includeAll=includeAll;
}

Fixed version (ground truth):
public void setIncludeAll(Boolean includeAll){
  this.includeAll=includeAll;
}
Program: 35141
Project: 35141
Buggy source:
public boolean getIncludeAll(){
  return includeAll;
}

Fixed version (ground truth):
public Boolean getIncludeAll(){
  return includeAll;
}
Program: 35142
Project: 35142
Buggy source:
public void setTemplateId(Integer suiteId){
  this.suiteId=suiteId;
}

Fixed version (ground truth):
public void setTemplateId(Integer templateId){
  this.templateId=templateId;
}
Program: 35143
Project: 35143
Buggy source:
@Test public void testGetTestCase(){
  TestRailService service=getTestRailsEntities("String_Node_Str");
  TestCase testCase=service.getTestCase(0);
  Assert.assertEquals(new Integer(5),testCase.getCreatedBy());
  Assert.assertEquals(new Integer(1392300984),testCase.getCreatedOn());
  Assert.assertEquals("String_Node_Str",testCase.getEstimate());
  Assert.assertEquals(null,testCase.getEstimateForecast());
  Assert.assertEquals(new Integer(1),testCase.getId());
  Assert.assertEquals(new Integer(7),testCase.getMilestoneId());
  Assert.assertEquals(new Integer(2),testCase.getPriorityId());
  Assert.assertEquals("String_Node_Str",testCase.getRefs());
  Assert.assertEquals(new Integer(1),testCase.getSectionId());
  Assert.assertEquals(new Integer(1),testCase.getSuiteId());
  Assert.assertEquals("String_Node_Str",testCase.getTitle());
  Assert.assertEquals(new Integer(4),testCase.getTypeId());
  Assert.assertEquals(new Integer(1),testCase.getUpdatedBy());
  Assert.assertEquals(new Integer(1393586511),testCase.getUpdatedOn());
}

Fixed version (ground truth):
@Test public void testGetTestCase(){
  TestRailService service=getTestRailsEntities("String_Node_Str");
  TestCase testCase=service.getTestCase(0);
  Assert.assertEquals(new Integer(5),testCase.getCreatedBy());
  Assert.assertEquals(new Integer(1392300984),testCase.getCreatedOn());
  Assert.assertEquals("String_Node_Str",testCase.getEstimate());
  Assert.assertEquals(null,testCase.getEstimateForecast());
  Assert.assertEquals(new Integer(1),testCase.getId());
  Assert.assertEquals(new Integer(7),testCase.getMilestoneId());
  Assert.assertEquals(new Integer(2),testCase.getPriorityId());
  Assert.assertEquals("String_Node_Str",testCase.getRefs());
  Assert.assertEquals(new Integer(1),testCase.getSectionId());
  Assert.assertEquals(new Integer(1),testCase.getSuiteId());
  Assert.assertEquals("String_Node_Str",testCase.getTitle());
  Assert.assertEquals(new Integer(4),testCase.getTypeId());
  Assert.assertEquals(new Integer(1),testCase.getUpdatedBy());
  Assert.assertEquals(new Integer(1393586511),testCase.getUpdatedOn());
  Assert.assertEquals(new Integer(1),testCase.getTemplateId());
}