[Demonstration 1]

[Buggy Method]
@Override
public void createLink(LinkRepresentation link, ApplicationUser user) {
    final ActiveObjects ao = ComponentGetter.getAo();
    ao.executeInTransaction(new TransactionCallback<Void>() {

        @Override
        public Void doInTransaction() {
            boolean linkAlreadyExists = false;
            for (LinkEntity linkEntity : ao.find(LinkEntity.class)) {
                if (linkEntity.getIngoingId() == link.getIngoingId() && linkEntity.getOutgoingId() == link.getOutgoingId()) {
                    linkAlreadyExists = true;
                }
            }
            if (!linkAlreadyExists) {
                link.getOutgoingId();
                DecisionComponentEntity decCompIngoing;
                DecisionComponentEntity[] decCompIngoingArray = ao.find(DecisionComponentEntity.class, Query.select().where("ID = ?", link.getIngoingId()));
                /*
                	 * ID is the primarykey for decisioncomponents, therefore find can only return 0 to 1 entities
                	 */
                if (decCompIngoingArray.length == 1) {
                    decCompIngoing = decCompIngoingArray[0];
                } else {
                    //entity with ingoingId does not exist
                    decCompIngoing = null;
                }
                DecisionComponentEntity decCompOutgoing;
                DecisionComponentEntity[] decCompOutgoingArray = ao.find(DecisionComponentEntity.class, Query.select().where("ID = ?", link.getOutgoingId()));
                if (decCompIngoingArray.length == 1) {
                    decCompOutgoing = decCompOutgoingArray[0];
                } else {
                    //entity with ingoingId does not exist
                    decCompOutgoing = null;
                }
                if (decCompIngoing != null && decCompOutgoing != null) {
                    if (decCompIngoing.getProjectKey().equals(decCompOutgoing.getProjectKey())) {
                        // entities exist and are in the same project
                        final LinkEntity linkEntity = ao.create(LinkEntity.class);
                        linkEntity.setIngoingId(link.getIngoingId());
                        linkEntity.setOutgoingId(link.getOutgoingId());
                        linkEntity.setType(link.getLinkType());
                        linkEntity.save();
                    } else {
                        // entities to be linked are not in the same project, TODO ignore request
                    }
                } else {
                    // one of the entities to be linked does not exist, TODO ignore request
                }
            }
            return null;
        }
    });
}

[Buggy Hunk]
public void createLink(LinkRepresentation link, ApplicationUser user) {

[Patch]
public void createLink(final LinkRepresentation link, ApplicationUser user) {

[Demonstration 2]

[Buggy Method]
@Override
public String toString() {
    try {
        String text = this.text;
        if (text == null) {
            text = decodeContent();
        }
        if (text != null) {
            text = MarshallingSupport.truncate64(text);
            HashMap<String, Object> overrideFields = new HashMap<String, Object>();
            overrideFields.put("text", text);
            return super.toString(overrideFields);
        }
    } catch (JMSException e) {
    }
    return super.toString();
}

[Buggy Hunk]
text = decodeContent();

[Patch]
text = decodeContent(getContent());

[Demonstration 3]

[Buggy Method]
public static List<List<DNode>> generateAnswerCandidates(String ques, String text) {
    Graph graphT = Graph.stringToGraph(text);
    Graph graphQ = Graph.stringToGraph(ques);
    return generateAnswerCandidates(ques, text, graphQ, graphT);
}

[Buggy Hunk]
public static List<List<DNode>> generateAnswerCandidates(String ques, String text) {

[Patch]
public static List<TreeMap<Integer, DNode>> generateAnswerCandidates(String ques, String text) {