[Demonstration 1]

[Buggy Method]
@PUT
@Consumes({ APPLICATION_XML, APPLICATION_JSON })
public Response createSsl(SslTermination ssl) {
    if (!ConfigurationHelper.isAllowed(restApiConfiguration, PublicApiServiceConfigurationKeys.ssl_termination))
        return ResponseFactory.getErrorResponse(new MethodNotAllowedException("Resource not implemented yet..."), null, null);
    ValidatorResult result = ValidatorRepository.getValidatorFor(SslTermination.class).validate(ssl, HttpRequestType.PUT);
    if (!result.passedValidation()) {
        return getValidationFaultResponse(result);
    }
    try {
        ZeusSslTermination zeusSslTermination = sslTerminationService.updateSslTermination(loadBalancerId, accountId, ssl);
        MessageDataContainer dataContainer = new MessageDataContainer();
        dataContainer.setAccountId(accountId);
        dataContainer.setLoadBalancerId(loadBalancerId);
        dataContainer.setUserName(getUserName(requestHeaders));
        dataContainer.setZeusSslTermination(zeusSslTermination);
        SslTermination returnTermination = dozerMapper.map(zeusSslTermination.getSslTermination(), SslTermination.class);
        asyncService.callAsyncLoadBalancingOperation(Operation.UPDATE_SSL_TERMINATION, dataContainer);
        return Response.status(Response.Status.ACCEPTED).build();
    } catch (Exception e) {
        return ResponseFactory.getErrorResponse(e, null, null);
    }
}

[Buggy Hunk]
return Response.status(Response.Status.ACCEPTED).build();

[Patch]
return Response.status(Response.Status.ACCEPTED).entity(returnTermination).build();

[Demonstration 2]

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

[Demonstration 3]

[Buggy Method]
public static Path backupCoalesced(Path me3InstallPath, String newName) {
    Path coalescedPath = me3InstallPath.resolve(Constants.COALESCED_DIRECTORY);
    if (Files.exists(coalescedPath)) {
        try {
            if (Files.notExists(Constants.BACKUP_DIRECTORY_BIN)) {
                Files.createDirectories(Constants.BACKUP_DIRECTORY_BIN);
            }
            Files.copy(coalescedPath, Constants.BACKUP_DIRECTORY_BIN.resolve(newName));
            LOG.log(Level.INFO, "Copied Coalesced.bin from {0} to backup directory {1}", new Object[] { coalescedPath.toString(), Constants.BACKUP_DIRECTORY_BIN.toString() });
            return Constants.BACKUP_DIRECTORY_BIN.resolve(newName);
        } catch (IOException ex) {
            LOG.log(Level.SEVERE, "Couldn't copy Coalesced.bin from " + coalescedPath.toString() + " to backup directory " + Constants.BACKUP_DIRECTORY_BIN.toString(), ex);
        }
    }
    return null;
}

[Buggy Hunk]
Files.copy(coalescedPath, Constants.BACKUP_DIRECTORY_BIN.resolve(newName));

[Patch]
Files.copy(coalescedPath, Constants.BACKUP_DIRECTORY_BIN.resolve(newName), StandardCopyOption.REPLACE_EXISTING);