Program: 187405
Project: 187405
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (this.getIntent().hasExtra(MessageService.notificationIntent)) {
    Prephase3Activity.selectedNumber=this.getIntent().getStringExtra(MessageService.notificationIntent);
  }
 else   if (this.getIntent().hasExtra(Prephase3Activity.selectedNumberIntent)) {
    Prephase3Activity.selectedNumber=this.getIntent().getStringExtra(Prephase3Activity.selectedNumberIntent);
  }
 else {
    finish();
  }
  setContentView(R.layout.messageviewer);
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  MessageService.dba=new DBAccessor(this);
  list2=(ListView)findViewById(R.id.message_list);
  msgList2=MessageService.dba.getSMSList(Prephase3Activity.selectedNumber);
  messages=new MessageAdapter(this,R.layout.listview_full_item_row,msgList2,MessageService.dba.getUnreadMessageCount(Prephase3Activity.selectedNumber));
  list2.setAdapter(messages);
  list2.setItemsCanFocus(false);
  if (MessageService.dba.getUnreadMessageCount(Prephase3Activity.selectedNumber) > 0) {
    MessageService.dba.updateMessageCount(Prephase3Activity.selectedNumber,0);
    if (MessageService.mNotificationManager != null) {
      MessageService.mNotificationManager.cancel(MessageService.INDEX);
    }
  }
  list2.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
    }
  }
);
  sendSMS=(Button)findViewById(R.id.send);
  messageBox=(EditText)findViewById(R.id.message);
  sendSMS.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      String text=messageBox.getText().toString();
      if (Prephase3Activity.selectedNumber.length() > 0 && text.length() > 0) {
        messages.setCount(0);
        try {
          messageBox.setText("String_Node_Str");
          if (MessageService.dba.isTrustedContact(Prephase3Activity.selectedNumber) && Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
            String encrypted=Encryption.aes_encrypt(MessageService.dba.getRow(SMSUtility.format(Prephase3Activity.selectedNumber)).getPublicKey(),text);
            SMSUtility.sendSMS(getBaseContext(),Prephase3Activity.selectedNumber,encrypted);
            Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,encrypted,Prephase3Activity.SENT);
            Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,text,Prephase3Activity.SENT);
            if (Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
              MessageService.dba.addNewMessage(new Message(encrypted,true,true),Prephase3Activity.selectedNumber,true);
            }
            MessageService.dba.addNewMessage(new Message(text,true,true),Prephase3Activity.selectedNumber,true);
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
 else {
            SMSUtility.sendSMS(getBaseContext(),Prephase3Activity.selectedNumber,text);
            Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,text,Prephase3Activity.SENT);
            MessageService.dba.addNewMessage(new Message(text,true,true),Prephase3Activity.selectedNumber,true);
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
          updateList(getBaseContext());
        }
 catch (        Exception e) {
          Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
          e.printStackTrace();
        }
      }
 else {
        AlertDialog.Builder builder=new AlertDialog.Builder(MessageView.this);
        builder.setMessage("String_Node_Str").setCancelable(false).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int id){
          }
        }
);
        AlertDialog alert=builder.create();
        alert.show();
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  if (this.getIntent().hasExtra(MessageService.notificationIntent)) {
    Prephase3Activity.selectedNumber=this.getIntent().getStringExtra(MessageService.notificationIntent);
  }
 else   if (this.getIntent().hasExtra(Prephase3Activity.selectedNumberIntent)) {
    Prephase3Activity.selectedNumber=this.getIntent().getStringExtra(Prephase3Activity.selectedNumberIntent);
  }
 else {
    finish();
  }
  setContentView(R.layout.messageviewer);
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  MessageService.dba=new DBAccessor(this);
  list2=(ListView)findViewById(R.id.message_list);
  msgList2=MessageService.dba.getSMSList(Prephase3Activity.selectedNumber);
  messages=new MessageAdapter(this,R.layout.listview_full_item_row,msgList2,MessageService.dba.getUnreadMessageCount(Prephase3Activity.selectedNumber));
  list2.setAdapter(messages);
  list2.setItemsCanFocus(false);
  if (MessageService.dba.getUnreadMessageCount(Prephase3Activity.selectedNumber) > 0) {
    MessageService.dba.updateMessageCount(Prephase3Activity.selectedNumber,0);
    if (MessageService.mNotificationManager != null) {
      MessageService.mNotificationManager.cancel(MessageService.INDEX);
    }
  }
  list2.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    int position,    long id){
    }
  }
);
  sendSMS=(Button)findViewById(R.id.send);
  messageBox=(EditText)findViewById(R.id.message);
  sendSMS.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      String text=messageBox.getText().toString();
      if (Prephase3Activity.selectedNumber.length() > 0 && text.length() > 0) {
        messages.setCount(0);
        messageBox.setText("String_Node_Str");
        try {
          if (MessageService.dba.isTrustedContact(Prephase3Activity.selectedNumber) && Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
            String encrypted=Encryption.aes_encrypt(MessageService.dba.getRow(SMSUtility.format(Prephase3Activity.selectedNumber)).getPublicKey(),text);
            SMSUtility.sendSMS(getBaseContext(),Prephase3Activity.selectedNumber,encrypted);
            if (Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
              Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,encrypted,Prephase3Activity.SENT);
              MessageService.dba.addNewMessage(new Message(encrypted,true,true),Prephase3Activity.selectedNumber,true);
            }
            Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,text,Prephase3Activity.SENT);
            MessageService.dba.addNewMessage(new Message(text,true,true),Prephase3Activity.selectedNumber,true);
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
 else {
            SMSUtility.sendSMS(getBaseContext(),Prephase3Activity.selectedNumber,text);
            Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,text,Prephase3Activity.SENT);
            MessageService.dba.addNewMessage(new Message(text,true,true),Prephase3Activity.selectedNumber,true);
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
          updateList(getBaseContext());
        }
 catch (        Exception e) {
          Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
          e.printStackTrace();
        }
      }
 else {
      }
    }
  }
);
}