[Demonstration 1]

[Buggy Method]
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_form_transaction);
    this.dbHelper = new MoneyKeeperDBHelper(getApplicationContext(), this);
    dbHelper.getExpenditures();
    dbHelper.getIncomes();
    Toolbar toolbar = (Toolbar) findViewById(R.id.my_toolbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    amount = (TextInputEditText) findViewById(R.id.form_amount);
    comment = (TextInputEditText) findViewById(R.id.form_comment);
    division = (AppCompatSpinner) findViewById(R.id.division_spinner);
    inOrOut = (AppCompatSpinner) findViewById(R.id.in_or_out_spinner);
    inOrOut.setAdapter(new ArrayAdapter(this, R.layout.spinner_element, inOrOutArray));
    inOrOut.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {

        @Override
        public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
            switch(i) {
                case 0:
                    division.setAdapter(inAdapter);
                    break;
                case 1:
                    division.setAdapter(exAdapter);
                    break;
            }
        }

        @Override
        public void onNothingSelected(AdapterView<?> adapterView) {
        }
    });
    AppCompatButton button = (AppCompatButton) findViewById(R.id.form_button);
    button.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View view) {
            MoneyKeeperDBHelper.Transaction t = new MoneyKeeperDBHelper.Transaction();
            t.amount = Integer.parseInt(amount.getText().toString());
            t.comment = comment.getText().toString();
            t.createdAt = MainActivity.getNow();
            if (inOrOut.getSelectedItemPosition() == 0) {
                t.division = MoneyKeeperDBHelper.INCOMES;
                t.divisionId = ((MoneyKeeperDBHelper.Income) division.getSelectedItem()).id;
            } else {
                t.division = MoneyKeeperDBHelper.EXPENDITURES;
                t.divisionId = ((MoneyKeeperDBHelper.Expenditure) division.getSelectedItem()).id;
            }
            dbHelper.insertTransaction(t);
            setResult(RESULT_OK);
            finish();
        }
    });
}

[Buggy Hunk]
t.createdAt = MainActivity.getNow();

[Patch]
t.createdAt = MainActivity.getyyyyMMdd();

[Demonstration 2]

[Buggy Method]
@Override
public Collection<Triple> getbyPredicate(final long p) {
    /* Get predicate's multimap */
    Collection<Triple> result = null;
    this.globalLock.readLock().lock();
    Multimap<Long, Long> map = null;
    try {
        map = this.internalstore.get(p);
    } catch (final Exception e) {
        logger.error("", e);
    } finally {
        this.globalLock.readLock().unlock();
        if (map == null) {
            return new ArrayList<Triple>();
        }
    }
    /* construct list of all triples */
    final ReentrantReadWriteLock lock = this.getLock(p);
    lock.writeLock().lock();
    try {
        result = new ArrayList<Triple>();
        for (final Entry<Long, Long> entry : map.entries()) {
            result.add(new ImmutableTriple(entry.getKey(), p, entry.getValue()));
        }
    } catch (final Exception e) {
        logger.error("", e);
    } finally {
        lock.readLock().unlock();
    }
    return result;
}

[Buggy Hunk]
lock.readLock().unlock();

[Patch]
lock.writeLock().unlock();

[Demonstration 3]

[Buggy Method]
@Test
public void deleteFileTest() throws Exception {
    // cannot delete root
    Assert.assertFalse(mFileSystemMaster.deleteFile(ROOT_URI, true));
    // delete the file
    long blockId = createFileWithSingleBlock(NESTED_FILE_URI);
    Assert.assertTrue(mFileSystemMaster.deleteFile(NESTED_FILE_URI, false));
    mThrown.expect(BlockInfoException.class);
    mBlockMaster.getBlockInfo(blockId).getLocations().size();
    // verify the file is deleted
    Assert.assertEquals(IdUtils.INVALID_FILE_ID, mFileSystemMaster.getFileId(NESTED_FILE_URI));
}

[Buggy Hunk]
mBlockMaster.getBlockInfo(blockId).getLocations().size();

[Patch]
mBlockMaster.getBlockInfo(blockId);