Program: 181156
Project: 181156
Buggy source:
/** 
 * Called when SMS send completes. Broadcasts a sentIntent on success. On failure, either sets up retries or broadcasts a sentIntent with the failure in the result code.
 * @param ar AsyncResult passed into the message handler.  ar.result shouldan SmsResponse instance if send was successful.  ar.userObj should be an SmsTracker instance.
 */
protected void handleSendComplete(AsyncResult ar){
  SmsTracker tracker=(SmsTracker)ar.userObj;
  PendingIntent sentIntent=tracker.mSentIntent;
  if (ar.exception == null) {
    if (Config.LOGD) {
      Log.d(TAG,"String_Node_Str" + "String_Node_Str" + sentIntent);
    }
    if (tracker.mDeliveryIntent != null) {
      int messageRef=((SmsResponse)ar.result).messageRef;
      tracker.mMessageRef=messageRef;
      deliveryPendingList.add(tracker);
    }
    if (sentIntent != null) {
      try {
        sentIntent.send(Activity.RESULT_OK);
      }
 catch (      CanceledException ex) {
      }
    }
  }
 else {
    if (Config.LOGD) {
      Log.d(TAG,"String_Node_Str");
    }
    int ss=mPhone.getServiceState().getState();
    if (ss != ServiceState.STATE_IN_SERVICE) {
      handleNotInService(ss,tracker);
    }
 else     if ((((CommandException)(ar.exception)).getCommandError() == CommandException.Error.SMS_FAIL_RETRY) && tracker.mRetryCount < MAX_SEND_RETRIES) {
      tracker.mRetryCount++;
      Message retryMsg=obtainMessage(EVENT_SEND_RETRY,tracker);
      sendMessageDelayed(retryMsg,SEND_RETRY_DELAY);
    }
 else     if (tracker.mSentIntent != null) {
      int error=RESULT_ERROR_GENERIC_FAILURE;
      if (((CommandException)(ar.exception)).getCommandError() == CommandException.Error.FDN_CHECK_FAILURE) {
        error=RESULT_ERROR_FDN_CHECK_FAILURE;
      }
      try {
        Intent fillIn=new Intent();
        if (ar.result != null) {
          fillIn.putExtra("String_Node_Str",((SmsResponse)ar.result).errorCode);
        }
        tracker.mSentIntent.send(mContext,error,fillIn);
      }
 catch (      CanceledException ex) {
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Called when SMS send completes. Broadcasts a sentIntent on success. On failure, either sets up retries or broadcasts a sentIntent with the failure in the result code.
 * @param ar AsyncResult passed into the message handler.  ar.result shouldan SmsResponse instance if send was successful.  ar.userObj should be an SmsTracker instance.
 */
protected void handleSendComplete(AsyncResult ar){
  SmsTracker tracker=(SmsTracker)ar.userObj;
  PendingIntent sentIntent=tracker.mSentIntent;
  if (ar.exception == null) {
    if (Config.LOGD) {
      Log.d(TAG,"String_Node_Str" + "String_Node_Str" + sentIntent);
    }
    if (tracker.mDeliveryIntent != null) {
      int messageRef=((SmsResponse)ar.result).messageRef;
      tracker.mMessageRef=messageRef;
      deliveryPendingList.add(tracker);
    }
    if (sentIntent != null) {
      try {
        if (mRemainingMessages > -1) {
          mRemainingMessages--;
        }
        if (mRemainingMessages == 0) {
          Intent sendNext=new Intent();
          sendNext.putExtra(SEND_NEXT_MSG_EXTRA,true);
          sentIntent.send(mContext,Activity.RESULT_OK,sendNext);
        }
 else {
          sentIntent.send(Activity.RESULT_OK);
        }
      }
 catch (      CanceledException ex) {
      }
    }
  }
 else {
    if (Config.LOGD) {
      Log.d(TAG,"String_Node_Str");
    }
    int ss=mPhone.getServiceState().getState();
    if (ss != ServiceState.STATE_IN_SERVICE) {
      handleNotInService(ss,tracker);
    }
 else     if ((((CommandException)(ar.exception)).getCommandError() == CommandException.Error.SMS_FAIL_RETRY) && tracker.mRetryCount < MAX_SEND_RETRIES) {
      tracker.mRetryCount++;
      Message retryMsg=obtainMessage(EVENT_SEND_RETRY,tracker);
      sendMessageDelayed(retryMsg,SEND_RETRY_DELAY);
    }
 else     if (tracker.mSentIntent != null) {
      int error=RESULT_ERROR_GENERIC_FAILURE;
      if (((CommandException)(ar.exception)).getCommandError() == CommandException.Error.FDN_CHECK_FAILURE) {
        error=RESULT_ERROR_FDN_CHECK_FAILURE;
      }
      try {
        Intent fillIn=new Intent();
        if (ar.result != null) {
          fillIn.putExtra("String_Node_Str",((SmsResponse)ar.result).errorCode);
        }
        if (mRemainingMessages > -1) {
          mRemainingMessages--;
        }
        if (mRemainingMessages == 0) {
          fillIn.putExtra(SEND_NEXT_MSG_EXTRA,true);
        }
        tracker.mSentIntent.send(mContext,error,fillIn);
      }
 catch (      CanceledException ex) {
      }
    }
  }
}