[Demonstration 1]

[Buggy Method]
@Override
public void run() {
    Log.d(TAG, "" + System.currentTimeMillis());
    //start the
    //set origin
    PageModify page = mPages[FRONT_PAGE];
    //define the start and end point
    Point start = new Point();
    Point end = new Point();
    mIsVertical = false;
    mIsHorizontal = false;
    mFlipState = PageFlipState.END_FLIP;
    page.autoSetOriginAndDiagonalPoints();
    //activate
    computeScrollPointsForAutoFlip(true, start, end);
    mAutoStartP.set(start.x, start.y);
    mAutoEndP.set(end.x, end.y);
    autoEndDistance = calPeelDistance(mAutoEndP, page.originP);
    restoreDistance = autoEndDistance * 2;
    if (mFlipState == PageFlipState.FORWARD_FLIP || mFlipState == PageFlipState.BACKWARD_FLIP || mFlipState == PageFlipState.UPWARD_FLIP || mFlipState == PageFlipState.RESTORE_FLIP) {
        //activiate the job sheduling
        Log.d(TAG, "scroll starts");
        mScroller.startScroll(start.x, start.y, end.x - start.x, end.y - start.y, 4000);
        try {
            MainActivity.getSharedInstance().mDemoView.mDrawLock.lock();
            if (MainActivity.getSharedInstance().mDemoView.mPageRender != null && MainActivity.getSharedInstance().mDemoView.mPageRender.onAutoFlip()) {
                //indicating this is auto flip
                flipType = 2;
                MainActivity.getSharedInstance().mDemoView.requestRender();
            }
        } finally {
            MainActivity.getSharedInstance().mDemoView.mDrawLock.unlock();
        }
    }
}

[Buggy Hunk]
page.autoSetOriginAndDiagonalPoints();

[Patch]
page.autoSetOriginAndDiagonalPoints(false);

[Demonstration 2]

[Buggy Method]
public static void diff(String path, String revision) throws InterruptedException, IOException, ExecException {
    validateGitPaths(path);
    WebPage page = WebPage.forPath(path);
    List<String> args = new ArrayList<>(asList("diff", revision));
    if (path.startsWith("/"))
        path = path.substring(1);
    if (isNotEmpty(path)) {
        args.add("--");
        for (VirtualFile file : page.dir.list()) {
            if (!file.isDirectory())
                args.add(path + file.getName());
        }
    }
    String diff = git(args);
    render(ImmutableMap.of("page", page, "revision", revision, "diff", diff));
}

[Buggy Hunk]
render(ImmutableMap.of("page", page, "revision", revision, "diff", diff));

[Patch]
renderTemplate(ImmutableMap.of("page", page, "revision", revision, "diff", diff));

[Demonstration 3]

[Buggy Method]
@When("^I query for the role \"(.+)\" in scope (\\d+)$")
public void queryForRoleInScope(String name, Integer scope) throws KapuaException {
    KapuaId tmpId = null;
    assertNotNull(scope);
    tmpId = new KapuaEid(BigInteger.valueOf(scope));
    assertNotNull(tmpId);
    assertNotNull(name);
    assertNotEquals(0, name.length());
    final RoleQuery tmpQuery = roleFactory.newQuery(tmpId);
    tmpQuery.setPredicate(new AttributePredicate<String>(RolePredicates.ROLE_NAME, name));
    KapuaSecurityUtils.doPrivileged(() -> {
        roleList = roleService.query(tmpQuery);
        return null;
    });
    assertNotNull(roleList);
    if (roleList.getSize() > 1) {
        fail("Query returned too many results!");
    }
    if (!roleList.isEmpty()) {
        roleFound = roleList.getFirstItem();
    }
    this.count = roleList.getSize();
}

[Buggy Hunk]
tmpQuery.setPredicate(new AttributePredicate<String>(RolePredicates.ROLE_NAME, name));

[Patch]
tmpQuery.setPredicate(new AttributePredicate<String>(RolePredicates.NAME, name));