[Demonstration 1]

[Buggy Method]
@ResponseStatus(HttpStatus.CREATED)
@RequestMapping(value = "/updateuser", method = RequestMethod.PUT)
@ResponseBody
public UserDTO updateUser(@Valid @RequestBody UserDTO user, @CookieValue("userid") int userid) {
    return userImpl.updateUser(user, userid);
}

[Buggy Hunk]
public UserDTO updateUser(@Valid @RequestBody UserDTO user, @CookieValue("userid") int userid) {

[Patch]
public ResponseEntity updateUser(@Valid @RequestBody UserDTO user, @CookieValue("userid") int userid) {

[Demonstration 2]

[Buggy Method]
@POST
@Produces(MediaType.APPLICATION_JSON)
@Path("addNewAllInOneDB")
public Status addNewAllInOneDB(@Context HttpServletRequest request, @FormParam("dbtype") String dbtype, @FormParam("allinonename") String allinonename, @FormParam("dbaddress") String dbaddress, @FormParam("dbport") String dbport, @FormParam("dbuser") String dbuser, @FormParam("dbpassword") String dbpassword, @FormParam("dbcatalog") String dbcatalog, @FormParam("addtogroup") boolean addToGroup, @FormParam("dalgroup") String groupId, @FormParam("gen_default_dbset") boolean isGenDefault) {
    Status status = Status.OK;
    DalGroupDBDao allDbDao = SpringBeanGetter.getDaoOfDalGroupDB();
    if (allDbDao.getGroupDBByDbName(allinonename) != null) {
        status = Status.ERROR;
        status.setInfo(allinonename + "已经存在!");
        return status;
    } else {
        DalGroupDB groupDb = new DalGroupDB();
        groupDb.setDbname(allinonename);
        groupDb.setDb_address(dbaddress);
        groupDb.setDb_port(dbport);
        groupDb.setDb_user(dbuser);
        groupDb.setDb_password(dbpassword);
        groupDb.setDb_catalog(dbcatalog);
        groupDb.setDb_providerName(DatabaseType.valueOf(dbtype).getValue());
        groupDb.setDal_group_id(-1);
        // add to current user's group
        if (addToGroup) {
            int gid = -1;
            if (groupId != null && !groupId.isEmpty()) {
                gid = Integer.parseInt(groupId);
                groupDb.setDal_group_id(gid);
            } else {
                LoginUser user = RequestUtil.getUserInfo(request);
                if (user != null) {
                    int userId = user.getId();
                    List<UserGroup> list = SpringBeanGetter.getDalUserGroupDao().getUserGroupByUserId(userId);
                    if (list != null && list.size() > 0) {
                        gid = list.get(0).getGroup_id();
                        groupDb.setDal_group_id(gid);
                    }
                }
            }
            // generate default databaseset
            if (isGenDefault) {
                status = DalGroupDbResource.genDefaultDbset(gid, allinonename);
            }
        }
        allDbDao.insertDalGroupDB(groupDb);
    }
    return Status.OK;
}

[Buggy Hunk]
status = DalGroupDbResource.genDefaultDbset(gid, allinonename);

[Patch]
status = DalGroupDbResource.genDefaultDbset(gid, allinonename, dbtype);

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