Program: 187413
Project: 187413
Buggy source:
/** 
 * Called when the activity is first created. 
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.messageviewer);
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  MessageService.dba=new DBAccessor(this);
  Prephase3Activity.sharedPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  list2=(ListView)findViewById(R.id.message_list);
  msgList2=ContactRetriever.getPersonSMS(this);
  messages=new MessageAdapter(this,R.layout.listview_full_item_row,msgList2);
  list2.setAdapter(messages);
  list2.setItemsCanFocus(false);
  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) {
        try {
          messageBox.setText("String_Node_Str");
          if (MessageService.dba.isTrustedContact(Prephase3Activity.selectedNumber) && Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
            ContactRetriever.sendSMS(getBaseContext(),Prephase3Activity.selectedNumber,Encryption.aes_encrypt(MessageService.dba.getRow(ContactRetriever.format(Prephase3Activity.selectedNumber)).getPublicKey(),text));
            Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,Encryption.aes_encrypt(MessageService.dba.getRow(ContactRetriever.format(Prephase3Activity.selectedNumber)).getPublicKey(),text),Prephase3Activity.SENT);
            Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,text,Prephase3Activity.SENT);
            MessageService.dba.updateLastMessage(new Number(Prephase3Activity.selectedNumber,1,text));
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
 else {
            ContactRetriever.sendSMS(getBaseContext(),Prephase3Activity.selectedNumber,text);
            Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,text,Prephase3Activity.SENT);
            MessageService.dba.updateLastMessage(new Number(Prephase3Activity.selectedNumber,1,text));
            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);
  setContentView(R.layout.messageviewer);
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  MessageService.dba=new DBAccessor(this);
  Prephase3Activity.sharedPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  list2=(ListView)findViewById(R.id.message_list);
  msgList2=ContactRetriever.getPersonSMS(this);
  messages=new MessageAdapter(this,R.layout.listview_full_item_row,msgList2);
  list2.setAdapter(messages);
  list2.setItemsCanFocus(false);
  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) {
        try {
          messageBox.setText("String_Node_Str");
          if (MessageService.dba.isTrustedContact(Prephase3Activity.selectedNumber) && Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
            ContactRetriever.sendSMS(getBaseContext(),Prephase3Activity.selectedNumber,Encryption.aes_encrypt(MessageService.dba.getRow(ContactRetriever.format(Prephase3Activity.selectedNumber)).getPublicKey(),text));
            Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,Encryption.aes_encrypt(MessageService.dba.getRow(ContactRetriever.format(Prephase3Activity.selectedNumber)).getPublicKey(),text),Prephase3Activity.SENT);
            Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,text,Prephase3Activity.SENT);
            MessageService.dba.updateLastMessage(new Number(Prephase3Activity.selectedNumber,text));
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
 else {
            ContactRetriever.sendSMS(getBaseContext(),Prephase3Activity.selectedNumber,text);
            Prephase3Activity.sendToSelf(getBaseContext(),Prephase3Activity.selectedNumber,text,Prephase3Activity.SENT);
            MessageService.dba.updateLastMessage(new Number(Prephase3Activity.selectedNumber,text));
            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();
      }
    }
  }
);
}