[Demonstration 1]

[Buggy Method]
public WebElement moveToElement(WebElement element, final int seconds) {
    return actionWithRetry(seconds, new WebElementAction() {

        public WebElement run(int seconds) {
            LOGGER.debug("moveToElement: moving  to: " + element);
            actions().moveToElement(element);
            return element;
        }
    });
}

[Buggy Hunk]
public WebElement moveToElement( WebElement element, final int seconds ) {

[Patch]
public WebElement moveToElement( final WebElement element, final int seconds ) {

[Demonstration 2]

[Buggy Method]
@Override
public WebElement locateElement() {
    log.debug(String.format("WebDriver: locating element: '%s', index '%s', parent '%s'", by, index, parentElement));
    if (log.isDebugEnabled()) {
        if (DriverManager.INSTANCE.isAlertPresent()) {
            log.debug("GOT UNEXPECTED ALERT");
        }
        Screenshot.takeScreenshot("locateElement");
    }
    if (isWithinIFrame()) {
        ((BaseElement) iframeElement).switchFocusToIFrame();
    } else {
        switchFocusFromIFrame();
    }
    Element currentHoverElement = Optional.ofNullable(collapsedHoverElement).orElse(hoverElement);
    if (currentHoverElement != null && currentHoverElement.isDisplayed())
        currentHoverElement.hover();
    // cache element
    if (webElement != null) {
        try {
            webElement.isDisplayed();
            return webElement;
        } catch (StaleElementReferenceException e) {
            // page has updated so re-fetch the element
        } catch (WebDriverException e) {
            // browser instance has been reloaded so re-fetch the element
        }
    }
    By currentBy = Optional.ofNullable(collapsedXpathBy).orElse(by);
    Element parent = Optional.ofNullable(collapsedParent).orElse(parentElement);
    if (parent != null) {
        By parentBy = getByForParentElement(currentBy);
        if (index >= 0) {
            List<WebElement> elements = parent.locateElement().findElements(parentBy);
            if (index > elements.size() - 1) {
                throw new NoSuchElementException(String.format("Unable to locate an element at index: %s using %s", index, getBy()));
            }
            webElement = elements.get(index);
        } else {
            webElement = parent.locateElement().findElement(parentBy);
        }
    } else {
        if (index >= 0) {
            List<WebElement> elements = DriverManager.INSTANCE.getDriver().findElements(currentBy);
            if (index > elements.size() - 1) {
                throw new NoSuchElementException(String.format("Unable to locate an element at index: %s using %s", index, getBy()));
            }
            webElement = elements.get(index);
        } else {
            webElement = DriverManager.INSTANCE.getDriver().findElement(currentBy);
        }
    }
    if (scrollIntoView) {
        scrollElement(webElement);
    }
    log.debug("WebDriver: Found element: " + webElement);
    return webElement;
}

[Buggy Hunk]
Element parent = Optional.ofNullable(collapsedParent).orElse(parentElement);

[Patch]
Element parent = collapsedXpathBy == null ? parentElement : collapsedParent;

[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));