Program: 15377
Project: 15377
Buggy source:
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (item.getTitle().equals(getString(R.string.comment_reply_send))) {
    final ProgressDialog progressDialog=new ProgressDialog(this);
    progressDialog.setTitle(getString(R.string.comment_reply_submitting_title));
    progressDialog.setMessage(getString(R.string.comment_reply_submitting_message));
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(true);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener(){
      public void onCancel(      final DialogInterface dialogInterface){
        General.quickToast(CommentReplyActivity.this,getString(R.string.comment_reply_oncancel));
        progressDialog.dismiss();
      }
    }
);
    progressDialog.setOnKeyListener(new DialogInterface.OnKeyListener(){
      public boolean onKey(      final DialogInterface dialogInterface,      final int keyCode,      final KeyEvent keyEvent){
        if (keyCode == KeyEvent.KEYCODE_BACK) {
          General.quickToast(CommentReplyActivity.this,getString(R.string.comment_reply_oncancel));
          progressDialog.dismiss();
        }
        return true;
      }
    }
);
    final APIResponseHandler.ActionResponseHandler handler=new APIResponseHandler.ActionResponseHandler(this){
      @Override protected void onSuccess(){
        General.UI_THREAD_HANDLER.post(new Runnable(){
          public void run(){
            if (progressDialog.isShowing())             progressDialog.dismiss();
            General.quickToast(CommentReplyActivity.this,getString(R.string.comment_reply_done));
            finish();
          }
        }
);
      }
      @Override protected void onCallbackException(      Throwable t){
        BugReportActivity.handleGlobalError(CommentReplyActivity.this,t);
      }
      @Override protected void onFailure(      RequestFailureType type,      Throwable t,      StatusLine status,      String readableMessage){
        final RRError error=General.getGeneralErrorForFailure(context,type,t,status,null);
        General.UI_THREAD_HANDLER.post(new Runnable(){
          public void run(){
            General.showResultDialog(CommentReplyActivity.this,error);
            if (progressDialog.isShowing())             progressDialog.dismiss();
          }
        }
);
      }
      @Override protected void onFailure(      final APIFailureType type){
        final RRError error=General.getGeneralErrorForFailure(context,type);
        General.UI_THREAD_HANDLER.post(new Runnable(){
          public void run(){
            General.showResultDialog(CommentReplyActivity.this,error);
            if (progressDialog.isShowing())             progressDialog.dismiss();
          }
        }
);
      }
    }
;
    final CacheManager cm=CacheManager.getInstance(this);
    final ArrayList<RedditAccount> accounts=RedditAccountManager.getInstance(this).getAccounts();
    RedditAccount selectedAccount=null;
    for (    RedditAccount account : accounts) {
      if (!account.isAnonymous() && account.username.equalsIgnoreCase((String)usernameSpinner.getSelectedItem())) {
        selectedAccount=account;
        break;
      }
    }
    RedditAPI.comment(cm,handler,selectedAccount,parentIdAndType,textEdit.getText().toString(),this);
    progressDialog.show();
  }
 else   if (item.getTitle().equals(getString(R.string.comment_reply_preview))) {
    MarkdownPreviewDialog.newInstance(textEdit.getText().toString()).show(getFragmentManager(),"String_Node_Str");
  }
  return true;
}

Fixed version (ground truth):
@Override public boolean onOptionsItemSelected(MenuItem item){
  if (item.getTitle().equals(getString(R.string.comment_reply_send))) {
    final ProgressDialog progressDialog=new ProgressDialog(this);
    progressDialog.setTitle(getString(R.string.comment_reply_submitting_title));
    progressDialog.setMessage(getString(R.string.comment_reply_submitting_message));
    progressDialog.setIndeterminate(true);
    progressDialog.setCancelable(true);
    progressDialog.setCanceledOnTouchOutside(false);
    progressDialog.setOnCancelListener(new DialogInterface.OnCancelListener(){
      public void onCancel(      final DialogInterface dialogInterface){
        General.quickToast(CommentReplyActivity.this,getString(R.string.comment_reply_oncancel));
        progressDialog.dismiss();
      }
    }
);
    progressDialog.setOnKeyListener(new DialogInterface.OnKeyListener(){
      public boolean onKey(      final DialogInterface dialogInterface,      final int keyCode,      final KeyEvent keyEvent){
        if (keyCode == KeyEvent.KEYCODE_BACK) {
          General.quickToast(CommentReplyActivity.this,getString(R.string.comment_reply_oncancel));
          progressDialog.dismiss();
        }
        return true;
      }
    }
);
    final APIResponseHandler.ActionResponseHandler handler=new APIResponseHandler.ActionResponseHandler(this){
      @Override protected void onSuccess(){
        AndroidApi.UI_THREAD_HANDLER.post(new Runnable(){
          public void run(){
            if (progressDialog.isShowing())             progressDialog.dismiss();
            General.quickToast(CommentReplyActivity.this,getString(R.string.comment_reply_done));
            finish();
          }
        }
);
      }
      @Override protected void onCallbackException(      Throwable t){
        BugReportActivity.handleGlobalError(CommentReplyActivity.this,t);
      }
      @Override protected void onFailure(      RequestFailureType type,      Throwable t,      StatusLine status,      String readableMessage){
        final RRError error=General.getGeneralErrorForFailure(context,type,t,status,null);
        AndroidApi.UI_THREAD_HANDLER.post(new Runnable(){
          public void run(){
            General.showResultDialog(CommentReplyActivity.this,error);
            if (progressDialog.isShowing())             progressDialog.dismiss();
          }
        }
);
      }
      @Override protected void onFailure(      final APIFailureType type){
        final RRError error=General.getGeneralErrorForFailure(context,type);
        AndroidApi.UI_THREAD_HANDLER.post(new Runnable(){
          public void run(){
            General.showResultDialog(CommentReplyActivity.this,error);
            if (progressDialog.isShowing())             progressDialog.dismiss();
          }
        }
);
      }
    }
;
    final CacheManager cm=CacheManager.getInstance(this);
    final ArrayList<RedditAccount> accounts=RedditAccountManager.getInstance(this).getAccounts();
    RedditAccount selectedAccount=null;
    for (    RedditAccount account : accounts) {
      if (!account.isAnonymous() && account.username.equalsIgnoreCase((String)usernameSpinner.getSelectedItem())) {
        selectedAccount=account;
        break;
      }
    }
    RedditAPI.comment(cm,handler,selectedAccount,parentIdAndType,textEdit.getText().toString(),this);
    progressDialog.show();
  }
 else   if (item.getTitle().equals(getString(R.string.comment_reply_preview))) {
    MarkdownPreviewDialog.newInstance(textEdit.getText().toString()).show(getFragmentManager(),"String_Node_Str");
  }
  return true;
}