[Demonstration 1]

[Buggy Method]
@Override
public void serve(HttpResponse response) {
    response.setStatus(HttpResponse.STATUS_ACCESS_DENIED);
    response.setContentType("text/html");
    String errorDocumentPath = MainController.getInstance().getWebServer().getServerConfig().getErrorDocument403Path();
    if (errorDocumentPath == null || errorDocumentPath.equals("")) {
        HtmlErrorDocument doc = new HtmlErrorDocument();
        doc.setTitle("Error 403 - Forbidden");
        doc.setMessage("<p>Access Denied.</p>");
        response.setContentLength(doc.toString().length());
        ((HttpResponseWrapper) response).flushHeaders();
        response.getPrintWriter().print(doc.toString());
    } else {
        File file = new File(errorDocumentPath);
        if (file.exists()) {
            response.setContentLength(file.length());
            ((HttpResponseWrapper) response).flushHeaders();
            ((HttpResponseWrapper) response).serveFile(file);
        } else {
            // Serve 500
            HttpError500 error500 = new HttpError500();
            error500.setReason("403 error occurred, specified error handler (" + errorDocumentPath + ") was not found.");
            error500.serve(response);
        }
    }
}

[Buggy Hunk]
response.getPrintWriter().print(doc.toString());

[Patch]
((HttpResponseWrapper) response).write(doc.toString());

[Demonstration 2]

[Buggy Method]
public Collection<Namespace> getNamespaces(String networkUUID) {
    ArrayList<Namespace> namespaces = new ArrayList<>();
    ODocument networkDoc = getNetworkDocByUUIDString(networkUUID);
    for (ODocument doc : Helper.getNetworkElements(networkDoc, NdexClasses.Network_E_Namespace)) {
        Namespace n = getNamespace(doc, null);
        namespaces.add(n);
    }
    return namespaces;
}

[Buggy Hunk]
Namespace n = getNamespace(doc,null);

[Patch]
Namespace n = getNamespace(doc);

[Demonstration 3]

[Buggy Method]
public static HashMap<Integer, ItemStack> addItem(Player p, ItemStack is) {
    if (is == null)
        return new HashMap<>();
    Inventory pInv = p.getInventory();
    Inventory inv = Bukkit.createInventory(null, pInv.getSize());
    inv.setContents(pInv.getContents());
    HashMap<Integer, ItemStack> remaining = AutoPickupPlugin.giveItem(p, inv, is);
    if (!convertTo.containsKey(is.getType())) {
        pInv.setContents(inv.getContents());
        p.updateInventory();
        return remaining;
    }
    if (remaining.size() == 1 && remaining.values().toArray()[0].equals(is))
        return remaining;
    ItemStack[] newCont = block(p, inv.getContents(), is.getType());
    if (newCont != null)
        pInv.setContents(newCont);
    else
        pInv.setContents(inv.getContents());
    p.updateInventory();
    return remaining;
}

[Buggy Hunk]
Inventory inv = Bukkit.createInventory(null, pInv.getSize());

[Patch]
Inventory inv = Bukkit.createInventory(p, 9 * 4);