[Demonstration 1]

[Buggy Method]
@Override
public Authentication authenticate(Authentication auth) throws AuthenticationException {
    String username = auth.getName();
    String password = (String) auth.getCredentials();
    try {
        if (LoginProvider.checkCredantials(username, password)) {
            User user = ConfigLoader.getInstance().getUsers().queryForId(username.toLowerCase().trim());
            if (user != null) {
                List<GrantedAuthority> grantedAuths = new ArrayList<>();
                for (Role r : user.getRoles()) {
                    grantedAuths.add(new SimpleGrantedAuthority(r.getName()));
                }
                Authentication ret = new UsernamePasswordAuthenticationToken(username, password, grantedAuths);
                return ret;
            }
        }
    } catch (NoSuchAlgorithmException | SQLException | IOException e) {
        System.err.println("ERROR: Unable to check credentials: " + e.getMessage());
        e.printStackTrace();
        throw new AuthenticationServiceException("Unable to check user credantials.", e);
    }
    return null;
}

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

[Patch]
if (user != null && user.isEnabled()) {

[Demonstration 2]

[Buggy Method]
public AccountAmountProjection getAmountOfAccount(int accountId) {
    return accountRepository.findAccountBeanByAccountIdWhereIsActiveTrue(accountId);
}

[Buggy Hunk]
return accountRepository.findAccountBeanByAccountIdWhereIsActiveTrue(accountId);

[Patch]
return accountAmountRepository.findAccountBeanByAccountIdWhereIsActiveTrue(accountId);

[Demonstration 3]

[Buggy Method]
public String extractBody(int maxPayloadLength) {
    String method = request.getMethod();
    if ("GET".equals(method)) {
        return "";
    }
    MediaType mediaType = MediaType.parseMediaType(request.getHeader(HttpHeaders.CONTENT_TYPE));
    RequestBodyExtractor bodyExtractor;
    if ("POST".equals(method) && MediaType.APPLICATION_FORM_URLENCODED.isCompatibleWith(mediaType)) {
        bodyExtractor = new FormUrlencodedRequestBodyExtractor();
    } else {
        bodyExtractor = new DefaultRequestBodyExtractor();
    }
    return bodyExtractor.extractBody(request, maxPayloadLength);
}

[Buggy Hunk]
if ("GET".equals(method)) {

[Patch]
if ("GET".equals(method) || "OPTIONS".equals(method)) {