[Demonstration 1]

[Buggy Method]
@Override
public IResource generateProfile(RuntimeResourceDefinition theRuntimeResourceDefinition) {
    Profile retVal = new Profile();
    RuntimeResourceDefinition def = theRuntimeResourceDefinition;
    myId = def.getId();
    if (StringUtils.isBlank(myId)) {
        myId = theRuntimeResourceDefinition.getName().toLowerCase();
    }
    retVal.setId(new IdDt(myId));
    // Scan for extensions
    scanForExtensions(retVal, def);
    Collections.sort(retVal.getExtensionDefn(), new Comparator<ExtensionDefn>() {

        @Override
        public int compare(ExtensionDefn theO1, ExtensionDefn theO2) {
            return theO1.getCode().compareTo(theO2.getCode());
        }
    });
    // Scan for children
    retVal.setName(def.getName());
    Structure struct = retVal.addStructure();
    LinkedList<String> path = new LinkedList<String>();
    StructureElement element = struct.addElement();
    element.getDefinition().setMin(1);
    element.getDefinition().setMax("1");
    fillProfile(struct, element, def, path, null);
    retVal.getStructure().get(0).getElement().get(0).getDefinition().addType().getCode().setValue("Resource");
    return retVal;
}

[Buggy Hunk]
scanForExtensions(retVal, def);

[Patch]
scanForExtensions(retVal, def, new HashMap<RuntimeChildDeclaredExtensionDefinition, String>());

[Demonstration 2]

[Buggy Method]
public void draw(SpriteBatch batch, Texture texture) {
    for (int j = 0; j < scheme.length; j++) {
        for (int i = 0; i < scheme[0].length; i++) {
            if (scheme[j][i] == 1)
                batch.draw(texture, (x + i) * BLOCK_SIZE, (29 - (y + j)) * BLOCK_SIZE);
        }
    }
}

[Buggy Hunk]
batch.draw(texture, (x + i) * BLOCK_SIZE, (29 - (y + j)) * BLOCK_SIZE);

[Patch]
batch.draw(texture, Tetris.xOffset + (x + i) * BLOCK_SIZE, Tetris.yOffset + (27 - (y + j)) * BLOCK_SIZE);

[Demonstration 3]

[Buggy Method]
private void inspect(ChannelHandlerContext ctx, String msg) {
    if (isNotEmpty(userName) && sessionId != null)
        return;
    JsonNode node;
    try {
        node = mapper.readTree(msg);
    } catch (IOException e) {
        log.error("Unexpected exception processing message {} on {}", msg, ctx.channel(), e);
        return;
    }
    if (hasValue(node, USER_NAME)) {
        userName = node.get(USER_NAME).asText();
        registry.put(msg, ctx.channel());
    }
    if (hasValue(node, SESSION_ID)) {
        sessionId = node.get(SESSION_ID).asLong();
        registry.put(sessionId, ctx.channel());
    }
}

[Buggy Hunk]
registry.put(msg, ctx.channel());

[Patch]
registry.put(userName, ctx.channel());