[Demonstration 1]

[Buggy Method]
private void initPersonInputForm() {
    editTextFirstName = (EditText) findViewById(R.id.editTextFirstName);
    editTextLastName = (EditText) findViewById(R.id.editTextLastName);
    radioGroup = (RadioGroup) findViewById(R.id.radioGroupGender);
    spinnerNationality = (Spinner) findViewById(R.id.spinnerNationality);
    spinnerNationality.setAdapter(new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, appUtility.getUniqueNationalitiesArray()));
    buttonAdd = (Button) findViewById(R.id.buttonAdd);
    buttonAdd.setTag("Add");
    radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {

        @Override
        public void onCheckedChanged(RadioGroup radioGroup, @IdRes int i) {
            switch(i) {
                case R.id.radioButtonMale:
                    gender = Person.GENDER.MALE;
                    break;
                case R.id.radioButtonFemale:
                    gender = Person.GENDER.FEMALE;
                    break;
                default:
                    gender = null;
            }
        }
    });
    spinnerNationality.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            nationality = getResources().getStringArray(R.array.nationalities)[i];
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    });
    buttonAdd.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            firstName = editTextFirstName.getText().toString();
            lastName = editTextLastName.getText().toString();
            Person person = null;
            if (isInputDataValid()) {
                person = new Person(firstName, lastName, gender, nationality);
            } else {
                Toast.makeText(MainActivity.this, "Input Invalid", Toast.LENGTH_LONG).show();
            }
            String behaviour = (String) buttonAdd.getTag();
            if (behaviour.equalsIgnoreCase("Add")) {
                if (person != null) {
                    people.add(person);
                    listAdapterWithRecycleView.notifyDataSetChanged();
                    recyclerView.scrollToPosition(people.size() - 1);
                    clearInputForm();
                }
            } else if (behaviour.equalsIgnoreCase("modify")) {
                if (person != null) {
                    try {
                        people.get(modificationIndex).setName(person.getName());
                        people.get(modificationIndex).setLastName(person.getLastName());
                        people.get(modificationIndex).setGender(person.getGender());
                        people.get(modificationIndex).setNationality(person.getNationality());
                        listAdapterWithRecycleView.notifyItemChanged(modificationIndex);
                        clearInputForm();
                        buttonAdd.setTag("Add");
                        buttonAdd.setText("Add");
                    } catch (IndexOutOfBoundsException exception) {
                        Toast.makeText(MainActivity.this, "Can't modify, item moved", Toast.LENGTH_LONG).show();
                        listAdapterWithRecycleView.notifyDataSetChanged();
                        clearInputForm();
                        buttonAdd.setTag("Add");
                        buttonAdd.setText("Add");
                    }
                }
            }
        }
    });
}

[Buggy Hunk]
people.get(modificationIndex).setNationality(person.getNationality());

[Patch]
people.get(modificationIndex).setNationality((String)spinnerNationality.getSelectedItem());

[Demonstration 2]

[Buggy Method]
@Override
public int getChildBrowsingObjects(BrowsingObject parent, List<BrowsingObject> children) {
    BrowsingObjectDBTaskImpl getChildrenTask = new BrowsingObjectDBTaskImpl(mBrowsingObjectBo, mEntityManagerFactory);
    getChildrenTask.setGetChildrenParam(parent);
    getChildrenTask.setScheduleMode(AbstractDBTask.SCHEDULE_SYNC_MODE);
    mDBTaskExecutor.executeDBTask(getChildrenTask);
    return getChildrenTask.getGetChildrenResult(children);
}

[Buggy Hunk]
getChildrenTask.setScheduleMode(AbstractDBTask.SCHEDULE_SYNC_MODE);

[Patch]
getChildrenTask.setScheduleMode(mScheduleMode);

[Demonstration 3]

[Buggy Method]
public String readDatabase() {
    if (!checkDBExist()) {
        return null;
    }
    Cursor cursor = database.query(ContentDescriptor.HistoriesMessage.NAME, null, null, null, null, null, null, null);
    String show = "";
    while (cursor.moveToNext()) {
        int id = cursor.getInt(cursor.getColumnIndex(ContentDescriptor.HistoriesMessage.Cols.ID));
        String name = cursor.getString(cursor.getColumnIndex(ContentDescriptor.HistoriesMessage.Cols.OWNER_USER_NAME));
        int groupType = cursor.getInt(cursor.getColumnIndex(ContentDescriptor.HistoriesMessage.Cols.HISTORY_MESSAGE_GROUP_TYPE));
        show += "id:\t" + String.valueOf(id) + "\t\t\t" + "name:\t" + name + "\t\t\t" + "groupType:\t" + groupType + "\n";
    }
    return show;
}

[Buggy Hunk]
Cursor cursor = database.query(ContentDescriptor.HistoriesMessage.NAME, null, null, null, null, null, null, null);

[Patch]
Cursor cursor = mDataBase.query(ContentDescriptor.HistoriesMessage.NAME, null, null, null, null, null, null, null);