[Demonstration 1]

[Buggy Method]
private void loadFriends() {
    if (mMyApplication.Friends_Cach != null) {
        processFinish(mMyApplication.Friends_Cach);
    } else {
        LoadFriendsAsync loadFrinds = new LoadFriendsAsync(getActivity().getApplicationContext(), DomainUser.CURRENT_USER.getId());
        loadFrinds.delegat = this;
        loadFrinds.execute();
        mProgress.setVisibility(View.VISIBLE);
    }
}

[Buggy Hunk]
if(mMyApplication.Friends_Cach != null){

[Patch]
if(mMyApplication.Friends_Cach != null && mMyApplication.Friends_Cach.size() > 0){

[Demonstration 2]

[Buggy Method]
public void onBackPressed() {
    if (isDelayFinish && !questionAnswerAdapter.isShowAnswer()) {
        showMessage(R.string.delay_backkey_message);
        isDelayFinish = false;
        new Handler().postDelayed(new Runnable() {

            public void run() {
                isDelayFinish = true;
            }
        }, BACK_KEY_DELAY_TIME);
    } else {
        this.finish();
    }
}

[Buggy Hunk]
if (isDelayFinish && !questionAnswerAdapter.isShowAnswer()) {

[Patch]
if (isDelayFinish && questionAnswerAdapter!=null && !questionAnswerAdapter.isShowAnswer()) {

[Demonstration 3]

[Buggy Method]
public static void DoTurn(PlanetWars pw) {
    double score = -Double.MAX_VALUE;
    Planet[] result = findMinimax(pw, 3);
    Planet source = result[0];
    Planet dest = result[1];
    // Attack using the source and destinations that lead to the most promising state in the simulation
    if (source != null && dest != null) {
        pw.IssueOrder(source, dest);
    } else {
        pw.log("invalid planets");
    }
}

[Buggy Hunk]
pw.log("invalid planets");

[Patch]
logger.info("invalid planets");