[Demonstration 1]

[Buggy Method]
@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {
        if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
            setTitle("Reddit - " + prevMenuItem.getTitle().toString());
            prevMenuItem.setChecked(true);
            boolean b = getSupportFragmentManager().popBackStackImmediate();
        } else {
            super.onBackPressed();
        }
    }
}

[Buggy Hunk]
boolean b = getSupportFragmentManager().popBackStackImmediate();

[Patch]
getSupportFragmentManager().popBackStackImmediate();

[Demonstration 2]

[Buggy Method]
private void updateTabStyles() {
    for (int i = 0; i < tabCount; i++) {
        //			View v = tabsContainer.getChildAt(i);
        //
        //			v.setBackgroundResource(tabBackgroundResId);
        //
        //
        //			if (v instanceof TextView) {
        //				TextView tab = (TextView) v;
        //				tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
        //				tab.setTypeface(tabTypeface, tabTypefaceStyle);
        //				tab.setTextColor(tabTextColor);
        //
        //				// setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
        //				// pre-ICS-build
        //				if (textAllCaps) {
        //					if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        //						tab.setAllCaps(true);
        //					} else {
        //						tab.setText(tab.getText().toString().toUpperCase(locale));
        //					}
        //				}
        //				if (i == selectedPosition) {
        //					tab.setTextColor(selectedTabTextColor);
        //				}
        //			}
        FrameLayout frameLayout = (FrameLayout) tabsContainer.getChildAt(i);
        frameLayout.setBackgroundResource(tabBackgroundResId);
        for (int j = 0; j < frameLayout.getChildCount(); j++) {
            View v = frameLayout.getChildAt(j);
            if (v instanceof TextView) {
                TextView tab = (TextView) v;
                tab.setTextSize(TypedValue.COMPLEX_UNIT_PX, tabTextSize);
                tab.setTypeface(tabTypeface, tabTypefaceStyle);
                if (j == 0) {
                    tab.setTextColor(tabTextColor);
                } else {
                    tab.setTextColor(selectedTabTextColor);
                }
                ViewHelper.setAlpha(tabViews.get(i).get("normal"), 1);
                ViewHelper.setAlpha(tabViews.get(i).get("selected"), 0);
                //set normal  Scale
                ViewHelper.setPivotX(frameLayout, frameLayout.getMeasuredWidth() * 0.5f);
                ViewHelper.setPivotY(frameLayout, frameLayout.getMeasuredHeight() * 0.5f);
                ViewHelper.setScaleX(frameLayout, 1f);
                ViewHelper.setScaleY(frameLayout, 1f);
                // setAllCaps() is only available from API 14, so the upper case is made manually if we are on a
                // pre-ICS-build
                if (textAllCaps) {
                    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
                        tab.setAllCaps(true);
                    } else {
                        tab.setText(tab.getText().toString().toUpperCase(locale));
                    }
                }
                if (i == currentPosition) {
                    ViewHelper.setAlpha(tabViews.get(i).get("normal"), 0);
                    ViewHelper.setAlpha(tabViews.get(i).get("selected"), 1);
                    //set select  Scale
                    ViewHelper.setPivotX(frameLayout, frameLayout.getMeasuredWidth() * 0.5f);
                    ViewHelper.setPivotY(frameLayout, frameLayout.getMeasuredHeight() * 0.5f);
                    ViewHelper.setScaleX(frameLayout, 1 + ZOOM_MAX);
                    ViewHelper.setScaleY(frameLayout, 1 + ZOOM_MAX);
                }
            }
        }
    }
}

[Buggy Hunk]
if (i == currentPosition) {

[Patch]
if (i == selectedPosition) {

[Demonstration 3]

[Buggy Method]
public static Result service(String ownerName, String projectName, String service, boolean isAdvertise) throws IOException, UnsupportedOperationException, ServletException {
    if (!isSupportedService(service)) {
        return forbidden(String.format("Unsupported service: '%s'", service));
    }
    Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
    if (project == null) {
        return notFound();
    }
    models.User user = UserApp.currentUser();
    if (!isAllowed(project, service)) {
        if (user.isAnonymous()) {
            return BasicAuthAction.unauthorized(response());
        } else {
            // If you want the Git client showing your custom message to
            // the user, the Content-Type should be exact "text/plain"
            // without any parameter. For more details, see the code at
            // https://github.com/git/git/commit/426e70d4a11ce3b4f70636d57c6a0ab16ae08a00#diff-eea0ad565ec5903a11b6023755d491cfR154
            response().setHeader("Content-Type", "text/plain");
            return forbidden(String.format("'%s' has no permission to '%s/%s'.", user.name, ownerName, projectName));
        }
    }
    if (isAdvertise) {
        return ok(RepositoryService.gitAdvertise(project, service, response()));
    } else {
        if (request().body().isMaxSizeExceeded()) {
            return status(REQUEST_ENTITY_TOO_LARGE);
        } else {
            user.visits(project);
            return ok(RepositoryService.gitRpc(project, service, request(), response()));
        }
    }
}

[Buggy Hunk]
user.name, ownerName, projectName));

[Patch]
user.loginId, ownerName, projectName));