[Demonstration 1]

[Buggy Method]
private Question saveQuestion() {
    if (saveQuizz() == null)
        return null;
    if (!cbOpenQuest.isSelected() && !cbMultiQuest.isSelected()) {
        Notifier.notifyWarning("Champ vide !", "Veuillez renseigner le type de la question.");
        return null;
    }
    if (questChecker.run())
        return null;
    Question q = tableQuestionsList.getSelectionModel().getSelectedItem();
    if (q == null)
        q = new Question();
    if (Integer.valueOf(tfQuestLibelle.getId()) > 0)
        q.setId(Integer.valueOf(tfQuestLibelle.getId()));
    q.setIdUtilisateur(mainApp.getUser().getId());
    q.setLibelle(tfQuestLibelle.getText());
    q.setType(cbOpenQuest.isSelected());
    if (q.getId() > 0) {
        //Update
        q = (Question) updateObject(q, q.getId());
        if (q != null)
            showQuizzQuestions(q);
    } else {
        //Add
        q = (Question) addObject(q);
        if (q != null)
            quizz.getQuestions().add(q);
    }
    if (q == null)
        return null;
    affectQuestToQuizz(q);
    //IF Open Question, auto save answer
    if (q.isType()) {
        if (!uniqueAnsChecker.run())
            return null;
        Reponse rep = new Reponse();
        rep.setIdQuestion(q.getId());
        rep.setGood(true);
        // Makes some weird things....
        rep.setLibelle(tfUniqueAns.getText());
        rep.setId(Integer.valueOf(tfUniqueAns.getId()));
        if (rep.getId() > 0) {
            //Update
            rep = (Reponse) updateObject(rep, rep.getId());
        } else {
            //Add
            rep = (Reponse) addObject(rep);
            if (rep != null) {
                q.getReponses().add(rep);
            }
        }
    }
    showQuizzQuestions(q);
    return q;
}

[Buggy Hunk]
if(questChecker.run()) return null;

[Patch]
if(!questChecker.run()) return null;

[Demonstration 2]

[Buggy Method]
public static byte[] getByteArrayFromInputStream(InputStream in, int bufferSize) {
    ByteArrayOutputStream baos = new ByteArrayOutputStream() {

        @Override
        public byte[] toByteArray() {
            return this.buf;
        }
    };
    try {
        LocalServer.copyIO(in, baos, bufferSize);
    } catch (Exception ex) {
        throw new RuntimeException(ex);
    }
    return baos.toByteArray();
}

[Buggy Hunk]
ByteArrayOutputStream baos = new ByteArrayOutputStream() { @Override public byte[] toByteArray() { return this.buf; } };

[Patch]
ByteArrayOutputStream baos = new ByteArrayOutputStream();

[Demonstration 3]

[Buggy Method]
@Override
public Attribute extend(Link link, Attribute attribute) {
    if (attribute.isInvalid()) {
        return invalid();
    } else {
        ShortestPathAttribute shortestPathAttribute = (ShortestPathAttribute) attribute;
        return new ShortestPathAttribute(length + shortestPathAttribute.length);
    }
}

[Buggy Hunk]
return new ShortestPathAttribute(length + shortestPathAttribute.length);

[Patch]
return new ShortestPathAttribute(length + shortestPathAttribute.getLength());