Program: 187416
Project: 187416
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  Intent serviceIntent=new Intent(context,MessageService.class);
  context.startService(serviceIntent);
  Bundle bundle=intent.getExtras();
  if (bundle != null) {
    Object[] pdus=(Object[])bundle.get("String_Node_Str");
    final SmsMessage[] messages=new SmsMessage[pdus.length];
    for (int i=0; i < pdus.length; i++) {
      messages[i]=SmsMessage.createFromPdu((byte[])pdus[i]);
    }
    if (messages.length > -1) {
      String address=messages[0].getOriginatingAddress();
      if (MessageService.dba.isTrustedContact((address))) {
        Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
        Toast.makeText(context,messages[0].getMessageBody(),Toast.LENGTH_LONG).show();
        TrustedContact trustedContact=MessageService.dba.getRow(ContactRetriever.format(address));
        try {
          Prephase3Activity.sendToSelf(context,messages[0].getOriginatingAddress(),messages[0].getMessageBody(),Prephase3Activity.INBOX);
          String secretMessage=Encryption.aes_decrypt(trustedContact.getPublicKey(),messages[0].getMessageBody());
          Prephase3Activity.sendToSelf(context,messages[0].getOriginatingAddress(),secretMessage,Prephase3Activity.INBOX);
          MessageService.dba.UpdateLastMessage(address,secretMessage);
          Prephase3Activity.updateList(context);
          Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
        }
 catch (        Exception e) {
          Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
          e.printStackTrace();
        }
      }
 else {
        Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
        Toast.makeText(context,messages[0].getMessageBody(),Toast.LENGTH_LONG).show();
        Prephase3Activity.sendToSelf(context,messages[0].getOriginatingAddress(),messages[0].getMessageBody(),Prephase3Activity.INBOX);
        Prephase3Activity.updateList(context);
      }
    }
  }
  this.abortBroadcast();
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  Intent serviceIntent=new Intent(context,MessageService.class);
  context.startService(serviceIntent);
  Bundle bundle=intent.getExtras();
  if (bundle != null) {
    Object[] pdus=(Object[])bundle.get("String_Node_Str");
    final SmsMessage[] messages=new SmsMessage[pdus.length];
    for (int i=0; i < pdus.length; i++) {
      messages[i]=SmsMessage.createFromPdu((byte[])pdus[i]);
    }
    if (messages.length > -1) {
      if (MessageService.dba == null) {
        MessageService.dba=new DBAccessor(context);
      }
      String address=messages[0].getOriginatingAddress();
      if (MessageService.dba.isTrustedContact((address))) {
        Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
        Toast.makeText(context,messages[0].getMessageBody(),Toast.LENGTH_LONG).show();
        try {
          Prephase3Activity.sendToSelf(context,messages[0].getOriginatingAddress(),messages[0].getMessageBody(),Prephase3Activity.INBOX);
          String secretMessage=Encryption.aes_decrypt(MessageService.dba.getRow(ContactRetriever.format(address)).getPublicKey(),messages[0].getMessageBody());
          Prephase3Activity.sendToSelf(context,messages[0].getOriginatingAddress(),secretMessage,Prephase3Activity.INBOX);
          MessageService.dba.UpdateLastMessage(address,secretMessage);
          Prephase3Activity.updateList(context);
          Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
        }
 catch (        Exception e) {
          Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
          e.printStackTrace();
        }
      }
 else {
        Toast.makeText(context,"String_Node_Str",Toast.LENGTH_LONG).show();
        Toast.makeText(context,messages[0].getMessageBody(),Toast.LENGTH_LONG).show();
        Prephase3Activity.sendToSelf(context,messages[0].getOriginatingAddress(),messages[0].getMessageBody(),Prephase3Activity.INBOX);
        Prephase3Activity.updateList(context);
      }
    }
  }
  this.abortBroadcast();
}