[Demonstration 1]

[Buggy Method]
public void open() {
    Class.forName("com.mysql.jdbc.Driver");
    conn = DriverManager.getConnection("jdbc:mysql://cslvm74.csc.calpoly.edu/cjacob07", "cjacob07", "Ma94ne07k");
}

[Buggy Hunk]
public void open() {

[Patch]
public void open() throws Exception {

[Demonstration 2]

[Buggy Method]
@Test
public void cancel_login() throws Throwable {
    ILoginModel model = mock(ILoginModel.class);
    EmcSession session = new EmcSession(new BasicCookieStore());
    when(model.login("username", "password")).thenReturn(session);
    ILoginView view = mock(ILoginView.class);
    when(view.getUsername()).thenReturn("username");
    when(view.getPassword()).thenReturn("password");
    when(view.getSavePassword()).thenReturn(true);
    LoginPresenter presenter = new LoginPresenter(view, model);
    presenter.onCancel();
    verify(model, never()).saveSessionInfo(anyString(), anyString());
    verify(model, never()).setSession(any(EmcSession.class));
    verify(view).close();
    assertTrue(presenter.isCanceled());
}

[Buggy Hunk]
EmcSession session = new EmcSession(new BasicCookieStore());

[Patch]
EmcSession session = new EmcSession("username", "password", new BasicCookieStore());

[Demonstration 3]

[Buggy Method]
private void checkKnockback(ACPlayer gp, int packetY, double realY) {
    //old equation is y = 0,0006x - 0,8253 (thx excel)
    //new equation is y = 8E-08x2 + 1E-04x - 0,0219
    //			double predictedY = 0.0006 * packetY - 0.8253;
    double predictedY = (0.00000008 * packetY * packetY) + (0.0001 * packetY) - 0.0219;
    packetY -= 0.05;
    if (predictedY < realY) {
        //legit
        gp.onLegit();
    } else {
        //hax
        double percentage = Math.abs(((realY - predictedY) / predictedY));
        gp.onViolation(percentage);
    }
}

[Buggy Hunk]
if(predictedY < realY){

[Patch]
if(predictedY < realY || gp.getPlayer().hasPermission("knockbackplusplus.bypass")){