[Demonstration 1]

[Buggy Method]
@Override
public void readLacComplete(int rc, long ledgerId, final ChannelBuffer lacBuffer, final ChannelBuffer lastEntryBuffer, Object ctx) {
    int bookieIndex = (Integer) ctx;
    numResponsesPending--;
    boolean heardValidResponse = false;
    if (completed) {
        return;
    }
    if (rc == BKException.Code.OK) {
        try {
            // Each bookie may have two store LAC in two places.
            // One is in-memory copy in FileInfo and other is
            // piggy-backed LAC on the last entry.
            // This routine picks both of them and compares to return
            // the latest Lac.
            // Extract lac from FileInfo on the ledger.
            long lac = lh.macManager.verifyDigestAndReturnLac(lacBuffer);
            if (lac > maxLac) {
                maxLac = lac;
            }
            // Extract lac from last entry on the disk
            RecoveryData recoveryData = lh.macManager.verifyDigestAndReturnLastConfirmed(lastEntryBuffer);
            if (recoveryData.lastAddConfirmed > maxLac) {
                maxLac = recoveryData.lastAddConfirmed;
            }
            heardValidResponse = true;
        } catch (BKDigestMatchException e) {
            // Too bad, this bookie did not give us a valid answer, we
            // still might be able to recover. So, continue
            LOG.error("Mac mismatch while reading  ledger: " + ledgerId + " LAC from bookie: " + lh.metadata.currentEnsemble.get(bookieIndex));
            rc = BKException.Code.DigestMatchException;
        }
    }
    if (rc == BKException.Code.NoSuchLedgerExistsException || rc == BKException.Code.NoSuchEntryException) {
        heardValidResponse = true;
    }
    if (rc == BKException.Code.UnauthorizedAccessException && !completed) {
        cb.getLacComplete(rc, maxLac);
        completed = true;
        return;
    }
    if (!heardValidResponse && BKException.Code.OK != rc) {
        lastSeenError = rc;
    }
    // We don't consider a success until we have coverage set responses.
    if (heardValidResponse && coverageSet.addBookieAndCheckCovered(bookieIndex) && !completed) {
        completed = true;
        LOG.debug("Read LAC complete with enough validResponse for ledger: {} LAC: {}", ledgerId, maxLac);
        cb.getLacComplete(rc, maxLac);
        return;
    }
    if (numResponsesPending == 0 && !completed) {
        LOG.info("While readLac ledger: " + ledgerId + " did not hear success responses from all of ensemble");
        cb.getLacComplete(lastSeenError, maxLac);
    }
}

[Buggy Hunk]
cb.getLacComplete(rc, maxLac);

[Patch]
cb.getLacComplete(BKException.Code.OK, maxLac);

[Demonstration 2]

[Buggy Method]
public static Collection<File> listAttachmentFiles(File... directories) {
    return listFilesByRegex(AllureConfig.newInstance().getAttachmentFileRegex(), directories);
}

[Buggy Hunk]
public static Collection<File> listAttachmentFiles(File... directories) {

[Patch]
public static List<File> listAttachmentFiles(File... directories) {

[Demonstration 3]

[Buggy Method]
public int[] getSolution() {
    return solution;
}

[Buggy Hunk]
return solution;

[Patch]
return Arrays.copyOf(solution, solution.length);