[Demonstration 1]

[Buggy Method]
public static void main(String[] args) {
    EventQueue.invokeLater(new Runnable() {

        public void run() {
            try {
                try {
                    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                        if ("Nimbus".equals(info.getName())) {
                            UIManager.setLookAndFeel(info.getClassName());
                            break;
                        }
                    }
                } catch (UnsupportedLookAndFeelException e) {
                    // handle exception
                } catch (ClassNotFoundException e) {
                    // handle exception
                } catch (InstantiationException e) {
                    // handle exception
                } catch (IllegalAccessException e) {
                    // handle exception
                }
                URL update = new URL("https://dl.dropboxusercontent.com/u/82755681/PoEQueue/update.txt");
                Scanner sUpdate = new Scanner(update.openStream());
                String checkUpdate = sUpdate.next();
                StringTokenizer st = new StringTokenizer(checkUpdate, "|");
                String tempversion = st.nextToken();
                System.out.println("Server version " + tempversion);
                String tempurl = st.nextToken();
                System.out.println("Server URL " + tempurl);
                if (!(tempversion.equals(version))) {
                    UpdateWindow.createWindow(tempurl, tempversion);
                }
                conn = (Connection) DriverManager.getConnection(LoginInfo.url, LoginInfo.username, LoginInfo.password);
                Statement stmt = (Statement) conn.createStatement();
                rs = stmt.executeQuery("SELECT type, title, date, count, league, leader FROM groups");
                File f1 = new File("./data.txt");
                if (f1.exists() && !f1.isDirectory()) {
                    String content = new String(Files.readAllBytes(Paths.get("./data.txt")));
                    username = content;
                }
                Runtime.getRuntime().addShutdownHook(new Thread() {

                    @Override
                    public void run() {
                        System.out.println("Quitting Application");
                        if (isLeader == true) {
                            String query = "DELETE FROM groups WHERE leader = '" + sessionID + ":" + username + "'";
                            try {
                                PreparedStatement st = (PreparedStatement) conn.prepareStatement(query);
                                st.execute();
                            } catch (SQLException e) {
                                e.printStackTrace();
                            }
                            isLeader = false;
                        } else if (isLeader == false) {
                            String query = "UPDATE groups SET count = count - 1 WHERE leader = '" + CurrentGroupWindow.leaderinfo + "' AND count > 0";
                            try {
                                PreparedStatement st = (PreparedStatement) conn.prepareStatement(query);
                                st.execute();
                            } catch (SQLException e) {
                                e.printStackTrace();
                            }
                        }
                    }
                });
                System.out.println("Session ID: " + sessionID);
                MainWindow window = new MainWindow();
                window.frmPoeQueue.setVisible(true);
            } catch (Exception e) {
                JOptionPane.showMessageDialog(frmPoeQueue, "Failed to connect.");
                e.printStackTrace();
            }
        }
    });
}

[Buggy Hunk]
conn = (Connection) DriverManager.getConnection(LoginInfo.url, LoginInfo.username, LoginInfo.password);

[Patch]
conn = (Connection) DriverManager.getConnection(LoginInfo.getURL(), LoginInfo.getUsername(), LoginInfo.getPassword());

[Demonstration 2]

[Buggy Method]
private void checkFilterEvents() {
    if (isAttached()) {
        boolean b = isFilterable();
        if (!b) {
            unbindFilterEvents();
            unbindFilterCallback();
        } else {
            bindFilterEvents();
            bindFilterableCreated(getDataFilterWidget().getElement(), this);
        }
    }
}

[Buggy Hunk]
bindFilterableCreated(getDataFilterWidget().getElement(), this);

[Patch]
bindFilterableCreated();

[Demonstration 3]

[Buggy Method]
@Test
public void shouldFallbackToLocalhostIfFailedToFetchAndNoIpWereNeverFetched() throws IOException {
    final ServerSocketChannel channel = createMockedServerSocketChannel(49152);
    final ConnectionHandler handler = Mockito.spy(new ConnectionHandler());
    Mockito.doReturn(Optional.empty()).when(handler).getWtfIsMyIp();
    Mockito.doReturn(channel).when(handler).bindToPort();
    handler.init();
    assertThat(handler.getIpAddress().isSiteLocalAddress()).isTrue();
}

[Buggy Hunk]
Mockito.doReturn(Optional.empty()).when(handler).getWtfIsMyIp();

[Patch]
Mockito.doReturn(Optional.empty()).when(handler).tryToFetchFromProviders();