Program: 187427
Project: 187427
Buggy source:
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.add_contact);
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  listView=(ListView)findViewById(R.id.contact_numbers);
  addNumber=(Button)findViewById(R.id.add_new_number);
  if (!addContact) {
    contactEdit=editTc;
  }
 else {
    contactEdit=new TrustedContact("String_Node_Str");
  }
  update(null);
  addNumber.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      final EditText input=new EditText(getBaseContext());
      input.setInputType(InputType.TYPE_CLASS_PHONE);
      AlertDialog.Builder builder=new AlertDialog.Builder(AddContact.this);
      builder.setMessage("String_Node_Str").setCancelable(true).setView(input).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int id){
          String value=input.getText().toString();
          update(value);
          input.setText("String_Node_Str");
        }
      }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int whichButton){
        }
      }
);
      AlertDialog alert=builder.create();
      alert.show();
    }
  }
);
  listView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    final int position,    long id){
      if (contactEdit != null) {
        final EditText input=new EditText(getBaseContext());
        input.setText(contactEdit.getNumber(position));
        input.setInputType(InputType.TYPE_CLASS_PHONE);
        AlertDialog.Builder builder=new AlertDialog.Builder(AddContact.this);
        builder.setMessage("String_Node_Str").setCancelable(true).setView(input).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int id){
            contactEdit.setNumber(position,input.getText().toString());
            update(null);
            input.setText("String_Node_Str");
          }
        }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int whichButton){
          }
        }
);
        AlertDialog alert=builder.create();
        alert.show();
      }
    }
  }
);
  add=(Button)findViewById(R.id.add);
  contactName=(EditText)findViewById(R.id.contact_name);
  if (contactEdit != null) {
    if (contactEdit.getName() != null) {
      contactName.setText(contactEdit.getName());
    }
  }
  add.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      String name=contactName.getText().toString();
      boolean empty=false;
      if (name == null) {
        if (!contactEdit.isNumbersEmpty()) {
          name=contactEdit.getANumber();
        }
 else {
          empty=true;
        }
      }
{
        contactEdit.setName(name);
      }
      if (!empty && contactEdit.getName().length() > 0 && !contactEdit.isNumbersEmpty()) {
        if (addContact) {
          if (!Prephase2Activity.dba.inDatabase(contactEdit.getANumber())) {
            Prephase2Activity.dba.addRow(contactEdit);
            contactEdit=null;
            editTc=null;
            finish();
          }
 else {
            AlertDialog.Builder builder=new AlertDialog.Builder(AddContact.this);
            builder.setMessage("String_Node_Str").setCancelable(true).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int id){
              }
            }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int whichButton){
              }
            }
);
            AlertDialog alert=builder.create();
            alert.show();
          }
        }
 else {
          Prephase2Activity.dba.updateRow(contactEdit,contactEdit.getNumber(0));
          contactEdit=null;
          editTc=null;
          finish();
        }
      }
 else {
        AlertDialog.Builder builder=new AlertDialog.Builder(AddContact.this);
        builder.setMessage("String_Node_Str").setCancelable(true).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int id){
          }
        }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int whichButton){
          }
        }
);
        AlertDialog alert=builder.create();
        alert.show();
      }
    }
  }
);
}

Fixed version (ground truth):
public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.add_contact);
  getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
  listView=(ListView)findViewById(R.id.contact_numbers);
  addNumber=(Button)findViewById(R.id.add_new_number);
  if (!addContact) {
    contactEdit=editTc;
  }
 else {
    contactEdit=new TrustedContact("String_Node_Str");
  }
  update(null);
  addNumber.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      final EditText input=new EditText(getBaseContext());
      input.setInputType(InputType.TYPE_CLASS_PHONE);
      AlertDialog.Builder builder=new AlertDialog.Builder(AddContact.this);
      builder.setMessage("String_Node_Str").setCancelable(true).setView(input).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int id){
          String value=input.getText().toString();
          update(value);
          input.setText("String_Node_Str");
        }
      }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
        public void onClick(        DialogInterface dialog,        int whichButton){
          dialog.cancel();
        }
      }
);
      AlertDialog alert=builder.create();
      alert.show();
    }
  }
);
  listView.setOnItemClickListener(new OnItemClickListener(){
    public void onItemClick(    AdapterView<?> parent,    View view,    final int position,    long id){
      if (contactEdit != null) {
        final EditText input=new EditText(getBaseContext());
        input.setText(contactEdit.getNumber(position));
        input.setInputType(InputType.TYPE_CLASS_PHONE);
        AlertDialog.Builder builder=new AlertDialog.Builder(AddContact.this);
        builder.setMessage("String_Node_Str").setCancelable(true).setView(input).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int id){
            contactEdit.setNumber(position,input.getText().toString());
            update(null);
            input.setText("String_Node_Str");
          }
        }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int whichButton){
            dialog.cancel();
          }
        }
);
        AlertDialog alert=builder.create();
        alert.show();
      }
    }
  }
);
  add=(Button)findViewById(R.id.add);
  contactName=(EditText)findViewById(R.id.contact_name);
  if (contactEdit != null) {
    if (contactEdit.getName() != null) {
      contactName.setText(contactEdit.getName());
    }
  }
  add.setOnClickListener(new View.OnClickListener(){
    public void onClick(    View v){
      String name=contactName.getText().toString();
      boolean empty=false;
      if (name == null) {
        if (!contactEdit.isNumbersEmpty()) {
          name=contactEdit.getANumber();
        }
 else {
          empty=true;
        }
      }
{
        contactEdit.setName(name);
      }
      if (!empty && contactEdit.getName().length() > 0 && !contactEdit.isNumbersEmpty()) {
        if (addContact) {
          if (!Prephase2Activity.dba.inDatabase(contactEdit.getANumber())) {
            Prephase2Activity.dba.addRow(contactEdit);
            contactEdit=null;
            editTc=null;
            finish();
          }
 else {
            AlertDialog.Builder builder=new AlertDialog.Builder(AddContact.this);
            builder.setMessage("String_Node_Str").setCancelable(true).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int id){
              }
            }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
              public void onClick(              DialogInterface dialog,              int whichButton){
                dialog.cancel();
              }
            }
);
            AlertDialog alert=builder.create();
            alert.show();
          }
        }
 else {
          Prephase2Activity.dba.updateRow(contactEdit,contactEdit.getNumber(0));
          contactEdit=null;
          editTc=null;
          finish();
        }
      }
 else {
        AlertDialog.Builder builder=new AlertDialog.Builder(AddContact.this);
        builder.setMessage("String_Node_Str").setCancelable(true).setPositiveButton("String_Node_Str",new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int id){
          }
        }
).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
          public void onClick(          DialogInterface dialog,          int whichButton){
            dialog.cancel();
          }
        }
);
        AlertDialog alert=builder.create();
        alert.show();
      }
    }
  }
);
}