Program: 114716
Project: 114716
Buggy source:
public List<InviteFriend> getContactsWithEmail(){
  List<InviteFriend> friendsContactsList=new ArrayList<InviteFriend>();
  Uri uri=null;
  ContentResolver contentResolver=context.getContentResolver();
  String[] PROJECTION=new String[]{ContactsContract.RawContacts._ID,ContactsContract.Contacts.DISPLAY_NAME,ContactsContract.Contacts.PHOTO_ID,ContactsContract.CommonDataKinds.Email.DATA,ContactsContract.CommonDataKinds.Photo.CONTACT_ID};
  String order="String_Node_Str" + ContactsContract.Contacts.DISPLAY_NAME + "String_Node_Str"+ ContactsContract.CommonDataKinds.Phone.CONTACT_ID+ "String_Node_Str"+ ContactsContract.Contacts.DISPLAY_NAME+ "String_Node_Str"+ ContactsContract.CommonDataKinds.Email.DATA+ "String_Node_Str";
  String filter=ContactsContract.CommonDataKinds.Email.DATA + "String_Node_Str";
  Cursor cursor=contentResolver.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,PROJECTION,filter,null,order);
  if (cursor.moveToFirst()) {
    String id;
    String name;
    String email;
    do {
      name=cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
      email=cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
      id=cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID));
      if (ContactsContract.Contacts.CONTENT_URI != null) {
        uri=ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI,Long.parseLong(id));
      }
      friendsContactsList.add(new InviteFriend(email,name,null,InviteFriend.VIA_CONTACTS_TYPE,uri,false));
    }
 while (cursor.moveToNext());
  }
  cursor.close();
  return friendsContactsList;
}

Fixed version (ground truth):
public List<InviteFriend> getContactsWithEmail(){
  List<InviteFriend> friendsContactsList=new ArrayList<InviteFriend>();
  Uri uri=null;
  ContentResolver contentResolver=context.getContentResolver();
  String[] PROJECTION=new String[]{ContactsContract.RawContacts._ID,ContactsContract.Contacts.DISPLAY_NAME,ContactsContract.Contacts.PHOTO_ID,ContactsContract.CommonDataKinds.Email.DATA,ContactsContract.CommonDataKinds.Photo.CONTACT_ID};
  String order="String_Node_Str" + ContactsContract.Contacts.DISPLAY_NAME + "String_Node_Str"+ ContactsContract.CommonDataKinds.Phone.CONTACT_ID+ "String_Node_Str"+ ContactsContract.Contacts.DISPLAY_NAME+ "String_Node_Str"+ ContactsContract.CommonDataKinds.Email.DATA+ "String_Node_Str";
  String filter=ContactsContract.CommonDataKinds.Email.DATA + "String_Node_Str";
  Cursor cursor=contentResolver.query(ContactsContract.CommonDataKinds.Email.CONTENT_URI,PROJECTION,filter,null,order);
  if (cursor.moveToFirst()) {
    String id;
    String name;
    String email;
    do {
      name=cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
      email=cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Email.DATA));
      id=cursor.getString(cursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.CONTACT_ID));
      if (ContactsContract.Contacts.CONTENT_URI != null) {
        uri=ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI,Long.parseLong(id));
        uri=Uri.withAppendedPath(uri,ContactsContract.Contacts.Photo.CONTENT_DIRECTORY);
      }
      friendsContactsList.add(new InviteFriend(email,name,null,InviteFriend.VIA_CONTACTS_TYPE,uri,false));
    }
 while (cursor.moveToNext());
  }
  cursor.close();
  return friendsContactsList;
}