[Demonstration 1]

[Buggy Method]
public void mainLoop() {
    // Accelerate
    double a = 0.1f;
    double alpha = 0.1f;
    if (view.getKeyDown(KeyEvent.VK_DOWN) != view.getKeyDown(KeyEvent.VK_UP)) {
        if (view.getKeyDown(KeyEvent.VK_DOWN)) {
            velocity = velocity.relativePlus(velocity.unit(angle).times(-a));
        } else {
            velocity = velocity.relativePlus(velocity.unit(angle).times(a));
        }
    }
    if (view.getKeyDown(KeyEvent.VK_LEFT) != view.getKeyDown(KeyEvent.VK_RIGHT)) {
        if (view.getKeyDown(KeyEvent.VK_LEFT)) {
            angle += alpha;
        } else {
            angle -= alpha;
        }
    }
    velocity = velocity.checked(0.99f);
    // TODO: add objects on click, in current reference frame
    // Add random objects
    if (random(0, 1) < 0.05) {
        Event eventOffset = view.getEvent(random(0, view.getWidth()), random(0, view.getHeight()), velocity);
        timelines.add(new ConstantTimeline(eventOffset, velocity));
        // remove old objects to make room
        if (timelines.size() > 100) {
            timelines.remove(0);
        }
    }
    myTimeline.add(myTimeline.end().plus(velocity.over(dt)));
}

[Buggy Hunk]
velocity = velocity.checked(0.99f);

[Patch]
velocity = velocity.checked(0.99);

[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]
public void applyForce(List<Geometry> sources) {
    for (Geometry geom : sources) {
        if (geom == spatial)
            return;
        float distance = geom.getWorldTranslation().distance(spatial.getWorldTranslation());
        float force = ((Sphere) geom.getMesh()).getRadius();
        Vector3f direction = geom.getWorldTranslation().subtract(spatial.getWorldTranslation());
        velocity = velocity.add(direction.divide(FastMath.pow(distance, 2)).mult(force * 10));
    }
}

[Buggy Hunk]
if (geom == spatial) return;

[Patch]
if (geom == spatial) continue;