Program: 187415
Project: 187415
Buggy source:
/** 
 * Called when the activity is first created. 
 */
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.new_message);
  MessageService.dba=new DBAccessor(this);
  Prephase3Activity.sharedPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  newCont=new TrustedContact();
  tc=MessageService.dba.getAllRows();
  phoneBox=(AutoCompleteTextView)findViewById(R.id.new_message_number);
  List<String> contact;
  if (tc != null) {
    contact=ContactRetriever.contactDisplayMaker(tc);
  }
 else {
    contact=null;
  }
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,R.layout.auto_complete_list_item,contact);
  phoneBox.setAdapter(adapter);
  phoneBox.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(    Editable s){
      String[] info=s.toString().split("String_Node_Str");
      if (!info[0].equalsIgnoreCase(s.toString())) {
        newCont.setName(info[0]);
        newCont.setNumber(0,info[1]);
      }
 else {
        if (newCont.isNumbersEmpty()) {
          newCont.addNumber(info[0]);
        }
 else {
          newCont.setNumber(0,info[0]);
        }
      }
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
  sendSMS=(Button)findViewById(R.id.new_message_send);
  messageBox=(EditText)findViewById(R.id.new_message_message);
  sendSMS.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      final String number=newCont.getNumber(0);
      String text=messageBox.getText().toString();
      if (number.length() > 0 && text.length() > 0) {
        try {
          if (MessageService.dba.isTrustedContact(number) && Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
            ContactRetriever.sendSMS(getBaseContext(),number,Encryption.aes_encrypt(MessageService.dba.getRow(ContactRetriever.format(number)).getPublicKey(),text));
            Prephase3Activity.sendToSelf(getBaseContext(),number,Encryption.aes_encrypt(MessageService.dba.getRow(ContactRetriever.format(number)).getPublicKey(),text),Prephase3Activity.SENT);
            Prephase3Activity.sendToSelf(getBaseContext(),number,text,Prephase3Activity.SENT);
            MessageService.dba.updateLastMessage(new Number(ContactRetriever.format(number),1,text));
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
 else {
            ContactRetriever.sendSMS(getBaseContext(),number,text);
            Prephase3Activity.sendToSelf(getBaseContext(),number,text,Prephase3Activity.SENT);
            MessageService.dba.updateLastMessage(new Number(ContactRetriever.format(number),1,text));
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
          if (!MessageService.dba.inDatabase(number)) {
            AlertDialog.Builder builder=new AlertDialog.Builder(SendMessageActivity.this);
            builder.setMessage("String_Node_Str" + number + "String_Node_Str").setCancelable(false).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int id){
                AddContact.editTc=new TrustedContact("String_Node_Str");
                AddContact.editTc.addNumber(number);
                AddContact.addContact=true;
                SendMessageActivity.this.startActivity(new Intent(SendMessageActivity.this,AddContact.class));
                finish();
              }
            }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int id){
                dialog.cancel();
              }
            }
);
            AlertDialog alert=builder.create();
            alert.show();
          }
          messageBox.setText("String_Node_Str");
          phoneBox.setText("String_Node_Str");
        }
 catch (        Exception e) {
          Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
          e.printStackTrace();
        }
      }
 else {
        AlertDialog.Builder builder=new AlertDialog.Builder(SendMessageActivity.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. 
 */
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.new_message);
  MessageService.dba=new DBAccessor(this);
  Prephase3Activity.sharedPrefs=PreferenceManager.getDefaultSharedPreferences(this);
  newCont=new TrustedContact();
  tc=MessageService.dba.getAllRows();
  phoneBox=(AutoCompleteTextView)findViewById(R.id.new_message_number);
  List<String> contact;
  if (tc != null) {
    contact=ContactRetriever.contactDisplayMaker(tc);
  }
 else {
    contact=null;
  }
  ArrayAdapter<String> adapter=new ArrayAdapter<String>(this,R.layout.auto_complete_list_item,contact);
  phoneBox.setAdapter(adapter);
  phoneBox.addTextChangedListener(new TextWatcher(){
    public void afterTextChanged(    Editable s){
      String[] info=s.toString().split("String_Node_Str");
      if (!info[0].equalsIgnoreCase(s.toString())) {
        newCont.setName(info[0]);
        newCont.setNumber(0,info[1]);
      }
 else {
        if (newCont.isNumbersEmpty()) {
          newCont.addNumber(info[0]);
        }
 else {
          newCont.setNumber(0,info[0]);
        }
      }
    }
    public void beforeTextChanged(    CharSequence s,    int start,    int count,    int after){
    }
    public void onTextChanged(    CharSequence s,    int start,    int before,    int count){
    }
  }
);
  sendSMS=(Button)findViewById(R.id.new_message_send);
  messageBox=(EditText)findViewById(R.id.new_message_message);
  sendSMS.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      final String number=newCont.getNumber(0);
      String text=messageBox.getText().toString();
      if (number.length() > 0 && text.length() > 0) {
        try {
          if (MessageService.dba.isTrustedContact(number) && Prephase3Activity.sharedPrefs.getBoolean("String_Node_Str",true)) {
            ContactRetriever.sendSMS(getBaseContext(),number,Encryption.aes_encrypt(MessageService.dba.getRow(ContactRetriever.format(number)).getPublicKey(),text));
            Prephase3Activity.sendToSelf(getBaseContext(),number,Encryption.aes_encrypt(MessageService.dba.getRow(ContactRetriever.format(number)).getPublicKey(),text),Prephase3Activity.SENT);
            Prephase3Activity.sendToSelf(getBaseContext(),number,text,Prephase3Activity.SENT);
            MessageService.dba.updateLastMessage(new Number(ContactRetriever.format(number),text));
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
 else {
            ContactRetriever.sendSMS(getBaseContext(),number,text);
            Prephase3Activity.sendToSelf(getBaseContext(),number,text,Prephase3Activity.SENT);
            MessageService.dba.updateLastMessage(new Number(ContactRetriever.format(number),text));
            Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
          }
          if (!MessageService.dba.inDatabase(number)) {
            AlertDialog.Builder builder=new AlertDialog.Builder(SendMessageActivity.this);
            builder.setMessage("String_Node_Str" + number + "String_Node_Str").setCancelable(false).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int id){
                AddContact.editTc=new TrustedContact("String_Node_Str");
                AddContact.editTc.addNumber(number);
                AddContact.addContact=true;
                SendMessageActivity.this.startActivity(new Intent(SendMessageActivity.this,AddContact.class));
                finish();
              }
            }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int id){
                dialog.cancel();
              }
            }
);
            AlertDialog alert=builder.create();
            alert.show();
          }
          messageBox.setText("String_Node_Str");
          phoneBox.setText("String_Node_Str");
        }
 catch (        Exception e) {
          Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
          e.printStackTrace();
        }
      }
 else {
        AlertDialog.Builder builder=new AlertDialog.Builder(SendMessageActivity.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();
      }
    }
  }
);
}