Program: 15391
Project: 15391
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,final Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (resultCode != RESULT_OK)   return;
  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(PostSubmitActivity.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(PostSubmitActivity.this,getString(R.string.comment_reply_oncancel));
        progressDialog.dismiss();
      }
      return true;
    }
  }
);
  final CacheManager cm=CacheManager.getInstance(this);
  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(PostSubmitActivity.this,getString(R.string.post_submit_done));
          finish();
        }
      }
);
    }
    @Override protected void onCallbackException(    Throwable t){
      BugReportActivity.handleGlobalError(PostSubmitActivity.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(PostSubmitActivity.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(PostSubmitActivity.this,error);
          if (progressDialog.isShowing())           progressDialog.dismiss();
        }
      }
);
    }
  }
;
  final boolean is_self=!typeSpinner.getSelectedItem().equals("String_Node_Str");
  final RedditAccount selectedAccount=RedditAccountManager.getInstance(this).getAccount((String)usernameSpinner.getSelectedItem());
  String subreddit=subredditEdit.getText().toString();
  final String title=titleEdit.getText().toString();
  final String text=textEdit.getText().toString();
  final String captchaId=data.getStringExtra("String_Node_Str");
  final String captchaText=data.getStringExtra("String_Node_Str");
  while (subreddit.startsWith("String_Node_Str"))   subreddit=subreddit.substring(1);
  while (subreddit.startsWith("String_Node_Str"))   subreddit=subreddit.substring(2);
  while (subreddit.endsWith("String_Node_Str"))   subreddit=subreddit.substring(0,subreddit.length() - 1);
  RedditAPI.submit(cm,handler,selectedAccount,is_self,subreddit,title,text,captchaId,captchaText,this);
  progressDialog.show();
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,final Intent data){
  super.onActivityResult(requestCode,resultCode,data);
  if (resultCode != RESULT_OK)   return;
  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(PostSubmitActivity.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(PostSubmitActivity.this,getString(R.string.comment_reply_oncancel));
        progressDialog.dismiss();
      }
      return true;
    }
  }
);
  final CacheManager cm=CacheManager.getInstance(this);
  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(PostSubmitActivity.this,getString(R.string.post_submit_done));
          finish();
        }
      }
);
    }
    @Override protected void onCallbackException(    Throwable t){
      BugReportActivity.handleGlobalError(PostSubmitActivity.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(PostSubmitActivity.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(PostSubmitActivity.this,error);
          if (progressDialog.isShowing())           progressDialog.dismiss();
        }
      }
);
    }
  }
;
  final boolean is_self=!typeSpinner.getSelectedItem().equals("String_Node_Str");
  final RedditAccount selectedAccount=RedditAccountManager.getInstance(this).getAccount((String)usernameSpinner.getSelectedItem());
  String subreddit=subredditEdit.getText().toString();
  final String title=titleEdit.getText().toString();
  final String text=textEdit.getText().toString();
  final String captchaId=data.getStringExtra("String_Node_Str");
  final String captchaText=data.getStringExtra("String_Node_Str");
  while (subreddit.startsWith("String_Node_Str"))   subreddit=subreddit.substring(1);
  while (subreddit.startsWith("String_Node_Str"))   subreddit=subreddit.substring(2);
  while (subreddit.endsWith("String_Node_Str"))   subreddit=subreddit.substring(0,subreddit.length() - 1);
  RedditAPI.submit(cm,handler,selectedAccount,is_self,subreddit,title,text,captchaId,captchaText,this);
  progressDialog.show();
}