[Demonstration 1]

[Buggy Method]
public static synchronized void signOut() {
    Timber.d(TAG, "current user is signing out");
    OkHttpUtils.getCookieJar().clear();
    Preferences.eraseAll();
    sCurrentUserDigest = null;
    final ArrayList<Activity> activities = ActivityRegister.get();
    if (activities == null || activities.isEmpty()) {
        Timber.e(TAG, "unable to restart the app, no Activity is available");
        return;
    }
    final Activity activity = activities.get(0);
    Timber.d(TAG, "restarting the app using: " + activity.toString());
    activity.startActivity(LoginActivity.getNewTaskLaunchIntent(activity));
    for (final Activity a : activities) {
        a.finish();
    }
    activities.clear();
}

[Buggy Hunk]
OkHttpUtils.getCookieJar().clear();

[Patch]
OkHttpUtils.getPersistentCookieJar().clear();

[Demonstration 2]

[Buggy Method]
public void removeActivity(int activityID) {
    activities.remove(ID);
}

[Buggy Hunk]
activities.remove(ID);

[Patch]
activities.remove(activityID);

[Demonstration 3]

[Buggy Method]
private void addRecord(SegmentRecord record) {
    long startPosition = record.dataSegment.getStartPosition();
    long length = record.dataSegment.getLength();
    long maxPosition = startPosition + length;
    if (pointerRecord == null) {
        record.maxPosition = maxPosition;
        records.add(0, record);
        SegmentRecord nextRecord = record.next;
        while (nextRecord != null && nextRecord.maxPosition < maxPosition) {
            nextRecord.maxPosition = maxPosition;
            nextRecord = records.nextTo(nextRecord);
        }
    } else {
        if (pointerRecord.maxPosition > maxPosition) {
            maxPosition = pointerRecord.maxPosition;
        } else {
            SegmentRecord nextRecord = pointerRecord.next;
            while (nextRecord != null && maxPosition > nextRecord.maxPosition) {
                nextRecord.maxPosition = maxPosition;
                nextRecord = records.nextTo(nextRecord);
            }
        }
        record.maxPosition = maxPosition;
        records.addAfter(pointerRecord, record);
    }
}

[Buggy Hunk]
long length = record.dataSegment.getLength();

[Patch]
long length = record.getLength();