Program: 14903
Project: 14903
Buggy source:
private void moderateComment(final CommentStatus newStatus){
  if (!hasActivity() || !hasComment() || mIsModeratingComment)   return;
  if (!NetworkUtils.checkConnection(getActivity()))   return;
  mLayoutButtons.setEnabled(false);
  mLayoutButtons.clearAnimation();
  AniUtils.flyOut(mLayoutButtons);
  if (mTxtStatus.getVisibility() == View.VISIBLE) {
    mTxtStatus.clearAnimation();
    AniUtils.startAnimation(mTxtStatus,R.anim.fade_out);
    mTxtStatus.setVisibility(View.INVISIBLE);
  }
  final int msgResId;
  final MessageBarType msgType;
switch (newStatus) {
case APPROVED:
    msgResId=R.string.comment_approved;
  msgType=MessageBarType.INFO;
break;
case UNAPPROVED:
msgResId=R.string.comment_unapproved;
msgType=MessageBarType.ALERT;
break;
case SPAM:
msgResId=R.string.comment_spammed;
msgType=MessageBarType.ALERT;
break;
case TRASH:
msgResId=R.string.comment_trashed;
msgType=MessageBarType.ALERT;
break;
default :
msgResId=R.string.comment_moderated;
msgType=MessageBarType.INFO;
break;
}
MessageBarUtils.showMessageBar(getActivity(),getString(msgResId),msgType,null);
CommentActions.CommentActionListener actionListener=new CommentActions.CommentActionListener(){
@Override public void onActionResult(boolean succeeded){
mIsModeratingComment=false;
if (!hasActivity()) return;
mLayoutButtons.setEnabled(true);
if (succeeded) {
mComment.setStatus(CommentStatus.toString(newStatus));
if (mOnCommentChangeListener != null) mOnCommentChangeListener.onCommentChanged(ChangedFrom.COMMENT_DETAIL);
}
 else {
ToastUtils.showToast(getActivity(),R.string.error_moderate_comment,ToastUtils.Duration.LONG);
}
updateStatusViews();
}
}
;
mIsModeratingComment=true;
CommentActions.moderateComment(mLocalBlogId,mComment,newStatus,actionListener);
}

Fixed version (ground truth):
private void moderateComment(final CommentStatus newStatus){
  if (!hasActivity() || !hasComment() || mIsModeratingComment)   return;
  if (!NetworkUtils.checkConnection(getActivity()))   return;
  mLayoutButtons.setEnabled(false);
  mLayoutButtons.clearAnimation();
  AniUtils.flyOut(mLayoutButtons);
  if (mTxtStatus.getVisibility() == View.VISIBLE) {
    mTxtStatus.clearAnimation();
    AniUtils.startAnimation(mTxtStatus,R.anim.fade_out);
    mTxtStatus.setVisibility(View.INVISIBLE);
  }
  final int msgResId;
  final MessageBarType msgType;
switch (newStatus) {
case APPROVED:
    msgResId=R.string.comment_approved;
  msgType=MessageBarType.INFO;
break;
case UNAPPROVED:
msgResId=R.string.comment_unapproved;
msgType=MessageBarType.ALERT;
break;
case SPAM:
msgResId=R.string.comment_spammed;
msgType=MessageBarType.ALERT;
break;
case TRASH:
msgResId=R.string.comment_trashed;
msgType=MessageBarType.ALERT;
break;
default :
msgResId=R.string.comment_moderated;
msgType=MessageBarType.INFO;
break;
}
MessageBarUtils.showMessageBar(getActivity(),getString(msgResId),msgType,null);
CommentActions.CommentActionListener actionListener=new CommentActions.CommentActionListener(){
@Override public void onActionResult(boolean succeeded){
mIsModeratingComment=false;
if (succeeded && mOnCommentChangeListener != null) mOnCommentChangeListener.onCommentChanged(ChangedFrom.COMMENT_DETAIL);
if (hasActivity()) {
mLayoutButtons.setEnabled(true);
if (succeeded) {
mComment.setStatus(CommentStatus.toString(newStatus));
}
 else {
ToastUtils.showToast(getActivity(),R.string.error_moderate_comment,ToastUtils.Duration.LONG);
}
updateStatusViews();
}
}
}
;
mIsModeratingComment=true;
CommentActions.moderateComment(mLocalBlogId,mComment,newStatus,actionListener);
}