[Demonstration 1]

[Buggy Method]
@Transactional(readOnly = false, propagation = Propagation.REQUIRED)
private int testFromQuestionList(List<Long> questionIdList, EntityPerson ePerson, String pass, String metaCategories, String categories1, String complexityLevel, String nQuestions) {
    int result = -1;
    int numberQuestions = Integer.parseInt(nQuestions);
    int listSize;
    if (questionIdList == null) {
        listSize = 0;
        questionIdList = new ArrayList<Long>();
    } else
        listSize = questionIdList.size();
    if (listSize < numberQuestions) {
        List<Long> autoQuestions = this.createSetQuestions(metaCategories, categories1, complexityLevel, (numberQuestions - listSize));
        if (autoQuestions == null) {
            return 1;
        } else
            result = 0;
        questionIdList.addAll(autoQuestions);
    }
    if (!this.createTest(questionIdList, ePerson, pass) && result != 1)
        result = 1;
    return result;
}

[Buggy Hunk]
List<Long> autoQuestions = this.createSetQuestions(metaCategories, categories1, complexityLevel, (numberQuestions - listSize));

[Patch]
List<Long> autoQuestions = this.createSetQuestions(metaCategories, categories1, complexityLevel, (numberQuestions - listSize), questionIdList);

[Demonstration 2]

[Buggy Method]
public void connect() throws Exception {
    String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory";
    Properties pop3Props = new Properties();
    pop3Props.setProperty("mail.pop3.socketFactory.class", SSL_FACTORY);
    pop3Props.setProperty("mail.pop3.socketFactory.fallback", "false");
    pop3Props.setProperty("mail.pop3.port", "995");
    pop3Props.setProperty("mail.pop3.socketFactory.port", "995");
    URLName url = new URLName("pop3", "pop.gmail.com", 995, "", username, password);
    Session session = Session.getInstance(pop3Props, null);
    store = new POP3SSLStore(session, url);
    store.connect();
}

[Buggy Hunk]
public void connect() throws Exception {

[Patch]
private void connect() throws MessagingException {

[Demonstration 3]

[Buggy Method]
public TextData get(String alias, String type) {
    checkType(type);
    DBObject pageObject = db.getCollection(type).findOne(aliasOrId(alias));
    if (pageObject == null) {
        throw new NotFoundException("No such object");
    }
    TextData page = mapper.map(pageObject, TextData.class);
    page.setFormatted(textConverter.format(page.getFormat(), page.getContent()));
    return page;
}

[Buggy Hunk]
page.setFormatted(textConverter.format(page.getFormat(), page.getContent()));

[Patch]
page.setFormatted(renderText(page.getId(), page.getFormat(), page.getContent()));