[Demonstration 1]

[Buggy Method]
@RequestMapping(value = "/studies/{studyId}/notes", method = RequestMethod.POST, params = { "addNote" })
public String addNoteToTable(Model model, @PathVariable Long studyId, HttpServletRequest request) {
    //get the study
    Study study = studyRepository.findOne(studyId);
    model.addAttribute("study", study);
    if (study.getHousekeeping().getIsPublished()) {
        return "redirect:/studies/" + studyId + "/notes";
    }
    //the newly added note can only be assigned one of the availlable subject, not including system note subjects.
    Collection<NoteSubject> noteSubjects = noteSubjectService.findUsableNoteSubject();
    model.addAttribute("availableNoteSubject", noteSubjects);
    // an form object mapped from the studyNote object, it contains a list of notes
    MultiStudyNoteForm msnf = studyNoteOperationsService.generateMultiStudyNoteForm(study.getNotes(), study);
    SecureUser user = currentUserDetailsService.getUserFromRequest(request);
    //create a default study note with default setting
    StudyNote emptyNote = studyNoteOperationsService.createGeneralNote(study, user);
    StudyNoteForm emptyNoteForm = studyNoteOperationsService.convertToStudyNoteForm(emptyNote);
    //attach the empty form
    msnf.getNomalNoteForms().add(emptyNoteForm);
    //Index of value to add
    final Integer rowId = msnf.getNomalNoteForms().size() - 1;
    //enable the edit for the new note and disable all edit for other notes
    msnf.startEdit(rowId);
    //reload system notes because they are not part of the input
    msnf.setSystemNoteForms(studyNoteOperationsService.generateSystemNoteForms(study.getNotes()));
    model.addAttribute("multiStudyNoteForm", msnf);
    return "study_notes";
}

[Buggy Hunk]
Collection<NoteSubject> noteSubjects = noteSubjectService.findUsableNoteSubject();

[Patch]
Collection<NoteSubject> noteSubjects = noteSubjectService.findNonSystemNoteSubject();

[Demonstration 2]

[Buggy Method]
public void postStop() {
    LobbyController.removePlayer(this.out);
}

[Buggy Hunk]
LobbyController.removePlayer(this.out);

[Patch]
LobbyController.removePlayer(this.name);

[Demonstration 3]

[Buggy Method]
@RequestMapping
public SimpleResponse index(HttpServletRequest httpRequest) {
    IChannelService channelService = null;
    SimpleResponse sr = null;
    // 封装参数/检查参数是否符合通信协议
    SimpleRequest request = ChannelHelper.packageParameters(httpRequest);
    logger.debug(binder.toJson(request));
    // 判断终端用户是否有权限访问（判断是否登陆）
    // authorityHelper.isLogin(request.get_token_(), 2);
    try {
        // 注册/登陆/退出（？）不需要做权限校验
        if (!"REGIST_ENDUSER".equals(request.get_code_()) && !"LOGIN_ENDUSER".equals(request.get_code_()) && !"LOGOUT_ENDUSER".equals(request.get_code_())) {
            if (StringUtils.isBlank(request.get_token_()) || // 现在只支持终端用户
            !authorityHelper.isLogin(request.get_token_(), 2)) {
                return new SimpleResponse(Codes.FAILURE_FALSE_NUMBER, Messages.MUST_BE_LOGGED);
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
        // return new SimpleResponse(Codes.FAILURE_FALSE_NUMBER, e.getMessage());
        return new SimpleResponse(Codes.FAILURE_FALSE_NUMBER, Messages.MUST_BE_LOGGED);
    }
    // 根据_code_来获取服务类
    logger.debug(request.get_code_());
    channelService = ChannelHelper.localizingResources(request.get_code_());
    // 服务处理
    try {
        sr = channelService.doService(request);
    } catch (Exception e) {
        e.printStackTrace();
        // sr = new SimpleResponse(Codes.FAILURE_FALSE_NUMBER, e.getMessage());
        sr = new SimpleResponse(Codes.FAILURE_FALSE_NUMBER, Messages.SYSTEM_BUSY);
    }
    return sr;
}

[Buggy Hunk]
channelService = ChannelHelper.localizingResources(request.get_code_());

[Patch]
channelService = ChannelHelper.localizingDataService();