Program: 187376
Project: 187376
Buggy source:
/** 
 * Sends a message as encrypted or plain text based on the contact's state.
 * @param number : String the number the text message is being sent to
 * @param text : String the text message
 * @param context : Context the context of the class
 * @return : boolean whether the message sent or not
 */
public static boolean sendMessage(String number,String text,Context context){
  try {
    if (MessageService.dba.isTrustedContact(number) && Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
      String encrypted=Encryption.aes_encrypt(MessageService.dba.getRow(format(number)).getPublicKey(),text);
      sendSMS(context,number,encrypted);
      if (Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
        sendToSelf(context,number,encrypted,Prephase3Activity.SENT);
        MessageService.dba.addNewMessage(new Message(encrypted,true,true),number,false);
      }
      sendToSelf(context,number,text,Prephase3Activity.SENT);
      MessageService.dba.addNewMessage(new Message(text,true,true),number,false);
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
    }
 else {
      sendSMS(context,number,text);
      sendToSelf(context,number,text,Prephase3Activity.SENT);
      MessageService.dba.addNewMessage(new Message(text,true,true),number,true);
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
    }
    return true;
  }
 catch (  Exception e) {
    Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
    e.printStackTrace();
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Sends a message as encrypted or plain text based on the contact's state.
 * @param number : String the number the text message is being sent to
 * @param text : String the text message
 * @param context : Context the context of the class
 * @return : boolean whether the message sent or not
 */
public static boolean sendMessage(String number,String text,Context context){
  try {
    if (MessageService.dba.isTrustedContact(number) && Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
      String encrypted=Encryption.aes_encrypt(MessageService.dba.getRow(format(number)).getNumber(format(number)).getPublicKey(),text);
      sendSMS(context,number,encrypted);
      if (Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
        sendToSelf(context,number,encrypted,Prephase3Activity.SENT);
        MessageService.dba.addNewMessage(new Message(encrypted,true,true),number,false);
      }
      sendToSelf(context,number,text,Prephase3Activity.SENT);
      MessageService.dba.addNewMessage(new Message(text,true,true),number,false);
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
    }
 else {
      sendSMS(context,number,text);
      sendToSelf(context,number,text,Prephase3Activity.SENT);
      MessageService.dba.addNewMessage(new Message(text,true,true),number,true);
      Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
    }
    return true;
  }
 catch (  Exception e) {
    Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
    e.printStackTrace();
    return false;
  }
}