[Demonstration 1]

[Buggy Method]
public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String name = args.length > 0 && args[0] != null ? args[0] : "Anonymous";
    LOGGER.info("Hello, " + name);
    Socket socket = null;
    try {
        socket = getSocket();
    } catch (IOException e) {
        LOGGER.error(e);
    }
    while (sc.hasNextLine()) {
        String command = sc.nextLine();
        LOGGER.info("send command: " + command);
        String response = null;
        if (command.startsWith("add ") || command.startsWith("check ") || command.startsWith("style ")) {
            response = sendRequest(socket, name + " " + command);
        } else {
            LOGGER.info("Incorrect command, please try again");
        }
        LOGGER.info("response: " + response);
    }
}

[Buggy Hunk]
if (command.startsWith("add ") || command.startsWith("check ") || command.startsWith("style ")) {

[Patch]
if (command.equals("ls") || command.startsWith("mv ") || command.startsWith("cd ") || command.startsWith("stat ")) {

[Demonstration 2]

[Buggy Method]
public static ResponseEntity<Response> buildNoSiteNotLoaded() {
    Response resp = error("No site loaded!");
    return ResponseEntity.ok(resp);
}

[Buggy Hunk]
return ResponseEntity.ok(resp);

[Patch]
return ResponseEntity.ok().header("Content-Type", MediaType.APPLICATION_JSON_VALUE).body(resp);

[Demonstration 3]

[Buggy Method]
@Override
public BasketItem getBasketItem(String user_id, String basket_item_id) {
    BasketItem res = null;
    DBCollection col = db.getCollection(COL_BASKETS);
    // query item
    ObjectId _id;
    try {
        _id = new ObjectId(basket_item_id);
        DBCursor curs = col.find(QueryBuilder.start(BasketItem.FLD_OBJ_ID).is(_id).and(BasketItem.FLD_USERID).is(user_id).get());
        // return
        if (curs.hasNext()) {
            DBObject dbo = curs.next();
            res = extractBasketItem(dbo);
        }
    } catch (Exception ex) {
        LOGGER.warning(String.format("%s", ex.getMessage()));
    }
    return res;
}

[Buggy Hunk]
LOGGER.warning(String.format("%s", ex.getMessage()));

[Patch]
LOGGER.warning(String.format("%s", ex.toString()));