Program: 35068
Project: 35068
Buggy source:
/** 
 * Updates the text with current value from calc Preserves calc's cursor selections
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void updateTextFromCalc(){
  mSelStart=mCalc.getSelectionStart();
  mSelEnd=mCalc.getSelectionEnd();
  mTextPrefex="String_Node_Str";
  mExpressionText=mCalc.toString();
  mTextSuffix="String_Node_Str";
  if (!mCalc.isExpressionInvalid() && !mCalc.isExpressionEmpty() && mCalc.isUnitSelected()) {
    mTextSuffix="String_Node_Str" + mCalc.getCurrUnitType().getCurrUnit().toString();
    if (!mCalc.isSolved()) {
      mTextPrefex=getResources().getString(R.string.word_Convert) + "String_Node_Str";
      mTextSuffix=mTextSuffix + "String_Node_Str" + getResources().getString(R.string.word_to)+ "String_Node_Str";
      mSelStart=mSelStart + mTextPrefex.length();
      mSelEnd=mSelEnd + mTextPrefex.length();
    }
  }
  setText(Html.fromHtml("String_Node_Str" + mTextPrefex + "String_Node_Str"+ mExpressionText+ "String_Node_Str"+ mTextSuffix+ "String_Node_Str"));
  ArrayList<Integer> highlist=mCalc.getHighlighted();
  mHighlightIndex1=highlist.get(0);
  mHighlightIndex2=highlist.get(1);
  if (mHighlightIndex1 != -1 && mHighlightIndex2 != -1) {
    Integer colorFrom=Color.RED;
    Integer colorTo=Color.WHITE;
    ValueAnimator colorAnimation=ValueAnimator.ofObject(new ArgbEvaluator(),colorFrom,colorTo);
    colorAnimation.addUpdateListener(new AnimatorUpdateListener(){
      @Override public void onAnimationUpdate(      ValueAnimator animator){
        ArrayList<Integer> highlist=mCalc.getHighlighted();
        mHighlightIndex1=highlist.get(0);
        mHighlightIndex2=highlist.get(1);
        String coloredExp=mExpressionText;
        if (mHighlightIndex1 == -1 || mHighlightIndex2 == -1)         animator.cancel();
 else {
          int color=(Integer)animator.getAnimatedValue();
          coloredExp=mExpressionText.substring(0,mHighlightIndex1) + "String_Node_Str" + color+ "String_Node_Str"+ mExpressionText.substring(mHighlightIndex1,mHighlightIndex1 + 1)+ "String_Node_Str"+ mExpressionText.substring(mHighlightIndex1 + 1,mHighlightIndex2)+ "String_Node_Str"+ color+ "String_Node_Str"+ mExpressionText.substring(mHighlightIndex2,mHighlightIndex2 + 1)+ "String_Node_Str"+ mExpressionText.substring(mHighlightIndex2 + 1,mExpressionText.length());
        }
        setText(Html.fromHtml("String_Node_Str" + mTextPrefex + "String_Node_Str"+ coloredExp+ "String_Node_Str"+ mTextSuffix+ "String_Node_Str"));
        setSelection(mSelStart,mSelEnd);
      }
    }
);
    colorAnimation.addListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        mCalc.clearHighlighted();
      }
    }
);
    colorAnimation.setDuration(600 * 2);
    colorAnimation.start();
  }
  setSelection(mSelStart,mSelEnd);
  setCursorVisible(!mCalc.isSolved());
}

Fixed version (ground truth):
/** 
 * Updates the text with current value from calc Preserves calc's cursor selections
 */
@TargetApi(Build.VERSION_CODES.HONEYCOMB) public void updateTextFromCalc(){
  mSelStart=mCalc.getSelectionStart();
  mSelEnd=mCalc.getSelectionEnd();
  mTextPrefex="String_Node_Str";
  mExpressionText=mCalc.toString();
  mTextSuffix="String_Node_Str";
  if (!mCalc.isExpressionInvalid() && !mCalc.isExpressionEmpty() && mCalc.isUnitSelected()) {
    mTextSuffix="String_Node_Str" + mCalc.getCurrUnitType().getCurrUnit().toString();
    if (!mCalc.isSolved()) {
      mTextPrefex=getResources().getString(R.string.word_Convert) + "String_Node_Str";
      mTextSuffix=mTextSuffix + "String_Node_Str" + getResources().getString(R.string.word_to)+ "String_Node_Str";
      mSelStart=mSelStart + mTextPrefex.length();
      mSelEnd=mSelEnd + mTextPrefex.length();
    }
  }
  setText(Html.fromHtml("String_Node_Str" + mTextPrefex + "String_Node_Str"+ mExpressionText+ "String_Node_Str"+ mTextSuffix+ "String_Node_Str"));
  ArrayList<Integer> highlist=mCalc.getHighlighted();
  mHighlightIndex1=highlist.get(0);
  mHighlightIndex2=highlist.get(1);
  if (mHighlightIndex1 != -1) {
    Integer colorFrom=Color.RED;
    Integer colorTo=Color.WHITE;
    ValueAnimator colorAnimation=ValueAnimator.ofObject(new ArgbEvaluator(),colorFrom,colorTo);
    colorAnimation.addUpdateListener(new AnimatorUpdateListener(){
      @Override public void onAnimationUpdate(      ValueAnimator animator){
        ArrayList<Integer> highlist=mCalc.getHighlighted();
        mHighlightIndex1=highlist.get(0);
        mHighlightIndex2=highlist.get(1);
        String coloredExp=mExpressionText;
        if (mHighlightIndex1 == -1)         animator.cancel();
 else {
          int color=(Integer)animator.getAnimatedValue();
          for (int i=0; i < 2; i++) {
          }
          coloredExp=mExpressionText.substring(0,mHighlightIndex1) + "String_Node_Str" + color+ "String_Node_Str"+ mExpressionText.substring(mHighlightIndex1,mHighlightIndex1 + 1)+ "String_Node_Str"+ mExpressionText.substring(mHighlightIndex1 + 1,mHighlightIndex2)+ "String_Node_Str"+ color+ "String_Node_Str"+ mExpressionText.substring(mHighlightIndex2,mHighlightIndex2 + 1)+ "String_Node_Str"+ mExpressionText.substring(mHighlightIndex2 + 1,mExpressionText.length());
        }
        setText(Html.fromHtml("String_Node_Str" + mTextPrefex + "String_Node_Str"+ coloredExp+ "String_Node_Str"+ mTextSuffix+ "String_Node_Str"));
        setSelection(mSelStart,mSelEnd);
      }
    }
);
    colorAnimation.addListener(new AnimatorListenerAdapter(){
      @Override public void onAnimationEnd(      Animator animation){
        mCalc.clearHighlighted();
      }
    }
);
    colorAnimation.setDuration(600);
    colorAnimation.start();
  }
  setSelection(mSelStart,mSelEnd);
  setCursorVisible(!mCalc.isSolved());
}