[Demonstration 1]

[Buggy Method]
private TreeNode<K, V> findLeftMostNodeForRemoveOperation(TreeNode<K, V> node) throws Exception {
    if (node.items.size() == 1) {
        node = FixOneKeyNode(node);
    }
    TreeNode<K, V> leftNode = node.getLeftChildNodeForItem(0);
    if (leftNode != null) {
        return findLeftMostNodeForRemoveOperation(leftNode);
    } else {
        return node;
    }
}

[Buggy Hunk]
node = FixOneKeyNode(node);

[Patch]
node = FixOneKeyNode(node, false);

[Demonstration 2]

[Buggy Method]
public int checkAPICallAllowed(String json, HttpServletRequest request) throws Exception {
    int result = 0;
    if (request != null) {
        Enumeration<String> headers = request.getHeaders(ApiClient.APICALLKEY);
        String uuid = null;
        if (headers.hasMoreElements()) {
            uuid = headers.nextElement();
            if (ApiClient.isAllowedDebugWindowCall(uuid)) {
                return result;
            }
        }
    }
    if (Settings.getInstance().isGuiEnabled() || Settings.getInstance().isSysTrayEnabled()) {
        Gui gui = Gui.getInstance();
        SysTray.getInstance().sendMessage("INCOMING API CALL", "An API call needs authorization!", MessageType.WARNING);
        Object[] options = { "Yes", "No" };
        StringBuilder sb = new StringBuilder("Permission Request: ");
        sb.append("Do you want to authorize the following API call?\n\n" + json);
        JTextArea jta = new JTextArea(sb.toString());
        jta.setLineWrap(true);
        jta.setEditable(false);
        JScrollPane jsp = new JScrollPane(jta) {

            /**
             */
            private static final long serialVersionUID = 1L;

            @Override
            public Dimension getPreferredSize() {
                return new Dimension(480, 200);
            }
        };
        result = JOptionPane.showOptionDialog(gui, jsp, "INCOMING API CALL", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[1]);
        gui.bringtoFront();
    }
    return result;
}

[Buggy Hunk]
if (Settings.getInstance().isGuiEnabled() || Settings.getInstance().isSysTrayEnabled() ) {

[Patch]
if (!GraphicsEnvironment.isHeadless() &&  (Settings.getInstance().isGuiEnabled() || Settings.getInstance().isSysTrayEnabled()) ) {

[Demonstration 3]

[Buggy Method]
@Override
public String toStringTree() {
    StringBuilder builder = new StringBuilder();
    ASTBuilder node = this;
    List<ASTBuilder> printStack = new ArrayList<>();
    printStack.add(node);
    List<List<ASTBuilder>> childListStack = new ArrayList<>();
    childListStack.add(printStack);
    while (!childListStack.isEmpty()) {
        List<ASTBuilder> childStack = childListStack.get(childListStack.size() - 1);
        if (childStack.isEmpty()) {
            childListStack.remove(childListStack.size() - 1);
        } else {
            node = childStack.remove(0);
            String nodeText;
            if (node.payload instanceof Token) {
                Token token = (Token) node.payload;
                String type = vocabulary.getSymbolicName(token.getType());
                String text = token.getText();
                int pos = token.getCharPositionInLine();
                if (Objects.equals(type, "Id") || Objects.equals(type, "Float")) {
                    nodeText = String.format("%s[%s, %d, %d, %d]", type, text, token.getLine(), pos, pos + text.length() - 1);
                } else {
                    nodeText = String.format("%s[%d, %d, %d]", type, token.getLine(), pos, pos + text.length() - 1);
                }
            } else {
                nodeText = String.valueOf(node.payload);
            }
            StringBuilder indent = new StringBuilder();
            for (int i = 0; i < childListStack.size() - 1; i++) {
                indent.append((childListStack.get(i).size() > 0) ? "│  " : "   ");
            }
            builder.append(indent).append(childStack.isEmpty() ? "└── " : "├── ").append(nodeText).append("\n");
            if (node.children.size() > 0) {
                List<ASTBuilder> children = new ArrayList<>();
                children.addAll(node.children);
                childListStack.add(children);
            }
        }
    }
    return builder.toString();
}

[Buggy Hunk]
if (Objects.equals(type, "Id") || Objects.equals(type, "Float")) {

[Patch]
if (Objects.equals(type, "Id") || Objects.equals(type, "Float") || Objects.equals(type, "Boolean")) {