[Demonstration 1]

[Buggy Method]
private static String escapeName(String name, boolean escapeAll) {
    if (escapeAll)
        return "\"" + name + "\"";
    SB sb = null;
    for (int i = 0; i < name.length(); i++) {
        char ch = name.charAt(i);
        if (!Character.isLetter(ch) && !Character.isDigit(ch) && ch != '_' && !(ch == '"' && (i == 0 || i == name.length() - 1)) && ch != '-') {
            // Class name can also contain '$' or '.' - these should be escaped.
            assert ch == '$' || ch == '.';
            if (sb == null)
                sb = new SB();
            sb.a(name.substring(sb.length(), i));
            // Replace illegal chars with '_'.
            sb.a('_');
        }
    }
    if (sb == null)
        return name;
    sb.a(name.substring(sb.length(), name.length()));
    return sb.toString();
}

[Buggy Hunk]
return "\"" + name + "\"";

[Patch]
return name == null ? "" + ESC_CH + ESC_CH : ESC_CH + name + ESC_CH;

[Demonstration 2]

[Buggy Method]
public Response.ResponseBuilder createResponse(String appName, String uri, HttpRequest request) {
    Path resource = resolveUri(appName, uri);
    if (Files.exists(resource) && Files.isRegularFile(resource)) {
        return getResponseBuilder(resource, request);
    } else {
        return Response.status(Response.Status.NOT_FOUND).entity("Requested resource '" + uri + "' does not exists at '" + resource + "'");
    }
}

[Buggy Hunk]
"Requested resource '" + uri + "' does not exists at '" + resource + "'");

[Patch]
"Requested resource '" + uri + "' does not exists at '/" + uufHome.relativize(resource) + "'");

[Demonstration 3]

[Buggy Method]
private String getReferencedVarType(ASTNode node, String refName, String varName) {
    String varType = null;
    //no reference
    if (refName == null) {
        varType = (String) varSymbolTable.peek(varName);
    } else if (refName.equals("this")) {
        varType = (String) varSymbolTable.peek(varName, 0);
    } else if (refName.equals("super")) {
        varType = (String) currClassTreeNode.getParent().getVarSymbolTable().peek(varName, 0);
    } else //any other references
    {
        errorHandler.register(2, fileName, node.getLineNum(), "Invalid reference: " + refName);
    }
    return varType;
}

[Buggy Hunk]
varType = (String)varSymbolTable.peek(varName);

[Patch]
varType = (String)varSymbolTable.lookup(varName);