[Demonstration 1]

[Buggy Method]
@Override
public void start() throws Exception {
    String mongoHost = System.getProperty("MONGOHOST", "localhost");
    JsonObject config = new JsonObject();
    config.put("db_name", "qaforum");
    config.put("connection_string", "mongodb://" + mongoHost + ":27017");
    MongoClient client = MongoClient.createShared(super.vertx, config);
    vertx.eventBus().consumer(QUESTION_ADD, message -> {
        System.out.println("To be Created Question " + message.body().toString());
        client.insert(QUESTION_COLLECTION, new JsonObject(message.body().toString()), res -> {
            if (res.succeeded()) {
                message.reply(res.result());
            } else {
                res.cause().printStackTrace();
                message.reply(-1);
            }
        });
    });
    vertx.eventBus().consumer(QUESTION_ALL, message -> {
        FindOptions findOptions = new FindOptions();
        findOptions.setFields(new JsonObject().put("question", "1"));
        client.findWithOptions(QUESTION_COLLECTION, new JsonObject(), findOptions, res -> {
            if (res.succeeded()) {
                if (res.result().size() != 0) {
                    message.reply(res.result().toString());
                } else {
                    message.reply("");
                }
            } else {
                res.cause().printStackTrace();
                message.reply("");
            }
        });
    });
    vertx.eventBus().consumer(QUESTION_ANSWER_ADD, message -> {
        JsonObject input = new JsonObject(message.body().toString());
        // Create the query and the update operation.
        JsonObject query = new JsonObject().put("_id", input.getString("qid"));
        JsonObject answer = new JsonObject().put("answer", input.getString("answer")).put("username", input.getString("username")).put("postTime", System.currentTimeMillis());
        JsonObject update = new JsonObject().put("$addToSet", new JsonObject().put("answers", answer));
        client.updateCollection(QUESTION_COLLECTION, query, update, res -> {
            if (res.succeeded()) {
                message.reply(res.result().toString());
            } else {
                res.cause().printStackTrace();
                message.reply("-1");
            }
        });
    });
    vertx.eventBus().consumer(QUESTION_GET, message -> {
        client.find(QUESTION_COLLECTION, new JsonObject().put("_id", message.body().toString()), res -> {
            if (res.succeeded()) {
                if (res.result().size() != 0) {
                    System.out.println("User exist " + res.result());
                    message.reply(res.result().toString());
                } else {
                    message.reply("");
                }
            } else {
                res.cause().printStackTrace();
                message.reply("");
            }
        });
    });
}

[Buggy Hunk]
message.reply(res.result().toString());

[Patch]
message.reply(""+res.result().getDocModified());

[Demonstration 2]

[Buggy Method]
@RequestMapping(method = RequestMethod.GET, value = "/api/missions")
public ResponseEntity<?> getMissions(@RequestParam("operatorToken") String operatorToken) {
    if (operatorService.tokenExists(operatorToken) && !missionService.isAnyMissionDone(securityHolder.getUserPrincipal().getUsername())) {
        return ResponseEntity.ok(missionService.getDefaultMission());
    } else {
        return ResponseEntity.status(HttpStatus.FORBIDDEN).build();
    }
}

[Buggy Hunk]
if(operatorService.tokenExists(operatorToken) && !missionService.isAnyMissionDone(securityHolder.getUserPrincipal().getUsername())) {

[Patch]
if(operatorService.tokenExists(operatorToken) && !operatorService.isVerified(operatorToken)) {

[Demonstration 3]

[Buggy Method]
@Override
public // UPDATES CUSTOMER ORDER DETAILS BASED ON THE ORDER THAT IS PASSED TO IT
void updateCustomerOrder(CustomerOrder co) {
    List<CustomerOrder> co1 = testData.getCustomerOrders();
    for (int i = 0; i < co1.size(); i++) if (co1.get(i).getCustomerId() == co.getCustomerId())
        co1.set(i, co);
}

[Buggy Hunk]
if (co1.get(i).getCustomerId() == co.getCustomerId())

[Patch]
if (co1.get(i).getCustomerID() == co.getCustomerID())