[Demonstration 1]

[Buggy Method]
public static void main(String[] args) throws QuoteRuleException {
    String r = "'^(boot(\\\\.\\\\d+)?$|kernel\\\\.)'";
    System.out.println(r);
    System.out.println(getUnescapedPythonPattern(r));
}

[Buggy Hunk]
System.out.println(getUnescapedPythonPattern(r));

[Patch]
System.out.println(getUnquotedPythonPattern(r));

[Demonstration 2]

[Buggy Method]
public void stop() {
    if (this.getStatus() != Status.CLOSE && this.getStatus() != Status.STOP) {
        this.closeDoor();
    }
    this.setStatus(Status.STOP);
    if (this.capacity != 0)
        throw new RuntimeException(String.format("%s stopped, but capacity is not empty, current capacity is:%d", this.name, this.capacity));
}

[Buggy Hunk]
if (this.getStatus() != Status.CLOSE && this.getStatus() != Status.STOP) {

[Patch]
if (this.doorOpened) {

[Demonstration 3]

[Buggy Method]
public String handleForAnswer(int userId, int examId, String content) {
    Examination examination = examinationDao.getById(examId);
    if (examination == null) {
        return "题目不存在或已被删除，请联系老师";
    }
    Answer answer = answerService.createOrGet(examId, userId);
    if (!answer.isClosed() && answer.getAnswerCount() <= 2) {
        answer.setContent(content);
        answer.setAnswerCount(answer.getAnswerCount() + 1);
        answerDao.save(answer);
        if (examination.getType() == EcConsts.Exam.TYPE_ANSWER_UNIQUE) {
            // 客观题
            if (content.equalsIgnoreCase(examination.getAnswer()))
                return closeAnswer(answer, true);
            else {
                if (answer.getAnswerCount() >= 3)
                    closeAnswer(answer, false);
                contextHelper.put(userId, "ANSWER_" + examId);
                return "回答错误，你还有" + (3 - answer.getAnswerCount()) + "次回答机会";
            }
        } else {
            // 主观题
            if (answer.getAnswerCount() >= 3)
                return "回答错误，问题修改次数已耗尽";
            contextHelper.put(userId, "ANSWER_" + examId);
            return "回答已提交，等待教师审核。\n你还有" + (3 - answer.getAnswerCount()) + "次回答机会";
        }
    }
    return "问题已关闭";
}

[Buggy Hunk]
Answer answer = answerService.createOrGet(examId, userId);

[Patch]
Answer answer = answerService.createOrGet(examId, userId, 0);