[Demonstration 1]

[Buggy Method]
public void confirmUser(JWTokenPassed token) {
    if (!Subject.CONFUSER.equals(token.getSubject())) {
        throw new BadRequestException("wrong token");
    }
    String email = token.getEmail().orElseThrow(() -> new InternalServerErrorException("illegal token generated"));
    UserRecord account = userOperations.getUser(email).orElseThrow(() -> new NotFoundException("User is not existing"));
    if (email.equals(account.getEmail())) {
        throw new BadRequestException("email changed, now active: " + account.getEmail() + ", requested" + email);
    }
    UserRecord userRecord = new UserRecord();
    userRecord.setConfirmed(true);
    userOperations.updateUser(token.getId(), userRecord);
}

[Buggy Hunk]
if (email.equals(account.getEmail())) {

[Patch]
if (!email.equals(account.getEmail())) {

[Demonstration 2]

[Buggy Method]
public KsDef describe_keyspace(String keyspace) throws NotFoundException, InvalidRequestException, TException {
    send_describe_keyspace(keyspace);
    return recv_describe_keyspace();
}

[Buggy Hunk]
public KsDef describe_keyspace(String keyspace) throws NotFoundException, InvalidRequestException, TException

[Patch]
public KsDef describe_keyspace(String keyspace) throws NotFoundException, InvalidRequestException, org.apache.thrift.TException

[Demonstration 3]

[Buggy Method]
@RequestMapping(method = RequestMethod.POST, value = "/login", produces = { "text/html" })
public String loginLibrarian(@RequestParam("email") String email, @RequestParam("password") String password, Model model, HttpServletResponse res) throws SQLException {
    System.out.println("email :" + email);
    User user = userService.getUser(email);
    if (user == null) {
        System.out.println("no user");
        res.setStatus(404);
        model.addAttribute("id", email);
        model.addAttribute("res", res.getStatus());
        return "error";
    } else {
        if (user.getStatus().equals("InActive")) {
            return "activationError";
        } else {
            if ((user.getPassword()).equals(password)) {
                System.out.println("true");
                List<Book> books = userService.getBooks(user.getSjsuId());
                model.addAttribute("user", user);
                model.addAttribute("books", books);
                return "librarian";
            } else {
                System.out.println("wrong pass");
                res.setStatus(404);
                model.addAttribute("id", "worng password");
                model.addAttribute("res", res.getStatus());
                return "error";
            }
        }
    }
}

[Buggy Hunk]
if(user==null){

[Patch]
if(user==null || user.getRole().equals("patron")){