[Demonstration 1]

[Buggy Method]
protected String buildProductQuery(List<String> clauseList, String orderby) {
    // Join all the clauses into a WHERE clause
    StringBuilder whereClause = new StringBuilder();
    String and = " AND ";
    boolean first = true;
    for (String clause : clauseList) {
        if (!first) {
            whereClause.append(and);
        } else {
            first = false;
        }
        whereClause.append(clause);
    }
    String query_prefix = String.format("SELECT * FROM %s p", SUMMARY_TABLE);
    String query_suffix = "";
    if (!whereClause.toString().equals("")) {
        query_suffix = String.format(" WHERE %s", whereClause.toString());
    }
    String query_text = query_prefix + query_suffix + " " + orderby;
    return query_text;
}

[Buggy Hunk]
if (!whereClause.toString().equals("")) {

[Patch]
if (whereClause.length() > 0) {

[Demonstration 2]

[Buggy Method]
ResourceReference loadResource(String path) {
    ResourceReference resource = resources.get(path);
    if (resource == null) {
        return null;
    }
    if (resource.getBinary() != null) {
        return resource;
    }
    String extension = "";
    int pos = path.lastIndexOf('.');
    if (pos > 0) {
        extension = path.substring(pos + 1).toLowerCase();
    }
    synchronized (resource) {
        try {
            resource.setBinary(resource.getModule().getResourceAsBytes(path));
        } catch (IOException e) {
            LoggingHelper.getLogger(getClass()).log(Level.SEVERE, null, e);
        }
        if (resource.getBinary() != null) {
            if ("js".equals(extension) || "html".equals(extension) || "css".equals(extension)) {
                String body = StringHelper.binaryToString(resource.getBinary());
                if (body.contains("[[")) {
                    Template template = compiler.compile(body);
                    resource.setTemplate(template);
                }
            }
        }
    }
    return resource;
}

[Buggy Hunk]
if ("js".equals(extension) || "html".equals(extension) || "css".equals(extension)) {

[Patch]
if ("html".equals(extension)) {

[Demonstration 3]

[Buggy Method]
@Override
protected Image updateImpl() throws Exception {
    Image input = getInput(0);
    Validate.notNull(input);
    if (extension == null || DataUtils.allZero(extension)) {
        return input;
    }
    //Compute the extension used (based on dimensionality)
    IntBuffer extensionUsed = IntBuffer.allocate(input.dimensionality);
    extension.limit(input.dimensionality);
    extension.rewind();
    extensionUsed.put(extension);
    while (extensionUsed.hasRemaining()) {
        extensionUsed.put(0);
    }
    extension.limit(extension.capacity());
    ImmutablePair<Image, ByteBuffer> pair = constructOutput(input, extensionUsed);
    Image output = pair.left;
    ByteBuffer buffer = pair.right;
    setZeros(input, output, buffer, extensionUsed);
    setValues(input, output, buffer, extensionUsed);
    return output;
}

[Buggy Hunk]
extension.limit(input.dimensionality);

[Patch]
extension.limit(Math.min(input.dimensionality, extension.capacity()));