[Demonstration 1]

[Buggy Method]
public void handleClick(JPanel panel) {
    panel.addMouseListener(new MouseAdapter() {

        @Override
        public void mouseClicked(MouseEvent me) {
            if (me.getButton() == MouseEvent.BUTTON3) {
                int x = me.getComponent().getLocation().x;
                int y = me.getComponent().getLocation().y;
                me.translatePoint(x, y);
                String panelClass = panel.getClass().toString();
                switch(panelClass) {
                    case "class Circle":
                        JPanel circle = new Circle(randomColor(), randomColor());
                        circle.setBounds(x, y, XDIM, YDIM);
                        remove(panel);
                        add(circle);
                        repaint();
                        handleDrag(circle);
                        handleClick(circle);
                        break;
                    case "class Square":
                        JPanel square = new Square(randomColor(), randomColor());
                        square.setBounds(x, y, XDIM, YDIM);
                        remove(panel);
                        add(square);
                        repaint();
                        handleDrag(square);
                        handleClick(square);
                        break;
                    case "class Triangle":
                        JPanel triangle = new Triangle(randomColor(), randomColor());
                        triangle.setBounds(x, y, XDIM, YDIM);
                        remove(panel);
                        add(triangle);
                        repaint();
                        handleDrag(triangle);
                        handleClick(triangle);
                        break;
                }
            } else if (me.getClickCount() == 2 && me.getButton() == MouseEvent.BUTTON1) {
                remove(panel);
                repaint();
            }
        }
    });
}

[Buggy Hunk]
public void handleClick(JPanel panel) {

[Patch]
public void handleClick(final JPanel panel) {

[Demonstration 2]

[Buggy Method]
public static Result service(String ownerName, String projectName, String service, boolean isAdvertise) throws IOException, UnsupportedOperationException, ServletException {
    if (!isSupportedService(service)) {
        return forbidden(String.format("Unsupported service: '%s'", service));
    }
    Project project = Project.findByOwnerAndProjectName(ownerName, projectName);
    if (project == null) {
        return notFound();
    }
    models.User user = UserApp.currentUser();
    if (!isAllowed(project, service)) {
        if (user.isAnonymous()) {
            return BasicAuthAction.unauthorized(response());
        } else {
            // If you want the Git client showing your custom message to
            // the user, the Content-Type should be exact "text/plain"
            // without any parameter. For more details, see the code at
            // https://github.com/git/git/commit/426e70d4a11ce3b4f70636d57c6a0ab16ae08a00#diff-eea0ad565ec5903a11b6023755d491cfR154
            response().setHeader("Content-Type", "text/plain");
            return forbidden(String.format("'%s' has no permission to '%s/%s'.", user.name, ownerName, projectName));
        }
    }
    if (isAdvertise) {
        return ok(RepositoryService.gitAdvertise(project, service, response()));
    } else {
        if (request().body().isMaxSizeExceeded()) {
            return status(REQUEST_ENTITY_TOO_LARGE);
        } else {
            user.visits(project);
            return ok(RepositoryService.gitRpc(project, service, request(), response()));
        }
    }
}

[Buggy Hunk]
user.name, ownerName, projectName));

[Patch]
user.loginId, ownerName, projectName));

[Demonstration 3]

[Buggy Method]
protected void constructGUI() {
    logArea = new TimedLogArea();
    logArea.setEditable(false);
    logArea.setLineWrap(true);
    logArea.setWrapStyleWord(true);
    JScrollPane logScrollPane = new JScrollPane(logArea, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    logScrollPane.setPreferredSize(new Dimension(300, 300));
    JPanel logPanel = new JPanel();
    logPanel.setLayout(new BorderLayout());
    logPanel.add(logScrollPane);
    JButton stopBtn = new JButton("Stop");
    stopBtn.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int status = 0;
            try {
                stopServer();
            } catch (GameError ex) {
                status = 1;
                logError(ex.getMessage());
            } finally {
                System.exit(status);
            }
        }
    });
    JPanel contentPanel = new JPanel();
    contentPanel.setLayout(new BorderLayout(5, 5));
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPanel.add(logPanel, BorderLayout.CENTER);
    contentPanel.add(stopBtn, BorderLayout.PAGE_END);
    contentPanel.setOpaque(true);
    JFrame window = new JFrame("Game Server");
    window.setContentPane(contentPanel);
    window.setPreferredSize(new Dimension(600, 300));
    window.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    window.pack();
    window.setVisible(true);
}

[Buggy Hunk]
JFrame window = new JFrame("Game Server");

[Patch]
JFrame window = new JFrame("Board Games Server: " + gameFactory.gameRules().gameDesc());